apify-cli 1.0.0 → 1.1.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/CHANGELOG.md +236 -84
- package/LICENSE.md +201 -0
- package/README.md +49 -543
- package/dist/.tsbuildinfo +1 -1
- package/dist/actor.js +3 -0
- package/dist/actor.js.map +1 -0
- package/dist/apify.js +3 -0
- package/dist/apify.js.map +1 -0
- package/dist/chunk-TJMCNXPV.js +242 -0
- package/dist/chunk-TJMCNXPV.js.map +1 -0
- package/dist/index.js +2 -3
- package/package.json +113 -89
- package/bin/dev.cmd +0 -3
- package/bin/dev.js +0 -21
- package/bin/dev.sh +0 -4
- package/bin/run.cmd +0 -3
- package/bin/run.js +0 -23
- package/dist/commands/actor/get-input.d.ts +0 -6
- package/dist/commands/actor/get-input.d.ts.map +0 -1
- package/dist/commands/actor/get-input.js +0 -14
- package/dist/commands/actor/get-input.js.map +0 -1
- package/dist/commands/actor/get-value.d.ts +0 -9
- package/dist/commands/actor/get-value.d.ts.map +0 -1
- package/dist/commands/actor/get-value.js +0 -27
- package/dist/commands/actor/get-value.js.map +0 -1
- package/dist/commands/actor/index.d.ts +0 -6
- package/dist/commands/actor/index.d.ts.map +0 -1
- package/dist/commands/actor/index.js +0 -13
- package/dist/commands/actor/index.js.map +0 -1
- package/dist/commands/actor/push-data.d.ts +0 -11
- package/dist/commands/actor/push-data.d.ts.map +0 -1
- package/dist/commands/actor/push-data.js +0 -56
- package/dist/commands/actor/push-data.js.map +0 -1
- package/dist/commands/actor/set-value.d.ts +0 -15
- package/dist/commands/actor/set-value.d.ts.map +0 -1
- package/dist/commands/actor/set-value.js +0 -76
- package/dist/commands/actor/set-value.js.map +0 -1
- package/dist/commands/call.d.ts +0 -19
- package/dist/commands/call.d.ts.map +0 -1
- package/dist/commands/call.js +0 -193
- package/dist/commands/call.js.map +0 -1
- package/dist/commands/check-version.d.ts +0 -11
- package/dist/commands/check-version.d.ts.map +0 -1
- package/dist/commands/check-version.js +0 -39
- package/dist/commands/check-version.js.map +0 -1
- package/dist/commands/create.d.ts +0 -15
- package/dist/commands/create.d.ts.map +0 -1
- package/dist/commands/create.js +0 -201
- package/dist/commands/create.js.map +0 -1
- package/dist/commands/edit-input-schema.d.ts +0 -11
- package/dist/commands/edit-input-schema.d.ts.map +0 -1
- package/dist/commands/edit-input-schema.js +0 -176
- package/dist/commands/edit-input-schema.js.map +0 -1
- package/dist/commands/info.d.ts +0 -6
- package/dist/commands/info.d.ts.map +0 -1
- package/dist/commands/info.js +0 -26
- package/dist/commands/info.js.map +0 -1
- package/dist/commands/init-wrap-scrapy.d.ts +0 -10
- package/dist/commands/init-wrap-scrapy.d.ts.map +0 -1
- package/dist/commands/init-wrap-scrapy.js +0 -41
- package/dist/commands/init-wrap-scrapy.js.map +0 -1
- package/dist/commands/init.d.ts +0 -12
- package/dist/commands/init.d.ts.map +0 -1
- package/dist/commands/init.js +0 -88
- package/dist/commands/init.js.map +0 -1
- package/dist/commands/login.d.ts +0 -10
- package/dist/commands/login.d.ts.map +0 -1
- package/dist/commands/login.js +0 -174
- package/dist/commands/login.js.map +0 -1
- package/dist/commands/logout.d.ts +0 -6
- package/dist/commands/logout.d.ts.map +0 -1
- package/dist/commands/logout.js +0 -20
- package/dist/commands/logout.js.map +0 -1
- package/dist/commands/pull.d.ts +0 -12
- package/dist/commands/pull.d.ts.map +0 -1
- package/dist/commands/pull.js +0 -148
- package/dist/commands/pull.js.map +0 -1
- package/dist/commands/push.d.ts +0 -18
- package/dist/commands/push.d.ts.map +0 -1
- package/dist/commands/push.js +0 -298
- package/dist/commands/push.js.map +0 -1
- package/dist/commands/run.d.ts +0 -16
- package/dist/commands/run.d.ts.map +0 -1
- package/dist/commands/run.js +0 -383
- package/dist/commands/run.js.map +0 -1
- package/dist/commands/secrets/add.d.ts +0 -10
- package/dist/commands/secrets/add.d.ts.map +0 -1
- package/dist/commands/secrets/add.js +0 -31
- package/dist/commands/secrets/add.js.map +0 -1
- package/dist/commands/secrets/index.d.ts +0 -6
- package/dist/commands/secrets/index.d.ts.map +0 -1
- package/dist/commands/secrets/index.js +0 -24
- package/dist/commands/secrets/index.js.map +0 -1
- package/dist/commands/secrets/rm.d.ts +0 -9
- package/dist/commands/secrets/rm.d.ts.map +0 -1
- package/dist/commands/secrets/rm.js +0 -27
- package/dist/commands/secrets/rm.js.map +0 -1
- package/dist/commands/task/index.d.ts +0 -6
- package/dist/commands/task/index.d.ts.map +0 -1
- package/dist/commands/task/index.js +0 -13
- package/dist/commands/task/index.js.map +0 -1
- package/dist/commands/task/run.d.ts +0 -16
- package/dist/commands/task/run.d.ts.map +0 -1
- package/dist/commands/task/run.js +0 -91
- package/dist/commands/task/run.js.map +0 -1
- package/dist/commands/validate-schema.d.ts +0 -10
- package/dist/commands/validate-schema.d.ts.map +0 -1
- package/dist/commands/validate-schema.js +0 -58
- package/dist/commands/validate-schema.js.map +0 -1
- package/dist/hooks/deprecations.d.ts +0 -4
- package/dist/hooks/deprecations.d.ts.map +0 -1
- package/dist/hooks/deprecations.js +0 -18
- package/dist/hooks/deprecations.js.map +0 -1
- package/dist/hooks/init.d.ts +0 -7
- package/dist/hooks/init.d.ts.map +0 -1
- package/dist/hooks/init.js +0 -17
- package/dist/hooks/init.js.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/lib/actor.d.ts +0 -27
- package/dist/lib/actor.d.ts.map +0 -1
- package/dist/lib/actor.js +0 -67
- package/dist/lib/actor.js.map +0 -1
- package/dist/lib/apify-oclif-help.d.ts +0 -15
- package/dist/lib/apify-oclif-help.d.ts.map +0 -1
- package/dist/lib/apify-oclif-help.js +0 -19
- package/dist/lib/apify-oclif-help.js.map +0 -1
- package/dist/lib/apify_command.d.ts +0 -21
- package/dist/lib/apify_command.d.ts.map +0 -1
- package/dist/lib/apify_command.js +0 -104
- package/dist/lib/apify_command.js.map +0 -1
- package/dist/lib/commands/resolve-input.d.ts +0 -5
- package/dist/lib/commands/resolve-input.d.ts.map +0 -1
- package/dist/lib/commands/resolve-input.js +0 -29
- package/dist/lib/commands/resolve-input.js.map +0 -1
- package/dist/lib/commands/run-on-cloud.d.ts +0 -20
- package/dist/lib/commands/run-on-cloud.d.ts.map +0 -1
- package/dist/lib/commands/run-on-cloud.js +0 -89
- package/dist/lib/commands/run-on-cloud.js.map +0 -1
- package/dist/lib/community.d.ts +0 -2
- package/dist/lib/community.d.ts.map +0 -1
- package/dist/lib/community.js +0 -4
- package/dist/lib/community.js.map +0 -1
- package/dist/lib/consts.d.ts +0 -54
- package/dist/lib/consts.d.ts.map +0 -1
- package/dist/lib/consts.js +0 -65
- package/dist/lib/consts.js.map +0 -1
- package/dist/lib/create-utils.d.ts +0 -8
- package/dist/lib/create-utils.d.ts.map +0 -1
- package/dist/lib/create-utils.js +0 -148
- package/dist/lib/create-utils.js.map +0 -1
- package/dist/lib/exec.d.ts +0 -3
- package/dist/lib/exec.d.ts.map +0 -1
- package/dist/lib/exec.js +0 -40
- package/dist/lib/exec.js.map +0 -1
- package/dist/lib/files.d.ts +0 -14
- package/dist/lib/files.d.ts.map +0 -1
- package/dist/lib/files.js +0 -58
- package/dist/lib/files.js.map +0 -1
- package/dist/lib/input_schema.d.ts +0 -28
- package/dist/lib/input_schema.d.ts.map +0 -1
- package/dist/lib/input_schema.js +0 -126
- package/dist/lib/input_schema.js.map +0 -1
- package/dist/lib/local_state.d.ts +0 -11
- package/dist/lib/local_state.d.ts.map +0 -1
- package/dist/lib/local_state.js +0 -27
- package/dist/lib/local_state.js.map +0 -1
- package/dist/lib/outputs.d.ts +0 -19
- package/dist/lib/outputs.d.ts.map +0 -1
- package/dist/lib/outputs.js +0 -45
- package/dist/lib/outputs.js.map +0 -1
- package/dist/lib/project_analyzer.d.ts +0 -4
- package/dist/lib/project_analyzer.d.ts.map +0 -1
- package/dist/lib/project_analyzer.js +0 -30
- package/dist/lib/project_analyzer.js.map +0 -1
- package/dist/lib/projects/CrawleeAnalyzer.d.ts +0 -4
- package/dist/lib/projects/CrawleeAnalyzer.d.ts.map +0 -1
- package/dist/lib/projects/CrawleeAnalyzer.js +0 -20
- package/dist/lib/projects/CrawleeAnalyzer.js.map +0 -1
- package/dist/lib/projects/OldApifySDKAnalyzer.d.ts +0 -4
- package/dist/lib/projects/OldApifySDKAnalyzer.d.ts.map +0 -1
- package/dist/lib/projects/OldApifySDKAnalyzer.js +0 -38
- package/dist/lib/projects/OldApifySDKAnalyzer.js.map +0 -1
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts +0 -17
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.d.ts.map +0 -1
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.js +0 -87
- package/dist/lib/projects/scrapy/ScrapyProjectAnalyzer.js.map +0 -1
- package/dist/lib/projects/scrapy/Spider.d.ts +0 -14
- package/dist/lib/projects/scrapy/Spider.d.ts.map +0 -1
- package/dist/lib/projects/scrapy/Spider.js +0 -33
- package/dist/lib/projects/scrapy/Spider.js.map +0 -1
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts +0 -7
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.d.ts.map +0 -1
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js +0 -25
- package/dist/lib/projects/scrapy/SpiderFileAnalyzer.js.map +0 -1
- package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts +0 -4
- package/dist/lib/projects/scrapy/wrapScrapyProject.d.ts.map +0 -1
- package/dist/lib/projects/scrapy/wrapScrapyProject.js +0 -109
- package/dist/lib/projects/scrapy/wrapScrapyProject.js.map +0 -1
- package/dist/lib/projects/shared.d.ts +0 -2
- package/dist/lib/projects/shared.d.ts.map +0 -1
- package/dist/lib/projects/shared.js +0 -13
- package/dist/lib/projects/shared.js.map +0 -1
- package/dist/lib/secrets.d.ts +0 -22
- package/dist/lib/secrets.d.ts.map +0 -1
- package/dist/lib/secrets.js +0 -104
- package/dist/lib/secrets.js.map +0 -1
- package/dist/lib/telemetry.d.ts +0 -21
- package/dist/lib/telemetry.d.ts.map +0 -1
- package/dist/lib/telemetry.js +0 -87
- package/dist/lib/telemetry.js.map +0 -1
- package/dist/lib/types.d.ts +0 -11
- package/dist/lib/types.d.ts.map +0 -1
- package/dist/lib/types.js +0 -2
- package/dist/lib/types.js.map +0 -1
- package/dist/lib/utils.d.ts +0 -102
- package/dist/lib/utils.d.ts.map +0 -1
- package/dist/lib/utils.js +0 -577
- package/dist/lib/utils.js.map +0 -1
- package/dist/lib/version_check.d.ts +0 -14
- package/dist/lib/version_check.d.ts.map +0 -1
- package/dist/lib/version_check.js +0 -90
- package/dist/lib/version_check.js.map +0 -1
- package/oclif.manifest.json +0 -867
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
import { existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
2
|
-
import { dirname } from 'path';
|
|
3
|
-
import { cryptoRandomObjectId } from '@apify/utilities';
|
|
4
|
-
import { Args } from '@oclif/core';
|
|
5
|
-
import cors from 'cors';
|
|
6
|
-
import detectIndent from 'detect-indent';
|
|
7
|
-
import express from 'express';
|
|
8
|
-
import open from 'open';
|
|
9
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
10
|
-
import { LOCAL_CONFIG_PATH } from '../lib/consts.js';
|
|
11
|
-
import { readInputSchema } from '../lib/input_schema.js';
|
|
12
|
-
import { error, info, success, warning } from '../lib/outputs.js';
|
|
13
|
-
const INPUT_SCHEMA_EDITOR_BASE_URL = 'https://apify.github.io/input-schema-editor-react/';
|
|
14
|
-
const INPUT_SCHEMA_EDITOR_ORIGIN = new URL(INPUT_SCHEMA_EDITOR_BASE_URL).origin;
|
|
15
|
-
// Not really checked right now, but it might come useful if we ever need to do some breaking changes
|
|
16
|
-
const API_VERSION = 'v1';
|
|
17
|
-
export class EditInputSchemaCommand extends ApifyCommand {
|
|
18
|
-
async run() {
|
|
19
|
-
// This call fails if no input schema is found on any of the default locations
|
|
20
|
-
const { inputSchema: existingSchema, inputSchemaPath } = await readInputSchema({ forcePath: this.args.path, cwd: process.cwd() });
|
|
21
|
-
if (existingSchema && !inputSchemaPath) {
|
|
22
|
-
// If path is not returned, it means the input schema must be directly embedded as object in actor.json
|
|
23
|
-
// TODO - allow editing input schema embedded in actor.json
|
|
24
|
-
throw new Error(`Editing an input schema directly embedded in "${LOCAL_CONFIG_PATH}" is not yet supported.`);
|
|
25
|
-
}
|
|
26
|
-
warning({ message: 'This command is still experimental and might break at any time. Use at your own risk.\n' });
|
|
27
|
-
info({ message: `Editing input schema at "${inputSchemaPath}"...` });
|
|
28
|
-
let server;
|
|
29
|
-
const app = express();
|
|
30
|
-
// To send requests from browser to localhost, CORS has to be configured properly
|
|
31
|
-
app.use(cors({
|
|
32
|
-
origin: INPUT_SCHEMA_EDITOR_ORIGIN,
|
|
33
|
-
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
34
|
-
}));
|
|
35
|
-
// Turn off keepalive, otherwise closing the server when command is finished is lagging
|
|
36
|
-
app.use((_, res, next) => {
|
|
37
|
-
res.set('Connection', 'close');
|
|
38
|
-
next();
|
|
39
|
-
});
|
|
40
|
-
app.use(express.json());
|
|
41
|
-
// Basic authorization via a random token, which is passed to the input schema editor,
|
|
42
|
-
// and that sends it back via the `token` query param, or `Authorization` header
|
|
43
|
-
const authToken = cryptoRandomObjectId();
|
|
44
|
-
app.use((req, res, next) => {
|
|
45
|
-
let { token } = req.query;
|
|
46
|
-
if (!token) {
|
|
47
|
-
const authorizationHeader = req.get('Authorization');
|
|
48
|
-
if (authorizationHeader) {
|
|
49
|
-
const [schema, tokenFromHeader, ...extra] = authorizationHeader.trim().split(/\s+/);
|
|
50
|
-
if (schema.toLowerCase() === 'bearer' && tokenFromHeader && extra.length === 0) {
|
|
51
|
-
token = tokenFromHeader;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (token !== authToken) {
|
|
56
|
-
res.status(401);
|
|
57
|
-
res.send('Authorization failed');
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
next();
|
|
61
|
-
}
|
|
62
|
-
});
|
|
63
|
-
const apiRouter = express.Router();
|
|
64
|
-
app.use(`/api/${API_VERSION}`, apiRouter);
|
|
65
|
-
// We detect the format of the input schema JSON, so that updating it does not cause too many changes
|
|
66
|
-
let jsonIndentation = ' ';
|
|
67
|
-
let appendFinalNewline = true;
|
|
68
|
-
apiRouter.get('/input-schema', (_, res) => {
|
|
69
|
-
let inputSchemaStr;
|
|
70
|
-
try {
|
|
71
|
-
inputSchemaStr = existsSync(inputSchemaPath) ? readFileSync(inputSchemaPath, { encoding: 'utf-8' }) : '{}\n';
|
|
72
|
-
if (inputSchemaStr.length > 3) {
|
|
73
|
-
jsonIndentation = detectIndent(inputSchemaStr).indent || jsonIndentation;
|
|
74
|
-
}
|
|
75
|
-
if (inputSchemaStr) {
|
|
76
|
-
appendFinalNewline = inputSchemaStr[inputSchemaStr.length - 1] === '\n';
|
|
77
|
-
}
|
|
78
|
-
if (existsSync(inputSchemaPath)) {
|
|
79
|
-
info({ message: `Input schema loaded from "${inputSchemaPath}"` });
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
info({ message: `Empty input schema initialized.` });
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
catch (err) {
|
|
86
|
-
const errorMessage = `Reading input schema from disk failed with: ${err.message}`;
|
|
87
|
-
error({ message: errorMessage });
|
|
88
|
-
res.status(500);
|
|
89
|
-
res.send(errorMessage);
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
92
|
-
let inputSchemaObj;
|
|
93
|
-
try {
|
|
94
|
-
inputSchemaObj = JSON.parse(inputSchemaStr || '{}');
|
|
95
|
-
}
|
|
96
|
-
catch (err) {
|
|
97
|
-
const errorMessage = `Parsing input schema failed with error: ${err.message}`;
|
|
98
|
-
error({ message: errorMessage });
|
|
99
|
-
res.status(500);
|
|
100
|
-
res.send(errorMessage);
|
|
101
|
-
return;
|
|
102
|
-
}
|
|
103
|
-
res.send(inputSchemaObj);
|
|
104
|
-
info({ message: 'Input schema sent to editor.' });
|
|
105
|
-
});
|
|
106
|
-
apiRouter.post('/input-schema', (req, res) => {
|
|
107
|
-
try {
|
|
108
|
-
info({ message: 'Got input schema from editor...' });
|
|
109
|
-
const inputSchemaObj = req.body;
|
|
110
|
-
let inputSchemaStr = JSON.stringify(inputSchemaObj, null, jsonIndentation);
|
|
111
|
-
if (appendFinalNewline)
|
|
112
|
-
inputSchemaStr += '\n';
|
|
113
|
-
const inputSchemaDir = dirname(inputSchemaPath);
|
|
114
|
-
if (!existsSync(inputSchemaDir)) {
|
|
115
|
-
mkdirSync(inputSchemaDir, { recursive: true });
|
|
116
|
-
}
|
|
117
|
-
writeFileSync(inputSchemaPath, inputSchemaStr, { encoding: 'utf-8', flag: 'w+' });
|
|
118
|
-
res.end();
|
|
119
|
-
info({ message: 'Input schema saved to disk.' });
|
|
120
|
-
}
|
|
121
|
-
catch (err) {
|
|
122
|
-
const errorMessage = `Saving input schema failed with error: ${err.message}`;
|
|
123
|
-
error({ message: errorMessage });
|
|
124
|
-
res.status(500);
|
|
125
|
-
res.send(errorMessage);
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
apiRouter.post('/exit', (req, res) => {
|
|
129
|
-
if (req.body.isWindowClosed) {
|
|
130
|
-
info({ message: 'Editor closed, finishing...' });
|
|
131
|
-
}
|
|
132
|
-
else {
|
|
133
|
-
info({ message: 'Editing finished, you can close the editor.' });
|
|
134
|
-
}
|
|
135
|
-
res.end();
|
|
136
|
-
server.close(() => success({ message: 'Done.' }));
|
|
137
|
-
});
|
|
138
|
-
// Listening on port 0 will assign a random available port
|
|
139
|
-
server = app.listen(0);
|
|
140
|
-
const { port } = server.address();
|
|
141
|
-
info({ message: `Listening for messages from input schema editor on port ${port}...` });
|
|
142
|
-
const editorUrl = `${INPUT_SCHEMA_EDITOR_BASE_URL}?localCliPort=${port}&localCliToken=${authToken}&localCliApiVersion=${API_VERSION}`;
|
|
143
|
-
info({ message: `Opening input schema editor at "${editorUrl}"...` });
|
|
144
|
-
await open(editorUrl);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
Object.defineProperty(EditInputSchemaCommand, "description", {
|
|
148
|
-
enumerable: true,
|
|
149
|
-
configurable: true,
|
|
150
|
-
writable: true,
|
|
151
|
-
value: 'Lets you edit your input schema that would be used on the platform in a visual input schema editor.'
|
|
152
|
-
});
|
|
153
|
-
Object.defineProperty(EditInputSchemaCommand, "args", {
|
|
154
|
-
enumerable: true,
|
|
155
|
-
configurable: true,
|
|
156
|
-
writable: true,
|
|
157
|
-
value: {
|
|
158
|
-
path: Args.string({
|
|
159
|
-
required: false,
|
|
160
|
-
description: 'Optional path to your INPUT_SCHEMA.json file. If not provided default platform location for input schema is used.',
|
|
161
|
-
}),
|
|
162
|
-
}
|
|
163
|
-
});
|
|
164
|
-
Object.defineProperty(EditInputSchemaCommand, "hidden", {
|
|
165
|
-
enumerable: true,
|
|
166
|
-
configurable: true,
|
|
167
|
-
writable: true,
|
|
168
|
-
value: true
|
|
169
|
-
});
|
|
170
|
-
Object.defineProperty(EditInputSchemaCommand, "hiddenAliases", {
|
|
171
|
-
enumerable: true,
|
|
172
|
-
configurable: true,
|
|
173
|
-
writable: true,
|
|
174
|
-
value: ['eis']
|
|
175
|
-
});
|
|
176
|
-
//# sourceMappingURL=edit-input-schema.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"edit-input-schema.js","sourceRoot":"","sources":["../../src/commands/edit-input-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAGxE,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,IAAI,E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uB,WAAW,EAAE,CAAC;QACtI,IAAI,CAAC,EAAE,OAAO,EAAE,mCAAmC,SAAS,MAAM,EAAE,CAAC,CAAC;QACtE,MAAM,IAAI,CAAC,SAAS,CAAC,CAAC;IAC1B,CAAC;;AAxJe;;;;WAAc,qGAAqG;GAAC;AAEpH;;;;WAAO;QACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,mHAAmH;SACnI,CAAC;KACL;GAAC;AAEc;;;;WAAS,IAAI;GAAC;AAEd;;;;WAAgB,CAAC,KAAK,CAAC;GAAC"}
|
package/dist/commands/info.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.d.ts","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,qBAAa,WAAY,SAAQ,YAAY,CAAC,OAAO,WAAW,CAAC;IAC7D,OAAgB,WAAW,SACoB;IAEzC,GAAG;CAeZ"}
|
package/dist/commands/info.js
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
3
|
-
import { getLocalUserInfo, getLoggedClientOrThrow } from '../lib/utils.js';
|
|
4
|
-
export class InfoCommand extends ApifyCommand {
|
|
5
|
-
async run() {
|
|
6
|
-
await getLoggedClientOrThrow();
|
|
7
|
-
const info = await getLocalUserInfo();
|
|
8
|
-
if (info) {
|
|
9
|
-
const niceInfo = {
|
|
10
|
-
username: info.username,
|
|
11
|
-
userId: info.id,
|
|
12
|
-
};
|
|
13
|
-
for (const key of Object.keys(niceInfo)) {
|
|
14
|
-
console.log(`${chalk.gray(key)}: ${chalk.bold(niceInfo[key])}`);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
Object.defineProperty(InfoCommand, "description", {
|
|
20
|
-
enumerable: true,
|
|
21
|
-
configurable: true,
|
|
22
|
-
writable: true,
|
|
23
|
-
value: 'Displays information about the currently active Apify account.\n'
|
|
24
|
-
+ 'The information is printed to the console.'
|
|
25
|
-
});
|
|
26
|
-
//# sourceMappingURL=info.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"info.js","sourceRoot":"","sources":["../../src/commands/info.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,MAAM,OAAO,WAAY,SAAQ,YAAgC;IAI7D,KAAK,CAAC,GAAG;QACL,MAAM,sBAAsB,EAAE,CAAC;QAC/B,MAAM,IAAI,GAAG,MAAM,gBAAgB,EAAE,CAAC;QAEtC,IAAI,IAAI,EAAE,CAAC;YACP,MAAM,QAAQ,GAAG;gBACb,QAAQ,EAAE,IAAI,CAAC,QAAQ;gBACvB,MAAM,EAAE,IAAI,CAAC,EAAE;aACT,CAAC;YAEX,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAA8B,EAAE,CAAC;gBACnE,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC;YACpE,CAAC;QACL,CAAC;IACL,CAAC;;AAjBe;;;;WAAc,kEAAkE;UAC9F,4CAA4C;GAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
2
|
-
export declare class WrapScrapyCommand extends ApifyCommand<typeof WrapScrapyCommand> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static args: {
|
|
5
|
-
path: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
-
};
|
|
7
|
-
static hidden: boolean;
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=init-wrap-scrapy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-wrap-scrapy.d.ts","sourceRoot":"","sources":["../../src/commands/init-wrap-scrapy.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAIvD,qBAAa,iBAAkB,SAAQ,YAAY,CAAC,OAAO,iBAAiB,CAAC;IACzE,OAAgB,WAAW,SAO7B;IAEE,OAAgB,IAAI;;MAKlB;IAEF,OAAgB,MAAM,UAAQ;IAExB,GAAG;CAKZ"}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { Args } from '@oclif/core';
|
|
2
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
3
|
-
import { info } from '../lib/outputs.js';
|
|
4
|
-
import { wrapScrapyProject } from '../lib/projects/scrapy/wrapScrapyProject.js';
|
|
5
|
-
export class WrapScrapyCommand extends ApifyCommand {
|
|
6
|
-
async run() {
|
|
7
|
-
await wrapScrapyProject({ projectPath: this.args.path });
|
|
8
|
-
info({ message: 'Scrapy project wrapped successfully.' });
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
Object.defineProperty(WrapScrapyCommand, "description", {
|
|
12
|
-
enumerable: true,
|
|
13
|
-
configurable: true,
|
|
14
|
-
writable: true,
|
|
15
|
-
value: `Wraps your existing Scrapy project to work like an Apify Actor.
|
|
16
|
-
|
|
17
|
-
It adds the following features:
|
|
18
|
-
- Automatic retry of failed requests
|
|
19
|
-
- Automatic proxy rotation
|
|
20
|
-
- Automatic user agent rotation
|
|
21
|
-
...
|
|
22
|
-
`
|
|
23
|
-
});
|
|
24
|
-
Object.defineProperty(WrapScrapyCommand, "args", {
|
|
25
|
-
enumerable: true,
|
|
26
|
-
configurable: true,
|
|
27
|
-
writable: true,
|
|
28
|
-
value: {
|
|
29
|
-
path: Args.string({
|
|
30
|
-
required: false,
|
|
31
|
-
description: 'Optional path to your scrapy project. If not provided, the current directory is used.',
|
|
32
|
-
}),
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
Object.defineProperty(WrapScrapyCommand, "hidden", {
|
|
36
|
-
enumerable: true,
|
|
37
|
-
configurable: true,
|
|
38
|
-
writable: true,
|
|
39
|
-
value: true
|
|
40
|
-
});
|
|
41
|
-
//# sourceMappingURL=init-wrap-scrapy.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-wrap-scrapy.js","sourceRoot":"","sources":["../../src/commands/init-wrap-scrapy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,MAAM,6CAA6C,CAAC;AAEhF,MAAM,OAAO,iBAAkB,SAAQ,YAAsC;IAmBzE,KAAK,CAAC,GAAG;QACL,MAAM,iBAAiB,CAAC,EAAE,WAAW,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC;QAEzD,IAAI,CAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,CAAC,CAAC;IAC9D,CAAC;;AAtBe;;;;WAAc;;;;;;;CAOjC;GAAC;AAEkB;;;;WAAO;QACnB,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC;YACd,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,uFAAuF;SACvG,CAAC;KACL;GAAC;AAEc;;;;WAAS,IAAI;GAAC"}
|
package/dist/commands/init.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
2
|
-
export declare class InitCommand extends ApifyCommand<typeof InitCommand> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static args: {
|
|
5
|
-
actorName: import("@oclif/core/interfaces").Arg<string | undefined, Record<string, unknown>>;
|
|
6
|
-
};
|
|
7
|
-
static flags: {
|
|
8
|
-
yes: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
9
|
-
};
|
|
10
|
-
run(): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
//# sourceMappingURL=init.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAQvD,qBAAa,WAAY,SAAQ,YAAY,CAAC,OAAO,WAAW,CAAC;IAC7D,OAAgB,WAAW,SAI4E;IAEvG,OAAgB,IAAI;;MAKlB;IAEF,OAAgB,KAAK;;MAOnB;IAEI,GAAG;CA+CZ"}
|
package/dist/commands/init.js
DELETED
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { basename } from 'node:path';
|
|
2
|
-
import process from 'node:process';
|
|
3
|
-
import { Args, Flags } from '@oclif/core';
|
|
4
|
-
import inquirer from 'inquirer';
|
|
5
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
6
|
-
import { DEFAULT_LOCAL_STORAGE_DIR, EMPTY_LOCAL_CONFIG, LANGUAGE, LOCAL_CONFIG_PATH, PROJECT_TYPES } from '../lib/consts.js';
|
|
7
|
-
import { createPrefilledInputFileFromInputSchema } from '../lib/input_schema.js';
|
|
8
|
-
import { error, info, success, warning } from '../lib/outputs.js';
|
|
9
|
-
import { ProjectAnalyzer } from '../lib/project_analyzer.js';
|
|
10
|
-
import { wrapScrapyProject } from '../lib/projects/scrapy/wrapScrapyProject.js';
|
|
11
|
-
import { detectLocalActorLanguage, getLocalConfig, getLocalConfigOrThrow, setLocalConfig, setLocalEnv, validateActorName } from '../lib/utils.js';
|
|
12
|
-
export class InitCommand extends ApifyCommand {
|
|
13
|
-
async run() {
|
|
14
|
-
let { actorName } = this.args;
|
|
15
|
-
const cwd = process.cwd();
|
|
16
|
-
if (ProjectAnalyzer.getProjectType(cwd) === PROJECT_TYPES.SCRAPY) {
|
|
17
|
-
info({ message: 'The current directory looks like a Scrapy project. Using automatic project wrapping.' });
|
|
18
|
-
this.telemetryData.actorWrapper = PROJECT_TYPES.SCRAPY;
|
|
19
|
-
return wrapScrapyProject({ projectPath: cwd });
|
|
20
|
-
}
|
|
21
|
-
if (!this.flags.yes && detectLocalActorLanguage(cwd).language === LANGUAGE.UNKNOWN) {
|
|
22
|
-
warning({ message: 'The current directory does not look like a Node.js or Python project.' });
|
|
23
|
-
const { c } = await inquirer.prompt([{ name: 'c', message: 'Do you want to continue?', type: 'confirm' }]);
|
|
24
|
-
if (!c)
|
|
25
|
-
return;
|
|
26
|
-
}
|
|
27
|
-
if (getLocalConfig(cwd)) {
|
|
28
|
-
warning({ message: `Skipping creation of "${LOCAL_CONFIG_PATH}", the file already exists in the current directory.` });
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
if (!actorName) {
|
|
32
|
-
let response = null;
|
|
33
|
-
while (!response) {
|
|
34
|
-
try {
|
|
35
|
-
const answer = await inquirer.prompt([{ name: 'actName', message: 'Actor name:', default: basename(cwd) }]);
|
|
36
|
-
validateActorName(answer.actName);
|
|
37
|
-
response = answer;
|
|
38
|
-
}
|
|
39
|
-
catch (err) {
|
|
40
|
-
error({ message: err.message });
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
({ actName: actorName } = response);
|
|
44
|
-
}
|
|
45
|
-
// Migrate apify.json to .actor/actor.json
|
|
46
|
-
const localConfig = { ...EMPTY_LOCAL_CONFIG, ...await getLocalConfigOrThrow(cwd) };
|
|
47
|
-
await setLocalConfig(Object.assign(localConfig, { name: actorName }), cwd);
|
|
48
|
-
}
|
|
49
|
-
await setLocalEnv(cwd);
|
|
50
|
-
// Create prefilled INPUT.json file from the input schema prefills
|
|
51
|
-
await createPrefilledInputFileFromInputSchema(cwd);
|
|
52
|
-
success({ message: 'The Actor has been initialized in the current directory.' });
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
Object.defineProperty(InitCommand, "description", {
|
|
56
|
-
enumerable: true,
|
|
57
|
-
configurable: true,
|
|
58
|
-
writable: true,
|
|
59
|
-
value: 'Initializes a new Actor project in an existing directory.\n'
|
|
60
|
-
+ `If the directory contains a Scrapy project in Python, the command automatically creates wrappers so that you can run your scrapers without changes.\n\n`
|
|
61
|
-
+ `The command creates the "${LOCAL_CONFIG_PATH}" file and the "${DEFAULT_LOCAL_STORAGE_DIR}" directory in the current directory, `
|
|
62
|
-
+ 'but does not touch any other existing files or directories.\n\n'
|
|
63
|
-
+ `WARNING: The directory at "${DEFAULT_LOCAL_STORAGE_DIR}" will be overwritten if it already exists.`
|
|
64
|
-
});
|
|
65
|
-
Object.defineProperty(InitCommand, "args", {
|
|
66
|
-
enumerable: true,
|
|
67
|
-
configurable: true,
|
|
68
|
-
writable: true,
|
|
69
|
-
value: {
|
|
70
|
-
actorName: Args.string({
|
|
71
|
-
required: false,
|
|
72
|
-
description: 'Name of the Actor. If not provided, you will be prompted for it.',
|
|
73
|
-
}),
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
Object.defineProperty(InitCommand, "flags", {
|
|
77
|
-
enumerable: true,
|
|
78
|
-
configurable: true,
|
|
79
|
-
writable: true,
|
|
80
|
-
value: {
|
|
81
|
-
yes: Flags.boolean({
|
|
82
|
-
char: 'y',
|
|
83
|
-
description: 'Automatic yes to prompts; assume "yes" as answer to all prompts. Note that in some cases, the command may still ask for confirmation.',
|
|
84
|
-
required: false,
|
|
85
|
-
}),
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
//# sourceMappingURL=init.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/comm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MAAM,qBAAqB,CAAC,GAAG,CAAC,EAAE,CAAC;YACnF,MAAM,cAAc,CAAC,MAAM,CAAC,MAAM,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC;QAC/E,CAAC;QAED,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;QAEvB,kEAAkE;QAClE,MAAM,uCAAuC,CAAC,GAAG,CAAC,CAAC;QAEnD,OAAO,CAAC,EAAE,OAAO,EAAE,0DAA0D,EAAE,CAAC,CAAC;IACrF,CAAC;;AApEe;;;;WAAc,6DAA6D;UACzF,yJAAyJ;UACzJ,4BAA4B,iBAAiB,mBAAmB,yBAAyB,wCAAwC;UACjI,iEAAiE;UACjE,8BAA8B,yBAAyB,6CAA6C;GAAC;AAEvF;;;;WAAO;QACnB,SAAS,EAAE,IAAI,CAAC,MAAM,CAAC;YACnB,QAAQ,EAAE,KAAK;YACf,WAAW,EAAE,kEAAkE;SAClF,CAAC;KACL;GAAC;AAEc;;;;WAAQ;QACpB,GAAG,EAAE,KAAK,CAAC,OAAO,CAAC;YACf,IAAI,EAAE,GAAG;YACT,WAAW,EACP,uIAAuI;YAC3I,QAAQ,EAAE,KAAK;SAClB,CAAC;KACL;GAAC"}
|
package/dist/commands/login.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
2
|
-
export declare class LoginCommand extends ApifyCommand<typeof LoginCommand> {
|
|
3
|
-
static description: string;
|
|
4
|
-
static flags: {
|
|
5
|
-
token: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
|
-
method: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
|
-
};
|
|
8
|
-
run(): Promise<void>;
|
|
9
|
-
}
|
|
10
|
-
//# sourceMappingURL=login.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.d.ts","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AA0BvD,qBAAa,YAAa,SAAQ,YAAY,CAAC,OAAO,YAAY,CAAC;IAC/D,OAAgB,WAAW,SAEU;IAErC,OAAgB,KAAK;;;MAYnB;IAEI,GAAG;CA6HZ"}
|
package/dist/commands/login.js
DELETED
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
import { cryptoRandomObjectId } from '@apify/utilities';
|
|
2
|
-
import { Flags } from '@oclif/core';
|
|
3
|
-
import computerName from 'computer-name';
|
|
4
|
-
import cors from 'cors';
|
|
5
|
-
import express from 'express';
|
|
6
|
-
import inquirer from 'inquirer';
|
|
7
|
-
import open from 'open';
|
|
8
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
9
|
-
import { error, info, success } from '../lib/outputs.js';
|
|
10
|
-
import { useApifyIdentity } from '../lib/telemetry.js';
|
|
11
|
-
import { getLocalUserInfo, getLoggedClient } from '../lib/utils.js';
|
|
12
|
-
const CONSOLE_BASE_URL = 'https://console.apify.com/settings/integrations';
|
|
13
|
-
// const CONSOLE_BASE_URL = 'http://localhost:3000/settings/integrations';
|
|
14
|
-
const CONSOLE_URL_ORIGIN = new URL(CONSOLE_BASE_URL).origin;
|
|
15
|
-
const API_BASE_URL = CONSOLE_BASE_URL.includes('localhost') ? 'http://localhost:3333' : undefined;
|
|
16
|
-
// Not really checked right now, but it might come useful if we ever need to do some breaking changes
|
|
17
|
-
const API_VERSION = 'v1';
|
|
18
|
-
const tryToLogin = async (token) => {
|
|
19
|
-
const isUserLogged = await getLoggedClient(token, API_BASE_URL);
|
|
20
|
-
const userInfo = await getLocalUserInfo();
|
|
21
|
-
if (isUserLogged) {
|
|
22
|
-
await useApifyIdentity(userInfo.id);
|
|
23
|
-
success({ message: `You are logged in to Apify as ${userInfo.username || userInfo.id}!` });
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
error({ message: 'Login to Apify failed, the provided API token is not valid.' });
|
|
27
|
-
}
|
|
28
|
-
return isUserLogged;
|
|
29
|
-
};
|
|
30
|
-
export class LoginCommand extends ApifyCommand {
|
|
31
|
-
async run() {
|
|
32
|
-
const { token, method } = this.flags;
|
|
33
|
-
if (token) {
|
|
34
|
-
await tryToLogin(token);
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
let selectedMethod = method;
|
|
38
|
-
if (!method) {
|
|
39
|
-
const answer = await inquirer.prompt([{
|
|
40
|
-
type: 'list',
|
|
41
|
-
name: 'loginMethod',
|
|
42
|
-
message: 'Choose how you want to log in to Apify',
|
|
43
|
-
choices: [
|
|
44
|
-
{
|
|
45
|
-
value: 'console',
|
|
46
|
-
name: 'Through Apify Console in your default browser',
|
|
47
|
-
short: 'Through Apify Console',
|
|
48
|
-
},
|
|
49
|
-
{ value: 'manual', name: 'Enter API token manually', short: 'Manually' },
|
|
50
|
-
],
|
|
51
|
-
loop: true,
|
|
52
|
-
}]);
|
|
53
|
-
selectedMethod = answer.loginMethod;
|
|
54
|
-
}
|
|
55
|
-
if (selectedMethod === 'console') {
|
|
56
|
-
let server;
|
|
57
|
-
const app = express();
|
|
58
|
-
// To send requests from browser to localhost, CORS has to be configured properly
|
|
59
|
-
app.use(cors({
|
|
60
|
-
origin: CONSOLE_URL_ORIGIN,
|
|
61
|
-
allowedHeaders: ['Content-Type', 'Authorization'],
|
|
62
|
-
}));
|
|
63
|
-
// Turn off keepalive, otherwise closing the server when command is finished is lagging
|
|
64
|
-
app.use((_, res, next) => {
|
|
65
|
-
res.set('Connection', 'close');
|
|
66
|
-
next();
|
|
67
|
-
});
|
|
68
|
-
app.use(express.json());
|
|
69
|
-
// Basic authorization via a random token, which is passed to the Apify Console,
|
|
70
|
-
// and that sends it back via the `token` query param, or `Authorization` header
|
|
71
|
-
const authToken = cryptoRandomObjectId();
|
|
72
|
-
app.use((req, res, next) => {
|
|
73
|
-
let { token: serverToken } = req.query;
|
|
74
|
-
if (!serverToken) {
|
|
75
|
-
const authorizationHeader = req.get('Authorization');
|
|
76
|
-
if (authorizationHeader) {
|
|
77
|
-
const [schema, tokenFromHeader, ...extra] = authorizationHeader.trim().split(/\s+/);
|
|
78
|
-
if (schema.toLowerCase() === 'bearer' && tokenFromHeader && extra.length === 0) {
|
|
79
|
-
serverToken = tokenFromHeader;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
if (serverToken !== authToken) {
|
|
84
|
-
res.status(401);
|
|
85
|
-
res.send('Authorization failed');
|
|
86
|
-
}
|
|
87
|
-
else {
|
|
88
|
-
next();
|
|
89
|
-
}
|
|
90
|
-
});
|
|
91
|
-
const apiRouter = express.Router();
|
|
92
|
-
app.use(`/api/${API_VERSION}`, apiRouter);
|
|
93
|
-
apiRouter.post('/login-token', async (req, res) => {
|
|
94
|
-
try {
|
|
95
|
-
if (req.body.apiToken) {
|
|
96
|
-
await tryToLogin(req.body.apiToken);
|
|
97
|
-
}
|
|
98
|
-
else {
|
|
99
|
-
throw new Error('Request did not contain API token');
|
|
100
|
-
}
|
|
101
|
-
res.end();
|
|
102
|
-
}
|
|
103
|
-
catch (err) {
|
|
104
|
-
const errorMessage = `Login to Apify failed with error: ${err.message}`;
|
|
105
|
-
error({ message: errorMessage });
|
|
106
|
-
res.status(500);
|
|
107
|
-
res.send(errorMessage);
|
|
108
|
-
}
|
|
109
|
-
server.close();
|
|
110
|
-
});
|
|
111
|
-
apiRouter.post('/exit', (req, res) => {
|
|
112
|
-
if (req.body.isWindowClosed) {
|
|
113
|
-
error({ message: 'Login to Apify failed, the console window was closed.' });
|
|
114
|
-
}
|
|
115
|
-
else if (req.body.actionCanceled) {
|
|
116
|
-
error({ message: 'Login to Apify failed, the action was canceled in the Apify Console.' });
|
|
117
|
-
}
|
|
118
|
-
else {
|
|
119
|
-
error({ message: 'Login to Apify failed.' });
|
|
120
|
-
}
|
|
121
|
-
res.end();
|
|
122
|
-
server.close();
|
|
123
|
-
});
|
|
124
|
-
// Listening on port 0 will assign a random available port
|
|
125
|
-
server = app.listen(0);
|
|
126
|
-
const { port } = server.address();
|
|
127
|
-
const consoleUrl = new URL(CONSOLE_BASE_URL);
|
|
128
|
-
consoleUrl.searchParams.set('localCliCommand', 'login');
|
|
129
|
-
consoleUrl.searchParams.set('localCliPort', `${port}`);
|
|
130
|
-
consoleUrl.searchParams.set('localCliToken', authToken);
|
|
131
|
-
consoleUrl.searchParams.set('localCliApiVersion', API_VERSION);
|
|
132
|
-
try {
|
|
133
|
-
consoleUrl.searchParams.set('localCliComputerName', encodeURIComponent(computerName()));
|
|
134
|
-
}
|
|
135
|
-
catch {
|
|
136
|
-
// Ignore errors from fetching computer name as it's not critical
|
|
137
|
-
}
|
|
138
|
-
info({ message: `Opening Apify Console at "${consoleUrl.href}"...` });
|
|
139
|
-
await open(consoleUrl.href);
|
|
140
|
-
}
|
|
141
|
-
else {
|
|
142
|
-
console.log('Enter your Apify API token. You can find it at https://console.apify.com/settings/integrations');
|
|
143
|
-
const tokenAnswer = await inquirer.prompt([{ name: 'token', message: 'token:', type: 'password' }]);
|
|
144
|
-
await tryToLogin(tokenAnswer.token);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
Object.defineProperty(LoginCommand, "description", {
|
|
149
|
-
enumerable: true,
|
|
150
|
-
configurable: true,
|
|
151
|
-
writable: true,
|
|
152
|
-
value: 'Logs in to your Apify account.\nThe API token and other account '
|
|
153
|
-
+ 'information is stored in the ~/.apify directory, from where it is read by all other "apify" commands. '
|
|
154
|
-
+ 'To log out, call "apify logout".'
|
|
155
|
-
});
|
|
156
|
-
Object.defineProperty(LoginCommand, "flags", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true,
|
|
159
|
-
writable: true,
|
|
160
|
-
value: {
|
|
161
|
-
token: Flags.string({
|
|
162
|
-
char: 't',
|
|
163
|
-
description: '[Optional] Apify API token',
|
|
164
|
-
required: false,
|
|
165
|
-
}),
|
|
166
|
-
method: Flags.string({
|
|
167
|
-
char: 'm',
|
|
168
|
-
description: '[Optional] Method of logging in to Apify',
|
|
169
|
-
options: ['console', 'manual'],
|
|
170
|
-
required: false,
|
|
171
|
-
}),
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
//# sourceMappingURL=login.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"login.js","sourceRoot":"","sources":["../../src/commands/login.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,YAAY,MAAM,eAAe,CAAC;AACzC,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,OAAO,MAAM,SAAS,CAAC;AAC9B,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACzD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAEpE,MAAM,gBAAgB,GAAG,iDAAiD,CAAC;AAC3E,0EAA0E;AAC1E,MAAM,kBAAkB,GAAG,IAAI,GAAG,CAAC,gBAAgB,CAAC,CAAC,MAAM,CAAC;AAE5D,MAAM,YAAY,GAAG,gBAAgB,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,SAAS,CAAC;AAElG,qGAAqG;AACrG,MAAM,WAAW,GAAG,IAAI,CAAC;AAEzB,MAAM,UAAU,GAAG,KAAK,EAAE,KAAa,EAAE,EAAE;IACvC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MAAM,WAAW,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAoB,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,UAAU,EAAE,CAAC,CAAC,CAAC;YACvH,MAAM,UAAU,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QACxC,CAAC;IACL,CAAC;;AA9Ie;;;;WAAc,kEAAkE;UAC9F,wGAAwG;UACxG,kCAAkC;GAAC;AAErB;;;;WAAQ;QACpB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC;YAChB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,4BAA4B;YACzC,QAAQ,EAAE,KAAK;SAClB,CAAC;QACF,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC;YACjB,IAAI,EAAE,GAAG;YACT,WAAW,EAAE,0CAA0C;YACvD,OAAO,EAAE,CAAC,SAAS,EAAE,QAAQ,CAAC;YAC9B,QAAQ,EAAE,KAAK;SAClB,CAAC;KACL;GAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.d.ts","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAMvD,qBAAa,aAAc,SAAQ,YAAY,CAAC,OAAO,aAAa,CAAC;IACjE,OAAgB,WAAW,SACoE;IAEzF,GAAG;CAKZ"}
|
package/dist/commands/logout.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { ApifyCommand } from '../lib/apify_command.js';
|
|
2
|
-
import { AUTH_FILE_PATH } from '../lib/consts.js';
|
|
3
|
-
import { rimrafPromised } from '../lib/files.js';
|
|
4
|
-
import { success } from '../lib/outputs.js';
|
|
5
|
-
import { regenerateLocalDistinctId } from '../lib/telemetry.js';
|
|
6
|
-
export class LogoutCommand extends ApifyCommand {
|
|
7
|
-
async run() {
|
|
8
|
-
await rimrafPromised(AUTH_FILE_PATH());
|
|
9
|
-
regenerateLocalDistinctId();
|
|
10
|
-
success({ message: 'You are logged out from your Apify account.' });
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
Object.defineProperty(LogoutCommand, "description", {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
configurable: true,
|
|
16
|
-
writable: true,
|
|
17
|
-
value: 'Logs out of your Apify account.\nThe command deletes the API token and all other '
|
|
18
|
-
+ 'account information stored in the ~/.apify directory. To log in again, call "apify login".'
|
|
19
|
-
});
|
|
20
|
-
//# sourceMappingURL=logout.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"logout.js","sourceRoot":"","sources":["../../src/commands/logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC5C,OAAO,EAAE,yBAAyB,EAAE,MAAM,qBAAqB,CAAC;AAEhE,MAAM,OAAO,aAAc,SAAQ,YAAkC;IAIjE,KAAK,CAAC,GAAG;QACL,MAAM,cAAc,CAAC,cAAc,EAAE,CAAC,CAAC;QACvC,yBAAyB,EAAE,CAAC;QAC5B,OAAO,CAAC,EAAE,OAAO,EAAE,6CAA6C,EAAE,CAAC,CAAC;IACxE,CAAC;;AAPe;;;;WAAc,mFAAmF;UAC/G,4FAA4F;GAAC"}
|