@linkedapi/linkedin-cli 1.2.19 → 1.2.21
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/README.md +33 -1
- package/dist/commands/inbox/get.d.ts +1 -0
- package/dist/commands/inbox/get.d.ts.map +1 -1
- package/dist/commands/inbox/get.js +6 -1
- package/dist/commands/inbox/get.js.map +1 -1
- package/dist/commands/message/get.d.ts.map +1 -1
- package/dist/commands/message/get.js +1 -1
- package/dist/commands/message/get.js.map +1 -1
- package/dist/commands/navigator/message/get.d.ts.map +1 -1
- package/dist/commands/navigator/message/get.js +1 -1
- package/dist/commands/navigator/message/get.js.map +1 -1
- package/dist/commands/post/search.d.ts.map +1 -1
- package/dist/commands/post/search.js +27 -10
- package/dist/commands/post/search.js.map +1 -1
- package/dist/utils/linkedin-identifier-pattern.d.ts +10 -0
- package/dist/utils/linkedin-identifier-pattern.d.ts.map +1 -0
- package/dist/utils/linkedin-identifier-pattern.js +15 -0
- package/dist/utils/linkedin-identifier-pattern.js.map +1 -0
- package/dist/utils/post-mention.d.ts.map +1 -1
- package/dist/utils/post-mention.js +6 -10
- package/dist/utils/post-mention.js.map +1 -1
- package/dist/utils/post-search-actor-filter.d.ts +24 -0
- package/dist/utils/post-search-actor-filter.d.ts.map +1 -0
- package/dist/utils/post-search-actor-filter.js +42 -0
- package/dist/utils/post-search-actor-filter.js.map +1 -0
- package/oclif.manifest.json +479 -470
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -289,7 +289,39 @@ linkedin message get https://www.linkedin.com/in/vprudnikoff --json
|
|
|
289
289
|
linkedin message get https://www.linkedin.com/in/vprudnikoff --since 2024-01-15T10:30:00Z
|
|
290
290
|
```
|
|
291
291
|
|
|
292
|
-
> **Note:** The first call for a conversation
|
|
292
|
+
> **Note:** The first call for a conversation loads its history, which may take longer. Subsequent calls use cached data and are faster. Call it once per person – not to check for new messages: prefer `linkedin inbox get --person <url>` to read messages.
|
|
293
|
+
|
|
294
|
+
#### `inbox sync`
|
|
295
|
+
|
|
296
|
+
Enable whole-inbox monitoring for the account. This is the recommended first step for reading messages: run it once, before sending messages whose replies you want to read. Only messages that arrive after it runs are captured.
|
|
297
|
+
|
|
298
|
+
```bash
|
|
299
|
+
linkedin inbox sync # standard inbox
|
|
300
|
+
linkedin inbox sync --nv # Sales Navigator inbox
|
|
301
|
+
```
|
|
302
|
+
|
|
303
|
+
#### `inbox get`
|
|
304
|
+
|
|
305
|
+
Get messages from the monitored inbox; use `--person` for one person's whole conversation.
|
|
306
|
+
|
|
307
|
+
```bash
|
|
308
|
+
linkedin inbox get [flags]
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
| Flag | Type | Description |
|
|
312
|
+
|------|------|-------------|
|
|
313
|
+
| `--since` | string | Only retrieve messages at or after this ISO timestamp |
|
|
314
|
+
| `--type` | string | Filter by inbox type: `st` or `nv` (default: both) |
|
|
315
|
+
| `--thread-id` | string | Restrict to a single conversation thread |
|
|
316
|
+
| `--person` | string | LinkedIn profile URL. Return the whole known conversation with this person, including history loaded by `message get`. A hashed URL always matches; a public URL only once Linked API knows it |
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
linkedin inbox get --json
|
|
320
|
+
linkedin inbox get --since 2024-01-15T10:30:00Z --type nv
|
|
321
|
+
linkedin inbox get --person https://www.linkedin.com/in/vprudnikoff --json
|
|
322
|
+
```
|
|
323
|
+
|
|
324
|
+
With `--person`, the output carries `threads` next to `messages`: each thread has `threadId` (may be `null`), `type`, `personUrn`, `historyFrom` and `historyComplete`, and each message has `inboxMessageId`. If `historyComplete` is `false` and you need earlier messages, run `message get <person-url>` once.
|
|
293
325
|
|
|
294
326
|
---
|
|
295
327
|
|
|
@@ -5,6 +5,7 @@ export default class InboxGet extends BaseCommand {
|
|
|
5
5
|
since: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
6
6
|
type: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
7
7
|
'thread-id': import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
|
+
person: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
8
9
|
json: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
9
10
|
fields: import("@oclif/core/lib/interfaces").OptionFlag<string | undefined, import("@oclif/core/lib/interfaces").CustomOptions>;
|
|
10
11
|
quiet: import("@oclif/core/lib/interfaces").BooleanFlag<boolean>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/inbox/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW;IAC/C,OAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/inbox/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAG5C,MAAM,CAAC,OAAO,OAAO,QAAS,SAAQ,WAAW;IAC/C,OAAgB,WAAW,SACiE;IAE5F,OAAgB,KAAK;;;;;;;;;;MAgBnB;IAEF,OAAgB,QAAQ,WAItB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA4BlC"}
|
|
@@ -4,7 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const _base_command_1 = require("../../base-command");
|
|
5
5
|
const formatter_1 = require("../../core/output/formatter");
|
|
6
6
|
class InboxGet extends _base_command_1.BaseCommand {
|
|
7
|
-
static description =
|
|
7
|
+
static description = "Get messages from the monitored inbox; use --person for one person's whole conversation";
|
|
8
8
|
static flags = {
|
|
9
9
|
..._base_command_1.BaseCommand.baseFlags,
|
|
10
10
|
since: core_1.Flags.string({
|
|
@@ -17,10 +17,14 @@ class InboxGet extends _base_command_1.BaseCommand {
|
|
|
17
17
|
'thread-id': core_1.Flags.string({
|
|
18
18
|
description: 'Restrict to a single conversation thread',
|
|
19
19
|
}),
|
|
20
|
+
person: core_1.Flags.string({
|
|
21
|
+
description: "LinkedIn profile URL: return the whole known conversation with this person, including history loaded by 'message get'. A hashed URL always matches; a public URL only once Linked API knows it",
|
|
22
|
+
}),
|
|
20
23
|
};
|
|
21
24
|
static examples = [
|
|
22
25
|
'<%= config.bin %> inbox get',
|
|
23
26
|
'<%= config.bin %> inbox get --since 2024-01-15T10:30:00Z --type nv',
|
|
27
|
+
'<%= config.bin %> inbox get --person https://www.linkedin.com/in/john-doe --json',
|
|
24
28
|
];
|
|
25
29
|
async run() {
|
|
26
30
|
const { flags } = await this.parse(InboxGet);
|
|
@@ -33,6 +37,7 @@ class InboxGet extends _base_command_1.BaseCommand {
|
|
|
33
37
|
since: flags.since,
|
|
34
38
|
type: flags.type,
|
|
35
39
|
threadId: flags['thread-id'],
|
|
40
|
+
personUrl: flags.person,
|
|
36
41
|
});
|
|
37
42
|
(0, formatter_1.formatOutput)({
|
|
38
43
|
data: result.data,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/inbox/get.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAEpC,iDAA4C;AAC5C,sDAAsD;AAEtD,MAAqB,QAAS,SAAQ,2BAAW;IAC/C,MAAM,CAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/inbox/get.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAEpC,iDAA4C;AAC5C,sDAAsD;AAEtD,MAAqB,QAAS,SAAQ,2BAAW;IAC/C,MAAM,CAAU,WAAW,GACzB,yFAAyF,CAAC;IAE5F,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,2BAAW,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aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;;AAvDH,2BAwDC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/message/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../src/commands/message/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAgB,WAAW,SAC4H;IAEvJ,OAAgB,IAAI;;MAKlB;IAEF,OAAgB,KAAK;;;;;;;;MAUnB;IAEF,OAAgB,QAAQ,WAItB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAsElC"}
|
|
@@ -5,7 +5,7 @@ const _base_command_1 = require("../../base-command");
|
|
|
5
5
|
const formatter_1 = require("../../core/output/formatter");
|
|
6
6
|
const workflow_details_1 = require("../../core/workflow/workflow-details");
|
|
7
7
|
class MessageGet extends _base_command_1.BaseCommand {
|
|
8
|
-
static description =
|
|
8
|
+
static description = "Get conversation messages with a LinkedIn person, loading their history on first call. Prefer 'linkedin inbox get --person <url>' to read messages";
|
|
9
9
|
static args = {
|
|
10
10
|
'person-url': core_1.Args.string({
|
|
11
11
|
description: 'LinkedIn profile URL',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../src/commands/message/get.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAE1C,iDAA4C;AAC5C,sDAAsD;AACtD,sEAAkE;AAElE,MA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AAK,CAAC,KAAK;iBACnB;aACF,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAEhE,IAAA,wBAAY,EAAC;gBACX,IAAI;gBACJ,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,MAAM,EAAE,KAAK,CAAC,IAAI;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;;AAlGH,6BAmGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/navigator/message/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IAC1D,OAAgB,WAAW,
|
|
1
|
+
{"version":3,"file":"get.d.ts","sourceRoot":"","sources":["../../../../src/commands/navigator/message/get.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAI5C,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,WAAW;IAC1D,OAAgB,WAAW,SAC+H;IAE1J,OAAgB,IAAI;;MAKlB;IAEF,OAAgB,KAAK;;;;;;;MAKnB;IAEF,OAAgB,QAAQ,WAEtB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAqElC"}
|
|
@@ -5,7 +5,7 @@ const _base_command_1 = require("../../../base-command");
|
|
|
5
5
|
const formatter_1 = require("../../../core/output/formatter");
|
|
6
6
|
const workflow_details_1 = require("../../../core/workflow/workflow-details");
|
|
7
7
|
class NavigatorMessageGet extends _base_command_1.BaseCommand {
|
|
8
|
-
static description =
|
|
8
|
+
static description = "Get Sales Navigator conversation messages, loading their history on first call. Prefer 'linkedin inbox get --person <url> --type nv' to read messages";
|
|
9
9
|
static args = {
|
|
10
10
|
'person-url': core_1.Args.string({
|
|
11
11
|
description: 'LinkedIn profile URL',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/navigator/message/get.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAE1C,iDAA4C;AAC5C,sDAAsD;AACtD,sEAAkE;AAElE,MAAqB,mBAAoB,SAAQ,2BAAW;IAC1D,MAAM,CAAU,WAAW,
|
|
1
|
+
{"version":3,"file":"get.js","sourceRoot":"","sources":["../../../../src/commands/navigator/message/get.ts"],"names":[],"mappings":";;AAAA,sCAA0C;AAE1C,iDAA4C;AAC5C,sDAAsD;AACtD,sEAAkE;AAElE,MAAqB,mBAAoB,SAAQ,2BAAW;IAC1D,MAAM,CAAU,WAAW,GACzB,uJAAuJ,CAAC;IAE1J,MAAM,CAAU,IAAI,GAAG;QACrB,YAAY,EAAE,WAAI,CAAC,MAAM,CAAC;YACxB,WAAW,EAAE,sBAAsB;YACnC,QAAQ,EAAE,IAAI;SACf,CAAC;KACH,CAAC;IAEF,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,2BAAW,CAAC,SAAS;QACxB,KAAK,EAAE,YAAK,CAAC,MAAM,CAAC;YAClB,WAAW,EAAE,uCAAuC;SACrD,CAAC;KACH,CAAC;IAEF,MAAM,CAAU,QAAQ,GAAG;QACzB,8EAA8E;KAC/E,CAAC;IAEK,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAE9D,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,wBAAwB,EAAE,CAAC;QAErD,IAAI,CA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CAAC,MAAM,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YAE5D,gCAAgC;YAChC,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,iBAAiB,CAAC;gBACjD;oBACE,SAAS,EAAE,IAAI,CAAC,YAAY,CAAC;oBAC7B,IAAI,EAAE,IAAI;oBACV,KAAK,EAAE,KAAK,CAAC,KAAK;iBACnB;aACF,CAAC,CAAC;YAEH,MAAM,IAAI,GAAG,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;YAEhE,IAAA,wBAAY,EAAC;gBACX,IAAI;gBACJ,MAAM,EAAE,WAAW,CAAC,MAAM;gBAC1B,MAAM,EAAE,KAAK,CAAC,IAAI;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;;AA1FH,sCA2FC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/post/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"search.d.ts","sourceRoot":"","sources":["../../../src/commands/post/search.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAK5C,MAAM,CAAC,OAAO,OAAO,UAAW,SAAQ,WAAW;IACjD,OAAgB,WAAW,SAAkC;IAE7D,OAAgB,KAAK;;;;;;;;;;;;;;;;;;MA+CnB;IAEF,OAAgB,QAAQ,WAKtB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CA6DlC"}
|
|
@@ -4,6 +4,7 @@ const core_1 = require("@oclif/core");
|
|
|
4
4
|
const _base_command_1 = require("../../base-command");
|
|
5
5
|
const formatter_1 = require("../../core/output/formatter");
|
|
6
6
|
const workflow_runner_1 = require("../../core/workflow/workflow-runner");
|
|
7
|
+
const post_search_actor_filter_1 = require("../../utils/post-search-actor-filter");
|
|
7
8
|
class PostSearch extends _base_command_1.BaseCommand {
|
|
8
9
|
static description = 'Search for posts on LinkedIn';
|
|
9
10
|
static flags = {
|
|
@@ -30,19 +31,19 @@ class PostSearch extends _base_command_1.BaseCommand {
|
|
|
30
31
|
description: 'Filter by author relationship (comma-separated: me, firstConnections, peopleYouFollow)',
|
|
31
32
|
}),
|
|
32
33
|
'from-members': core_1.Flags.string({
|
|
33
|
-
description: 'Filter by
|
|
34
|
+
description: 'Filter by people whose posts to keep (comma-separated name or name:identifier, where the identifier is a member URN or profile URL)',
|
|
34
35
|
}),
|
|
35
36
|
'from-companies': core_1.Flags.string({
|
|
36
|
-
description: 'Filter by
|
|
37
|
+
description: 'Filter by companies whose posts to keep (comma-separated name or name:identifier, where the identifier is an organization URN or company URL)',
|
|
37
38
|
}),
|
|
38
39
|
'mentioning-members': core_1.Flags.string({
|
|
39
|
-
description: 'Filter by
|
|
40
|
+
description: 'Filter by people the post must mention (comma-separated name or name:identifier, where the identifier is a member URN or profile URL)',
|
|
40
41
|
}),
|
|
41
42
|
'mentioning-companies': core_1.Flags.string({
|
|
42
|
-
description: 'Filter by
|
|
43
|
+
description: 'Filter by companies the post must mention (comma-separated name or name:identifier, where the identifier is an organization URN or company URL)',
|
|
43
44
|
}),
|
|
44
45
|
'author-companies': core_1.Flags.string({
|
|
45
|
-
description: 'Filter by
|
|
46
|
+
description: 'Filter by companies the author works at (comma-separated name or name:identifier, where the identifier is an organization URN or company URL)',
|
|
46
47
|
}),
|
|
47
48
|
'author-industries': core_1.Flags.string({
|
|
48
49
|
description: 'Filter by industries the author works in (comma-separated)',
|
|
@@ -52,6 +53,7 @@ class PostSearch extends _base_command_1.BaseCommand {
|
|
|
52
53
|
'<%= config.bin %> post search --term "climate tech" --date-posted pastWeek --json',
|
|
53
54
|
'<%= config.bin %> post search --term "product launch" --content-type images --sort latest --limit 20 --json',
|
|
54
55
|
'<%= config.bin %> post search --term "hiring" --from-companies "Linked API" --posted-by "peopleYouFollow" --json',
|
|
56
|
+
'<%= config.bin %> post search --term "ai" --from-members "Bill Gates,Example Person:urn:li:member:123456789" --mentioning-companies "Example Company:https://www.linkedin.com/company/example-company" --json',
|
|
55
57
|
];
|
|
56
58
|
async run() {
|
|
57
59
|
const { flags } = await this.parse(PostSearch);
|
|
@@ -71,15 +73,30 @@ class PostSearch extends _base_command_1.BaseCommand {
|
|
|
71
73
|
if (flags['posted-by'])
|
|
72
74
|
filter.postedBy = splitCsv(flags['posted-by']);
|
|
73
75
|
if (flags['from-members'])
|
|
74
|
-
filter.fromMembers =
|
|
76
|
+
filter.fromMembers = (0, post_search_actor_filter_1.parsePostSearchActorFilter)({
|
|
77
|
+
value: flags['from-members'],
|
|
78
|
+
actorKind: 'member',
|
|
79
|
+
});
|
|
75
80
|
if (flags['from-companies'])
|
|
76
|
-
filter.fromCompanies =
|
|
81
|
+
filter.fromCompanies = (0, post_search_actor_filter_1.parsePostSearchActorFilter)({
|
|
82
|
+
value: flags['from-companies'],
|
|
83
|
+
actorKind: 'company',
|
|
84
|
+
});
|
|
77
85
|
if (flags['mentioning-members'])
|
|
78
|
-
filter.mentioningMembers =
|
|
86
|
+
filter.mentioningMembers = (0, post_search_actor_filter_1.parsePostSearchActorFilter)({
|
|
87
|
+
value: flags['mentioning-members'],
|
|
88
|
+
actorKind: 'member',
|
|
89
|
+
});
|
|
79
90
|
if (flags['mentioning-companies'])
|
|
80
|
-
filter.mentioningCompanies =
|
|
91
|
+
filter.mentioningCompanies = (0, post_search_actor_filter_1.parsePostSearchActorFilter)({
|
|
92
|
+
value: flags['mentioning-companies'],
|
|
93
|
+
actorKind: 'company',
|
|
94
|
+
});
|
|
81
95
|
if (flags['author-companies'])
|
|
82
|
-
filter.authorCompanies =
|
|
96
|
+
filter.authorCompanies = (0, post_search_actor_filter_1.parsePostSearchActorFilter)({
|
|
97
|
+
value: flags['author-companies'],
|
|
98
|
+
actorKind: 'company',
|
|
99
|
+
});
|
|
83
100
|
if (flags['author-industries'])
|
|
84
101
|
filter.authorIndustries = splitCsv(flags['author-industries']);
|
|
85
102
|
if (Object.keys(filter).length > 0) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/post/search.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAEpC,iDAA4C;AAC5C,sDAAsD;AACtD,oEAA6D;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../src/commands/post/search.ts"],"names":[],"mappings":";;AAAA,sCAAoC;AAEpC,iDAA4C;AAC5C,sDAAsD;AACtD,oEAA6D;AAC7D,8EAA6E;AAE7E,MAAqB,UAAW,SAAQ,2BAAW;IACjD,MAAM,CAAU,WAAW,GAAG,8BAA8B,CAAC;IAE7D,MAAM,CAAU,KAAK,GAAG;QACtB,GAAG,2BAAW,CAAC,SAAS;QACxB,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,+CAA+C;SAC7D,CAAC;QACF,KAAK,EAAE,YAAK,CAAC,OAAO,CAAC;YACnB,WAAW,EAAE,kCAAkC;SAChD,CAAC;QACF,IAAI,EAAE,YAAK,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,2BAA2B;YACxC,OAAO,EAAE,CAAC,UAAU,EAAE,QAAQ,CAAC;SAChC,CAAC;QACF,aAAa,EAAE,YAAK,CAAC,MAAM,CAAC;YAC1B,WAAW,EAAE,+CAA+C;YAC5D,OAAO,EAAE,CAAC,aAAa,EAAE,UAAU,EAAE,WAAW,CAAC;SAClD,CAAC;QACF,cAAc,EAAE,YAAK,CAAC,MAAM,CAAC;YAC3B,WAAW,EAAE,wBAAwB;YACrC,OAAO,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B,CAAC,CAAC;QACL,IAAI,KAAK,CAAC,mBAAmB,CAAC;YAAE,MAAM,CAAC,gBAAgB,GAAG,QAAQ,CAAC,KAAK,CAAC,mBAAmB,CAAC,CAAC,CAAC;QAE/F,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACnC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC;QACzB,CAAC;QAED,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,IAAA,6BAAW,EAAC,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE;gBAC3D,OAAO,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC,CAAC;YAEH,IAAA,wBAAY,EAAC;gBACX,IAAI,EAAE,MAAM,CAAC,IAAI;gBACjB,MAAM,EAAE,MAAM,CAAC,MAAM;gBACrB,MAAM,EAAE,KAAK,CAAC,IAAI;gBAClB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,OAAO,EAAE,KAAK,CAAC,KAAK;aACrB,CAAC,CAAC;QACL,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,CAAC;IACH,CAAC;;AAvHH,6BAwHC;AAED,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;AAC/C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const LINKEDIN_IDENTIFIER_PATTERN: {
|
|
2
|
+
readonly startSource: "(?:urn:li:|https?:\\/\\/)";
|
|
3
|
+
readonly memberUrn: RegExp;
|
|
4
|
+
readonly organizationUrn: RegExp;
|
|
5
|
+
readonly personUrl: RegExp;
|
|
6
|
+
readonly companyUrl: RegExp;
|
|
7
|
+
readonly salesPersonUrl: RegExp;
|
|
8
|
+
readonly salesCompanyUrl: RegExp;
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=linkedin-identifier-pattern.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin-identifier-pattern.d.ts","sourceRoot":"","sources":["../../src/utils/linkedin-identifier-pattern.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,2BAA2B;;;;;;;;CAU9B,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LINKEDIN_IDENTIFIER_PATTERN = void 0;
|
|
4
|
+
exports.LINKEDIN_IDENTIFIER_PATTERN = {
|
|
5
|
+
// An identifier is itself full of colons, so a `name:identifier` split cannot be positional: the
|
|
6
|
+
// name ends where a value that announces itself as a URN or a URL begins.
|
|
7
|
+
startSource: '(?:urn:li:|https?:\\/\\/)',
|
|
8
|
+
memberUrn: /^urn:li:member:\d+$/,
|
|
9
|
+
organizationUrn: /^urn:li:organization:\d+$/,
|
|
10
|
+
personUrl: /^https?:\/\/[^/]*linkedin\.com\/in\//i,
|
|
11
|
+
companyUrl: /^https?:\/\/[^/]*linkedin\.com\/company\//i,
|
|
12
|
+
salesPersonUrl: /^https?:\/\/[^/]*linkedin\.com\/sales\/(?:lead|people)\//i,
|
|
13
|
+
salesCompanyUrl: /^https?:\/\/[^/]*linkedin\.com\/sales\/company\//i,
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=linkedin-identifier-pattern.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkedin-identifier-pattern.js","sourceRoot":"","sources":["../../src/utils/linkedin-identifier-pattern.ts"],"names":[],"mappings":";;;AAAa,QAAA,2BAA2B,GAAG;IACzC,iGAAiG;IACjG,0EAA0E;IAC1E,WAAW,EAAE,2BAA2B;IACxC,SAAS,EAAE,qBAAqB;IAChC,eAAe,EAAE,2BAA2B;IAC5C,SAAS,EAAE,uCAAuC;IAClD,UAAU,EAAE,4CAA4C;IACxD,cAAc,EAAE,2DAA2D;IAC3E,eAAe,EAAE,mDAAmD;CAC5D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-mention.d.ts","sourceRoot":"","sources":["../../src/utils/post-mention.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"post-mention.d.ts","sourceRoot":"","sources":["../../src/utils/post-mention.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,kBAAkB;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,MAAM,GAAG,kBAAkB,CA6BlE"}
|
|
@@ -1,13 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.parsePostMention = parsePostMention;
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const COMPANY_URL_PATTERN = /^https?:\/\/[^/]*linkedin\.com\/company\//i;
|
|
8
|
-
// The identifier is optional and is itself full of colons, so the split cannot be positional: the
|
|
9
|
-
// name ends where a value that announces itself as a URN or a URL begins.
|
|
10
|
-
const MENTION_PATTERN = /^([^:]+):(.*?)(?::((?:urn:li:|https?:\/\/).*))?$/;
|
|
4
|
+
const linkedin_identifier_pattern_1 = require("./linkedin-identifier-pattern");
|
|
5
|
+
const { memberUrn, organizationUrn, personUrl, companyUrl, startSource } = linkedin_identifier_pattern_1.LINKEDIN_IDENTIFIER_PATTERN;
|
|
6
|
+
const MENTION_PATTERN = new RegExp(`^([^:]+):(.*?)(?::(${startSource}.*))?$`);
|
|
11
7
|
/**
|
|
12
8
|
* Parses one `--mention` value: `key:name` or `key:name:identifier`.
|
|
13
9
|
*
|
|
@@ -26,13 +22,13 @@ function parsePostMention(value) {
|
|
|
26
22
|
if (!identifier) {
|
|
27
23
|
return mention;
|
|
28
24
|
}
|
|
29
|
-
if (
|
|
25
|
+
if (memberUrn.test(identifier) || organizationUrn.test(identifier)) {
|
|
30
26
|
mention.urn = identifier;
|
|
31
27
|
}
|
|
32
|
-
else if (
|
|
28
|
+
else if (personUrl.test(identifier)) {
|
|
33
29
|
mention.personHashedUrl = identifier;
|
|
34
30
|
}
|
|
35
|
-
else if (
|
|
31
|
+
else if (companyUrl.test(identifier)) {
|
|
36
32
|
mention.companyHashedUrl = identifier;
|
|
37
33
|
}
|
|
38
34
|
else {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post-mention.js","sourceRoot":"","sources":["../../src/utils/post-mention.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"post-mention.js","sourceRoot":"","sources":["../../src/utils/post-mention.ts"],"names":[],"mappings":";;AAoBA,4CA6BC;AAjDD,+EAA4E;AAE5E,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,GACtE,yDAA2B,CAAC;AAC9B,MAAM,eAAe,GAAG,IAAI,MAAM,CAAC,sBAAsB,WAAW,QAAQ,CAAC,CAAC;AAU9E;;;;;GAKG;AACH,SAAgB,gBAAgB,CAAC,KAAa;IAC5C,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,GAAG,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAC/B,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAEhC,IAAI,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,MAAM,IAAI,KAAK,CAAC,4BAA4B,KAAK,mCAAmC,CAAC,CAAC;IACxF,CAAC;IAED,MAAM,OAAO,GAAuB,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAClD,MAAM,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAEtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,eAAe,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACnE,OAAO,CAAC,GAAG,GAAG,UAAU,CAAC;IAC3B,CAAC;SAAM,IAAI,SAAS,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACtC,OAAO,CAAC,eAAe,GAAG,UAAU,CAAC;IACvC,CAAC;SAAM,IAAI,UAAU,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC;QACvC,OAAO,CAAC,gBAAgB,GAAG,UAAU,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,MAAM,IAAI,KAAK,CACb,kCAAkC,KAAK,uGAAuG,CAC/I,CAAC;IACJ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
declare const IDENTIFIER_PATTERNS_BY_KIND: {
|
|
2
|
+
readonly member: readonly [RegExp, RegExp, RegExp];
|
|
3
|
+
readonly company: readonly [RegExp, RegExp, RegExp];
|
|
4
|
+
};
|
|
5
|
+
type TActorKind = keyof typeof IDENTIFIER_PATTERNS_BY_KIND;
|
|
6
|
+
interface TActorFilterWithId {
|
|
7
|
+
name: string;
|
|
8
|
+
id: string;
|
|
9
|
+
}
|
|
10
|
+
type TActorFilterEntry = string | TActorFilterWithId;
|
|
11
|
+
/**
|
|
12
|
+
* Parses a comma-separated `post search` actor flag, where each element is `name` or
|
|
13
|
+
* `name:identifier`.
|
|
14
|
+
*
|
|
15
|
+
* An element without an identifier stays the plain string it always was, so existing calls send
|
|
16
|
+
* exactly what they sent before. An identifier must name the flag's kind of entity: a person for
|
|
17
|
+
* the member flags, a company for the company flags.
|
|
18
|
+
*/
|
|
19
|
+
export declare function parsePostSearchActorFilter({ value, actorKind, }: {
|
|
20
|
+
value: string;
|
|
21
|
+
actorKind: TActorKind;
|
|
22
|
+
}): Array<TActorFilterEntry>;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=post-search-actor-filter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-search-actor-filter.d.ts","sourceRoot":"","sources":["../../src/utils/post-search-actor-filter.ts"],"names":[],"mappings":"AAaA,QAAA,MAAM,2BAA2B;;;CAGvB,CAAC;AAOX,KAAK,UAAU,GAAG,MAAM,OAAO,2BAA2B,CAAC;AAE3D,UAAU,kBAAkB;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;CACZ;AAED,KAAK,iBAAiB,GAAG,MAAM,GAAG,kBAAkB,CAAC;AAErD;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,SAAS,GACV,EAAE;IACD,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,UAAU,CAAC;CACvB,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAE3B"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parsePostSearchActorFilter = parsePostSearchActorFilter;
|
|
4
|
+
const linkedin_identifier_pattern_1 = require("./linkedin-identifier-pattern");
|
|
5
|
+
const { startSource, memberUrn, organizationUrn, personUrl, companyUrl, salesPersonUrl, salesCompanyUrl, } = linkedin_identifier_pattern_1.LINKEDIN_IDENTIFIER_PATTERN;
|
|
6
|
+
const ACTOR_FILTER_ELEMENT_PATTERN = new RegExp(`^(.*?)(?::(${startSource}.*))?$`);
|
|
7
|
+
const IDENTIFIER_PATTERNS_BY_KIND = {
|
|
8
|
+
member: [memberUrn, personUrl, salesPersonUrl],
|
|
9
|
+
company: [organizationUrn, companyUrl, salesCompanyUrl],
|
|
10
|
+
};
|
|
11
|
+
const EXPECTED_IDENTIFIER_BY_KIND = {
|
|
12
|
+
member: 'urn:li:member:<id> or a LinkedIn profile URL',
|
|
13
|
+
company: 'urn:li:organization:<id> or a LinkedIn company URL',
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Parses a comma-separated `post search` actor flag, where each element is `name` or
|
|
17
|
+
* `name:identifier`.
|
|
18
|
+
*
|
|
19
|
+
* An element without an identifier stays the plain string it always was, so existing calls send
|
|
20
|
+
* exactly what they sent before. An identifier must name the flag's kind of entity: a person for
|
|
21
|
+
* the member flags, a company for the company flags.
|
|
22
|
+
*/
|
|
23
|
+
function parsePostSearchActorFilter({ value, actorKind, }) {
|
|
24
|
+
return value.split(',').map((element) => parseElement({ element: element.trim(), actorKind }));
|
|
25
|
+
}
|
|
26
|
+
function parseElement({ element, actorKind, }) {
|
|
27
|
+
const match = ACTOR_FILTER_ELEMENT_PATTERN.exec(element);
|
|
28
|
+
const identifier = match?.[2]?.trim();
|
|
29
|
+
if (!identifier) {
|
|
30
|
+
return element;
|
|
31
|
+
}
|
|
32
|
+
const name = match?.[1]?.trim();
|
|
33
|
+
if (!name) {
|
|
34
|
+
throw new Error(`Invalid filter value: "${element}". Expected name[:identifier]`);
|
|
35
|
+
}
|
|
36
|
+
const isExpectedKind = IDENTIFIER_PATTERNS_BY_KIND[actorKind].some((pattern) => pattern.test(identifier));
|
|
37
|
+
if (!isExpectedKind) {
|
|
38
|
+
throw new Error(`Invalid filter identifier in "${element}". Expected ${EXPECTED_IDENTIFIER_BY_KIND[actorKind]}`);
|
|
39
|
+
}
|
|
40
|
+
return { name, id: identifier };
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=post-search-actor-filter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"post-search-actor-filter.js","sourceRoot":"","sources":["../../src/utils/post-search-actor-filter.ts"],"names":[],"mappings":";;AAwCA,gEAQC;AAhDD,+EAA4E;AAE5E,MAAM,EACJ,WAAW,EACX,SAAS,EACT,eAAe,EACf,SAAS,EACT,UAAU,EACV,cAAc,EACd,eAAe,GAChB,GAAG,yDAA2B,CAAC;AAChC,MAAM,4BAA4B,GAAG,IAAI,MAAM,CAAC,cAAc,WAAW,QAAQ,CAAC,CAAC;AAEnF,MAAM,2BAA2B,GAAG;IAClC,MAAM,EAAE,CAAC,SAAS,EAAE,SAAS,EAAE,cAAc,CAAC;IAC9C,OAAO,EAAE,CAAC,eAAe,EAAE,UAAU,EAAE,eAAe,CAAC;CAC/C,CAAC;AAEX,MAAM,2BAA2B,GAAG;IAClC,MAAM,EAAE,8CAA8C;IACtD,OAAO,EAAE,oDAAoD;CACrD,CAAC;AAWX;;;;;;;GAOG;AACH,SAAgB,0BAA0B,CAAC,EACzC,KAAK,EACL,SAAS,GAIV;IACC,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,OAAO,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC,CAAC;AACjG,CAAC;AAED,SAAS,YAAY,CAAC,EACpB,OAAO,EACP,SAAS,GAIV;IACC,MAAM,KAAK,GAAG,4BAA4B,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACzD,MAAM,UAAU,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAEtC,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,IAAI,GAAG,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC;IAEhC,IAAI,CAAC,IAAI,E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