@singi-labs/sifa-sdk 0.11.13 → 0.11.14
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 +43 -0
- package/dist/{feed-DHTy7fUN.d.cts → feed-BaHtJXYR.d.cts} +98 -1
- package/dist/{feed-DHTy7fUN.d.ts → feed-BaHtJXYR.d.ts} +98 -1
- package/dist/index.cjs +102 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +26 -2
- package/dist/index.d.ts +26 -2
- package/dist/index.js +94 -2
- package/dist/index.js.map +1 -1
- package/dist/{keys-DuICaiIq.d.ts → keys-C0AracRc.d.ts} +6 -2
- package/dist/{keys-K8kCuA5J.d.cts → keys-DLxYsNCp.d.cts} +6 -2
- package/dist/query/fetchers/index.cjs +83 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +22 -4
- package/dist/query/fetchers/index.d.ts +22 -4
- package/dist/query/fetchers/index.js +81 -1
- package/dist/query/fetchers/index.js.map +1 -1
- package/dist/query/hooks/index.cjs +118 -0
- package/dist/query/hooks/index.cjs.map +1 -1
- package/dist/query/hooks/index.d.cts +73 -4
- package/dist/query/hooks/index.d.ts +73 -4
- package/dist/query/hooks/index.js +116 -2
- package/dist/query/hooks/index.js.map +1 -1
- package/dist/query/index.cjs +119 -0
- package/dist/query/index.cjs.map +1 -1
- package/dist/query/index.d.cts +5 -5
- package/dist/query/index.d.ts +5 -5
- package/dist/query/index.js +114 -2
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/index.cjs +47 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +1 -1
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.js +43 -1
- package/dist/schemas/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -89,6 +89,49 @@ pnpm lint
|
|
|
89
89
|
pnpm typecheck
|
|
90
90
|
```
|
|
91
91
|
|
|
92
|
+
### Testing your changes
|
|
93
|
+
|
|
94
|
+
For SDK logic in isolation (schemas, formatters, taxonomies, fetchers), write a
|
|
95
|
+
test and run the watcher. No consumer app needed:
|
|
96
|
+
|
|
97
|
+
```bash
|
|
98
|
+
pnpm test:watch
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
To test a change end-to-end inside a consumer (sifa-web, sifa-api), link your
|
|
102
|
+
local build in. The SDK ships its compiled `dist/`, not source, so keep a build
|
|
103
|
+
running while you edit:
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
pnpm dev # tsup --watch, rebuilds dist/ on save
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Then point the consumer at your checkout. For a pnpm consumer (sifa-web), an
|
|
110
|
+
override is more reproducible across installs than a bare `pnpm link`:
|
|
111
|
+
|
|
112
|
+
```jsonc
|
|
113
|
+
// consumer package.json
|
|
114
|
+
"pnpm": { "overrides": { "@singi-labs/sifa-sdk": "link:../sifa-sdk" } }
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
then `pnpm install`. For an npm consumer (sifa-api), `npm link` works.
|
|
118
|
+
|
|
119
|
+
`react` and `@tanstack/react-query` are optional peer dependencies. If a linked
|
|
120
|
+
build throws "Invalid hook call" or a missing QueryClient, the consumer is
|
|
121
|
+
resolving two copies of them: run `pnpm dedupe`, or add an override pinning both
|
|
122
|
+
to a single version. Only the `./query/hooks` export needs React, so non-React
|
|
123
|
+
consumers like sifa-api never hit this.
|
|
124
|
+
|
|
125
|
+
For a publish-faithful check with no watch, pack a tarball instead of linking:
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
pnpm build && pnpm pack # produces singi-labs-sifa-sdk-x.y.z.tgz
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
then `pnpm add ./singi-labs-sifa-sdk-x.y.z.tgz` in the consumer. This installs
|
|
132
|
+
exactly what would publish (respects `files: ["dist"]`), with no symlink
|
|
133
|
+
resolution quirks.
|
|
134
|
+
|
|
92
135
|
Standards:
|
|
93
136
|
|
|
94
137
|
- Strict TypeScript -- `strict: true`, no `any`
|
|
@@ -1,5 +1,102 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A single typeahead row. Discriminated on `source`: a curated `entity` row
|
|
5
|
+
* carries `entityId`, a `pdl` staging row carries `pdlId`. The union guarantees
|
|
6
|
+
* the identifier for the row's source is always present, so a stable React key
|
|
7
|
+
* can never be `entity:undefined`. The disambiguation fields
|
|
8
|
+
* (domain/country/parentName) drive the dropdown display.
|
|
9
|
+
*/
|
|
10
|
+
declare const EntitySearchResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
kind: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
14
|
+
country: z.ZodNullable<z.ZodString>;
|
|
15
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
16
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
17
|
+
source: z.ZodLiteral<"entity">;
|
|
18
|
+
entityId: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
23
|
+
country: z.ZodNullable<z.ZodString>;
|
|
24
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
25
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
26
|
+
source: z.ZodLiteral<"pdl">;
|
|
27
|
+
pdlId: z.ZodString;
|
|
28
|
+
}, z.core.$strip>], "source">;
|
|
29
|
+
type EntitySearchResult = z.infer<typeof EntitySearchResultSchema>;
|
|
30
|
+
/** Response of `GET /api/entities/search`. */
|
|
31
|
+
declare const EntitySearchResponseSchema: z.ZodObject<{
|
|
32
|
+
results: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
kind: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
36
|
+
country: z.ZodNullable<z.ZodString>;
|
|
37
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
38
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
39
|
+
source: z.ZodLiteral<"entity">;
|
|
40
|
+
entityId: z.ZodNumber;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
kind: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
45
|
+
country: z.ZodNullable<z.ZodString>;
|
|
46
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
47
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
48
|
+
source: z.ZodLiteral<"pdl">;
|
|
49
|
+
pdlId: z.ZodString;
|
|
50
|
+
}, z.core.$strip>], "source">>;
|
|
51
|
+
hasMore: z.ZodBoolean;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
type EntitySearchResponse = z.infer<typeof EntitySearchResponseSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* Body of `POST /api/entities/select`: promote a PDL row OR bump an entity.
|
|
56
|
+
* Exactly one of `entityId`/`pdlId` must be present -- supplying both is
|
|
57
|
+
* ambiguous (the server would have to silently pick one) and is rejected.
|
|
58
|
+
*/
|
|
59
|
+
declare const EntitySelectRequestSchema: z.ZodObject<{
|
|
60
|
+
entityId: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
pdlId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
type EntitySelectRequest = z.infer<typeof EntitySelectRequestSchema>;
|
|
64
|
+
/** Response of `POST /api/entities/select`. `entityRef` is the portable
|
|
65
|
+
* Wikidata/ROR/LEI URI to write to the position record, or null for a
|
|
66
|
+
* PDL-only entity (its resolution stays AppView-side). */
|
|
67
|
+
declare const EntitySelectResponseSchema: z.ZodObject<{
|
|
68
|
+
entityId: z.ZodNumber;
|
|
69
|
+
slug: z.ZodString;
|
|
70
|
+
kind: z.ZodString;
|
|
71
|
+
canonicalName: z.ZodString;
|
|
72
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
73
|
+
entityRef: z.ZodNullable<z.ZodString>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
type EntitySelectResponse = z.infer<typeof EntitySelectResponseSchema>;
|
|
76
|
+
/** Response of `POST /api/entities/import-search`. */
|
|
77
|
+
declare const EntityImportSearchResponseSchema: z.ZodObject<{
|
|
78
|
+
results: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
79
|
+
kind: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
82
|
+
country: z.ZodNullable<z.ZodString>;
|
|
83
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
84
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
85
|
+
source: z.ZodLiteral<"entity">;
|
|
86
|
+
entityId: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
kind: z.ZodString;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
91
|
+
country: z.ZodNullable<z.ZodString>;
|
|
92
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
93
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
94
|
+
source: z.ZodLiteral<"pdl">;
|
|
95
|
+
pdlId: z.ZodString;
|
|
96
|
+
}, z.core.$strip>], "source">>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
type EntityImportSearchResponse = z.infer<typeof EntityImportSearchResponseSchema>;
|
|
99
|
+
|
|
3
100
|
/**
|
|
4
101
|
* Profile row shared across `/api/following`, `/api/profile/:handleOrDid/mutuals`,
|
|
5
102
|
* and `/api/me/bluesky-suggestions`. Matches the existing `FollowProfile` TS
|
|
@@ -251,4 +348,4 @@ interface FeedCursor {
|
|
|
251
348
|
declare function encodeFeedCursor(cursor: FeedCursor): string;
|
|
252
349
|
declare function decodeFeedCursor(encoded: string): FeedCursor;
|
|
253
350
|
|
|
254
|
-
export { type AtmosphereFeedItem as A, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d,
|
|
351
|
+
export { type AtmosphereFeedItem as A, encodeFeedCursor as B, type EntitySearchResult as E, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d, type EntityImportSearchResponse as e, EntityImportSearchResponseSchema as f, type EntitySearchResponse as g, EntitySearchResponseSchema as h, EntitySearchResultSchema as i, type EntitySelectRequest as j, EntitySelectRequestSchema as k, type EntitySelectResponse as l, EntitySelectResponseSchema as m, FEATURE_FLAGS as n, FeatureAllowlistEntrySchema as o, type FeedActor as p, FeedActorSchema as q, type FeedCursor as r, type FollowFeedItem as s, FollowFeedItemSchema as t, FollowFeedPageSchema as u, type FollowProfilePage as v, FollowProfilePageSchema as w, FollowProfileSchema as x, SifaFeedItemSchema as y, decodeFeedCursor as z };
|
|
@@ -1,5 +1,102 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* A single typeahead row. Discriminated on `source`: a curated `entity` row
|
|
5
|
+
* carries `entityId`, a `pdl` staging row carries `pdlId`. The union guarantees
|
|
6
|
+
* the identifier for the row's source is always present, so a stable React key
|
|
7
|
+
* can never be `entity:undefined`. The disambiguation fields
|
|
8
|
+
* (domain/country/parentName) drive the dropdown display.
|
|
9
|
+
*/
|
|
10
|
+
declare const EntitySearchResultSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
11
|
+
kind: z.ZodString;
|
|
12
|
+
name: z.ZodString;
|
|
13
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
14
|
+
country: z.ZodNullable<z.ZodString>;
|
|
15
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
16
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
17
|
+
source: z.ZodLiteral<"entity">;
|
|
18
|
+
entityId: z.ZodNumber;
|
|
19
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
20
|
+
kind: z.ZodString;
|
|
21
|
+
name: z.ZodString;
|
|
22
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
23
|
+
country: z.ZodNullable<z.ZodString>;
|
|
24
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
25
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
26
|
+
source: z.ZodLiteral<"pdl">;
|
|
27
|
+
pdlId: z.ZodString;
|
|
28
|
+
}, z.core.$strip>], "source">;
|
|
29
|
+
type EntitySearchResult = z.infer<typeof EntitySearchResultSchema>;
|
|
30
|
+
/** Response of `GET /api/entities/search`. */
|
|
31
|
+
declare const EntitySearchResponseSchema: z.ZodObject<{
|
|
32
|
+
results: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
33
|
+
kind: z.ZodString;
|
|
34
|
+
name: z.ZodString;
|
|
35
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
36
|
+
country: z.ZodNullable<z.ZodString>;
|
|
37
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
38
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
39
|
+
source: z.ZodLiteral<"entity">;
|
|
40
|
+
entityId: z.ZodNumber;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
kind: z.ZodString;
|
|
43
|
+
name: z.ZodString;
|
|
44
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
45
|
+
country: z.ZodNullable<z.ZodString>;
|
|
46
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
47
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
48
|
+
source: z.ZodLiteral<"pdl">;
|
|
49
|
+
pdlId: z.ZodString;
|
|
50
|
+
}, z.core.$strip>], "source">>;
|
|
51
|
+
hasMore: z.ZodBoolean;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
type EntitySearchResponse = z.infer<typeof EntitySearchResponseSchema>;
|
|
54
|
+
/**
|
|
55
|
+
* Body of `POST /api/entities/select`: promote a PDL row OR bump an entity.
|
|
56
|
+
* Exactly one of `entityId`/`pdlId` must be present -- supplying both is
|
|
57
|
+
* ambiguous (the server would have to silently pick one) and is rejected.
|
|
58
|
+
*/
|
|
59
|
+
declare const EntitySelectRequestSchema: z.ZodObject<{
|
|
60
|
+
entityId: z.ZodOptional<z.ZodNumber>;
|
|
61
|
+
pdlId: z.ZodOptional<z.ZodString>;
|
|
62
|
+
}, z.core.$strip>;
|
|
63
|
+
type EntitySelectRequest = z.infer<typeof EntitySelectRequestSchema>;
|
|
64
|
+
/** Response of `POST /api/entities/select`. `entityRef` is the portable
|
|
65
|
+
* Wikidata/ROR/LEI URI to write to the position record, or null for a
|
|
66
|
+
* PDL-only entity (its resolution stays AppView-side). */
|
|
67
|
+
declare const EntitySelectResponseSchema: z.ZodObject<{
|
|
68
|
+
entityId: z.ZodNumber;
|
|
69
|
+
slug: z.ZodString;
|
|
70
|
+
kind: z.ZodString;
|
|
71
|
+
canonicalName: z.ZodString;
|
|
72
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
73
|
+
entityRef: z.ZodNullable<z.ZodString>;
|
|
74
|
+
}, z.core.$strip>;
|
|
75
|
+
type EntitySelectResponse = z.infer<typeof EntitySelectResponseSchema>;
|
|
76
|
+
/** Response of `POST /api/entities/import-search`. */
|
|
77
|
+
declare const EntityImportSearchResponseSchema: z.ZodObject<{
|
|
78
|
+
results: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
79
|
+
kind: z.ZodString;
|
|
80
|
+
name: z.ZodString;
|
|
81
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
82
|
+
country: z.ZodNullable<z.ZodString>;
|
|
83
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
84
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
85
|
+
source: z.ZodLiteral<"entity">;
|
|
86
|
+
entityId: z.ZodNumber;
|
|
87
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
88
|
+
kind: z.ZodString;
|
|
89
|
+
name: z.ZodString;
|
|
90
|
+
domain: z.ZodNullable<z.ZodString>;
|
|
91
|
+
country: z.ZodNullable<z.ZodString>;
|
|
92
|
+
logoUrl: z.ZodNullable<z.ZodString>;
|
|
93
|
+
parentName: z.ZodNullable<z.ZodString>;
|
|
94
|
+
source: z.ZodLiteral<"pdl">;
|
|
95
|
+
pdlId: z.ZodString;
|
|
96
|
+
}, z.core.$strip>], "source">>;
|
|
97
|
+
}, z.core.$strip>;
|
|
98
|
+
type EntityImportSearchResponse = z.infer<typeof EntityImportSearchResponseSchema>;
|
|
99
|
+
|
|
3
100
|
/**
|
|
4
101
|
* Profile row shared across `/api/following`, `/api/profile/:handleOrDid/mutuals`,
|
|
5
102
|
* and `/api/me/bluesky-suggestions`. Matches the existing `FollowProfile` TS
|
|
@@ -251,4 +348,4 @@ interface FeedCursor {
|
|
|
251
348
|
declare function encodeFeedCursor(cursor: FeedCursor): string;
|
|
252
349
|
declare function decodeFeedCursor(encoded: string): FeedCursor;
|
|
253
350
|
|
|
254
|
-
export { type AtmosphereFeedItem as A, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d,
|
|
351
|
+
export { type AtmosphereFeedItem as A, encodeFeedCursor as B, type EntitySearchResult as E, type FollowFeedPage as F, type SifaFeedItem as S, type FollowProfileItem as a, type FeatureAllowlistEntry as b, type FeatureFlag as c, AtmosphereFeedItemSchema as d, type EntityImportSearchResponse as e, EntityImportSearchResponseSchema as f, type EntitySearchResponse as g, EntitySearchResponseSchema as h, EntitySearchResultSchema as i, type EntitySelectRequest as j, EntitySelectRequestSchema as k, type EntitySelectResponse as l, EntitySelectResponseSchema as m, FEATURE_FLAGS as n, FeatureAllowlistEntrySchema as o, type FeedActor as p, FeedActorSchema as q, type FeedCursor as r, type FollowFeedItem as s, FollowFeedItemSchema as t, FollowFeedPageSchema as u, type FollowProfilePage as v, FollowProfilePageSchema as w, FollowProfileSchema as x, SifaFeedItemSchema as y, decodeFeedCursor as z };
|
package/dist/index.cjs
CHANGED
|
@@ -2404,6 +2404,56 @@ function pickPrimaryPosition(positions) {
|
|
|
2404
2404
|
if (flagged) return flagged;
|
|
2405
2405
|
return [...active].sort((a, b) => (b.startedAt ?? "").localeCompare(a.startedAt ?? ""))[0];
|
|
2406
2406
|
}
|
|
2407
|
+
|
|
2408
|
+
// src/logic/pseudo-employer.ts
|
|
2409
|
+
var PSEUDO_EMPLOYERS = /* @__PURE__ */ new Set([
|
|
2410
|
+
"self",
|
|
2411
|
+
"self employed",
|
|
2412
|
+
"selfemployed",
|
|
2413
|
+
"self employment",
|
|
2414
|
+
"self employed freelance",
|
|
2415
|
+
"freelance",
|
|
2416
|
+
"freelancer",
|
|
2417
|
+
"freelancing",
|
|
2418
|
+
"freelance work",
|
|
2419
|
+
"independent",
|
|
2420
|
+
"independent contractor",
|
|
2421
|
+
"independent consultant",
|
|
2422
|
+
"independent professional",
|
|
2423
|
+
"sole proprietor",
|
|
2424
|
+
"sole proprietorship",
|
|
2425
|
+
"sole trader",
|
|
2426
|
+
"own business",
|
|
2427
|
+
"my own business",
|
|
2428
|
+
"self employed consultant"
|
|
2429
|
+
]);
|
|
2430
|
+
function normalizePseudo(value) {
|
|
2431
|
+
return value.toLowerCase().replace(/[^a-z0-9]+/g, " ").trim().replace(/\s+/g, " ");
|
|
2432
|
+
}
|
|
2433
|
+
function isPseudoEmployer(company) {
|
|
2434
|
+
const normalized = normalizePseudo(company);
|
|
2435
|
+
if (!normalized) return false;
|
|
2436
|
+
return PSEUDO_EMPLOYERS.has(normalized);
|
|
2437
|
+
}
|
|
2438
|
+
|
|
2439
|
+
// src/logic/entity-disambiguation.ts
|
|
2440
|
+
function entityDisambiguationLabel(fields) {
|
|
2441
|
+
const parts = [];
|
|
2442
|
+
if (fields.domain) parts.push(fields.domain);
|
|
2443
|
+
if (fields.country) parts.push(fields.country);
|
|
2444
|
+
if (fields.parentName) parts.push(`part of ${fields.parentName}`);
|
|
2445
|
+
return parts.join(" \xB7 ");
|
|
2446
|
+
}
|
|
2447
|
+
function searchResultDisambiguation(result) {
|
|
2448
|
+
return entityDisambiguationLabel({
|
|
2449
|
+
domain: result.domain,
|
|
2450
|
+
country: result.country,
|
|
2451
|
+
parentName: result.parentName
|
|
2452
|
+
});
|
|
2453
|
+
}
|
|
2454
|
+
function entityResultKey(result) {
|
|
2455
|
+
return result.source === "entity" ? `entity:${result.entityId}` : `pdl:${result.pdlId}`;
|
|
2456
|
+
}
|
|
2407
2457
|
function maxGraphemes(max) {
|
|
2408
2458
|
return (value) => {
|
|
2409
2459
|
const segmenter = new Intl.Segmenter(void 0, { granularity: "grapheme" });
|
|
@@ -2439,6 +2489,48 @@ var EndorsementConfirmationRecordSchema = zod.z.object({
|
|
|
2439
2489
|
endorsement: strongRefSchema,
|
|
2440
2490
|
createdAt: datetimeSchema
|
|
2441
2491
|
});
|
|
2492
|
+
var httpUrlNullable = zod.z.string().refine((s) => /^https?:\/\//i.test(s), { message: "must be an http(s) URL" }).nullable();
|
|
2493
|
+
var searchResultCommon = {
|
|
2494
|
+
kind: zod.z.string(),
|
|
2495
|
+
name: zod.z.string(),
|
|
2496
|
+
domain: zod.z.string().nullable(),
|
|
2497
|
+
country: zod.z.string().nullable(),
|
|
2498
|
+
logoUrl: httpUrlNullable,
|
|
2499
|
+
parentName: zod.z.string().nullable()
|
|
2500
|
+
};
|
|
2501
|
+
var EntitySearchResultSchema = zod.z.discriminatedUnion("source", [
|
|
2502
|
+
zod.z.object({
|
|
2503
|
+
source: zod.z.literal("entity"),
|
|
2504
|
+
entityId: zod.z.number().int().positive(),
|
|
2505
|
+
...searchResultCommon
|
|
2506
|
+
}),
|
|
2507
|
+
zod.z.object({
|
|
2508
|
+
source: zod.z.literal("pdl"),
|
|
2509
|
+
pdlId: zod.z.string().min(1),
|
|
2510
|
+
...searchResultCommon
|
|
2511
|
+
})
|
|
2512
|
+
]);
|
|
2513
|
+
var EntitySearchResponseSchema = zod.z.object({
|
|
2514
|
+
results: zod.z.array(EntitySearchResultSchema),
|
|
2515
|
+
hasMore: zod.z.boolean()
|
|
2516
|
+
});
|
|
2517
|
+
var EntitySelectRequestSchema = zod.z.object({
|
|
2518
|
+
entityId: zod.z.number().int().positive().optional(),
|
|
2519
|
+
pdlId: zod.z.string().min(1).optional()
|
|
2520
|
+
}).refine((v) => v.entityId != null !== (v.pdlId != null), {
|
|
2521
|
+
message: "exactly one of entityId or pdlId is required"
|
|
2522
|
+
});
|
|
2523
|
+
var EntitySelectResponseSchema = zod.z.object({
|
|
2524
|
+
entityId: zod.z.number().int().positive(),
|
|
2525
|
+
slug: zod.z.string(),
|
|
2526
|
+
kind: zod.z.string(),
|
|
2527
|
+
canonicalName: zod.z.string(),
|
|
2528
|
+
domain: zod.z.string().nullable(),
|
|
2529
|
+
entityRef: httpUrlNullable
|
|
2530
|
+
});
|
|
2531
|
+
var EntityImportSearchResponseSchema = zod.z.object({
|
|
2532
|
+
results: zod.z.array(EntitySearchResultSchema)
|
|
2533
|
+
});
|
|
2442
2534
|
var EndorsementRecordSchema = zod.z.object({
|
|
2443
2535
|
subject: didSchema,
|
|
2444
2536
|
skill: strongRefSchema,
|
|
@@ -2705,7 +2797,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
2705
2797
|
});
|
|
2706
2798
|
|
|
2707
2799
|
// src/index.ts
|
|
2708
|
-
var SIFA_SDK_VERSION = "0.11.
|
|
2800
|
+
var SIFA_SDK_VERSION = "0.11.14";
|
|
2709
2801
|
|
|
2710
2802
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
2711
2803
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
|
@@ -2729,6 +2821,11 @@ exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
|
|
|
2729
2821
|
exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
|
|
2730
2822
|
exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
|
|
2731
2823
|
exports.EndorsementRecordSchema = EndorsementRecordSchema;
|
|
2824
|
+
exports.EntityImportSearchResponseSchema = EntityImportSearchResponseSchema;
|
|
2825
|
+
exports.EntitySearchResponseSchema = EntitySearchResponseSchema;
|
|
2826
|
+
exports.EntitySearchResultSchema = EntitySearchResultSchema;
|
|
2827
|
+
exports.EntitySelectRequestSchema = EntitySelectRequestSchema;
|
|
2828
|
+
exports.EntitySelectResponseSchema = EntitySelectResponseSchema;
|
|
2732
2829
|
exports.FEATURE_FLAGS = FEATURE_FLAGS;
|
|
2733
2830
|
exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
|
|
2734
2831
|
exports.FeedActorSchema = FeedActorSchema;
|
|
@@ -2791,6 +2888,8 @@ exports.didSchema = didSchema;
|
|
|
2791
2888
|
exports.dimensionsFromInputs = dimensionsFromInputs;
|
|
2792
2889
|
exports.durationFromMinutes = durationFromMinutes;
|
|
2793
2890
|
exports.encodeFeedCursor = encodeFeedCursor;
|
|
2891
|
+
exports.entityDisambiguationLabel = entityDisambiguationLabel;
|
|
2892
|
+
exports.entityResultKey = entityResultKey;
|
|
2794
2893
|
exports.externalRecordRefSchema = externalRecordRefSchema;
|
|
2795
2894
|
exports.findIndustry = findIndustry;
|
|
2796
2895
|
exports.formatDistanceToNow = formatDistanceToNow;
|
|
@@ -2827,6 +2926,7 @@ exports.isAppCategory = isAppCategory;
|
|
|
2827
2926
|
exports.isCompanyRequired = isCompanyRequired;
|
|
2828
2927
|
exports.isKnownAppId = isKnownAppId;
|
|
2829
2928
|
exports.isKnownPlatform = isKnownPlatform;
|
|
2929
|
+
exports.isPseudoEmployer = isPseudoEmployer;
|
|
2830
2930
|
exports.isValidRgbColor = isValidRgbColor;
|
|
2831
2931
|
exports.isVisibleActivityItem = isVisibleActivityItem;
|
|
2832
2932
|
exports.languageTagSchema = languageTagSchema;
|
|
@@ -2856,6 +2956,7 @@ exports.resolveCardUrl = resolveCardUrl;
|
|
|
2856
2956
|
exports.rgbToString = rgbToString;
|
|
2857
2957
|
exports.sanitizeDisplayText = sanitizeDisplayText;
|
|
2858
2958
|
exports.sanitizeHandleInput = sanitizeHandleInput;
|
|
2959
|
+
exports.searchResultDisambiguation = searchResultDisambiguation;
|
|
2859
2960
|
exports.selfLabelsSchema = selfLabelsSchema;
|
|
2860
2961
|
exports.singleDateExtractor = singleDateExtractor;
|
|
2861
2962
|
exports.sortByDateDesc = sortByDateDesc;
|