@singi-labs/sifa-sdk 0.11.13 → 0.11.15
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/{adult-content-BpZD_3ow.d.cts → adult-content-C0XGPU5A.d.cts} +6 -0
- package/dist/{adult-content-BpZD_3ow.d.ts → adult-content-C0XGPU5A.d.ts} +6 -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 +105 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +28 -4
- package/dist/index.d.ts +28 -4
- package/dist/index.js +97 -2
- package/dist/index.js.map +1 -1
- package/dist/{keys-DuICaiIq.d.ts → keys-Cdu3x0cr.d.ts} +7 -3
- package/dist/{keys-K8kCuA5J.d.cts → keys-DdIxFB-C.d.cts} +7 -3
- package/dist/query/fetchers/index.cjs +83 -0
- package/dist/query/fetchers/index.cjs.map +1 -1
- package/dist/query/fetchers/index.d.cts +23 -5
- package/dist/query/fetchers/index.d.ts +23 -5
- 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 +74 -5
- package/dist/query/hooks/index.d.ts +74 -5
- 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 +6 -6
- package/dist/query/index.d.ts +6 -6
- package/dist/query/index.js +114 -2
- package/dist/query/index.js.map +1 -1
- package/dist/schemas/index.cjs +50 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +2 -1
- package/dist/schemas/index.d.ts +2 -1
- package/dist/schemas/index.js +46 -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`
|
|
@@ -14,6 +14,12 @@ interface SkillRef {
|
|
|
14
14
|
interface ProfilePosition {
|
|
15
15
|
rkey: string;
|
|
16
16
|
company: string;
|
|
17
|
+
/**
|
|
18
|
+
* Portable org entity identifier (Wikidata/ROR/LEI URI) written when the user
|
|
19
|
+
* picks an organization from the resolver typeahead. Absent for free-text or
|
|
20
|
+
* independent positions (#159).
|
|
21
|
+
*/
|
|
22
|
+
entityRef?: string;
|
|
17
23
|
title: string;
|
|
18
24
|
description?: string;
|
|
19
25
|
startedAt: string;
|
|
@@ -14,6 +14,12 @@ interface SkillRef {
|
|
|
14
14
|
interface ProfilePosition {
|
|
15
15
|
rkey: string;
|
|
16
16
|
company: string;
|
|
17
|
+
/**
|
|
18
|
+
* Portable org entity identifier (Wikidata/ROR/LEI URI) written when the user
|
|
19
|
+
* picks an organization from the resolver typeahead. Absent for free-text or
|
|
20
|
+
* independent positions (#159).
|
|
21
|
+
*/
|
|
22
|
+
entityRef?: string;
|
|
17
23
|
title: string;
|
|
18
24
|
description?: string;
|
|
19
25
|
startedAt: string;
|
|
@@ -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,
|
|
@@ -2598,6 +2690,9 @@ var ProfileLanguageRecordSchema = zod.z.object({
|
|
|
2598
2690
|
var ProfilePositionRecordSchema = zod.z.object({
|
|
2599
2691
|
company: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3).optional(),
|
|
2600
2692
|
companyDid: didSchema.optional(),
|
|
2693
|
+
// Portable org entity identifier (Wikidata/ROR/LEI URI) from the typeahead.
|
|
2694
|
+
// Constrained to http(s) so a script-bearing scheme is never a valid ref (#159).
|
|
2695
|
+
entityRef: zod.z.string().url().refine((s) => /^https?:\/\//i.test(s), { message: "entityRef must be an http(s) URL" }).max(2048).optional(),
|
|
2601
2696
|
title: zod.z.string().min(1).refine(maxGraphemes(100)).max(1e3),
|
|
2602
2697
|
description: zod.z.string().refine(maxGraphemes(5e3)).max(5e4).optional(),
|
|
2603
2698
|
employmentType: zod.z.string().optional(),
|
|
@@ -2705,7 +2800,7 @@ var ProfileVolunteeringRecordSchema = zod.z.object({
|
|
|
2705
2800
|
});
|
|
2706
2801
|
|
|
2707
2802
|
// src/index.ts
|
|
2708
|
-
var SIFA_SDK_VERSION = "0.11.
|
|
2803
|
+
var SIFA_SDK_VERSION = "0.11.15";
|
|
2709
2804
|
|
|
2710
2805
|
exports.ACTIVITY_TIERS = ACTIVITY_TIERS;
|
|
2711
2806
|
exports.ACTIVITY_VISIBILITY_RULES = ACTIVITY_VISIBILITY_RULES;
|
|
@@ -2729,6 +2824,11 @@ exports.EMPLOYMENT_TYPE_GROUPS = EMPLOYMENT_TYPE_GROUPS;
|
|
|
2729
2824
|
exports.EMPLOYMENT_TYPE_LABELS = EMPLOYMENT_TYPE_LABELS;
|
|
2730
2825
|
exports.EndorsementConfirmationRecordSchema = EndorsementConfirmationRecordSchema;
|
|
2731
2826
|
exports.EndorsementRecordSchema = EndorsementRecordSchema;
|
|
2827
|
+
exports.EntityImportSearchResponseSchema = EntityImportSearchResponseSchema;
|
|
2828
|
+
exports.EntitySearchResponseSchema = EntitySearchResponseSchema;
|
|
2829
|
+
exports.EntitySearchResultSchema = EntitySearchResultSchema;
|
|
2830
|
+
exports.EntitySelectRequestSchema = EntitySelectRequestSchema;
|
|
2831
|
+
exports.EntitySelectResponseSchema = EntitySelectResponseSchema;
|
|
2732
2832
|
exports.FEATURE_FLAGS = FEATURE_FLAGS;
|
|
2733
2833
|
exports.FeatureAllowlistEntrySchema = FeatureAllowlistEntrySchema;
|
|
2734
2834
|
exports.FeedActorSchema = FeedActorSchema;
|
|
@@ -2791,6 +2891,8 @@ exports.didSchema = didSchema;
|
|
|
2791
2891
|
exports.dimensionsFromInputs = dimensionsFromInputs;
|
|
2792
2892
|
exports.durationFromMinutes = durationFromMinutes;
|
|
2793
2893
|
exports.encodeFeedCursor = encodeFeedCursor;
|
|
2894
|
+
exports.entityDisambiguationLabel = entityDisambiguationLabel;
|
|
2895
|
+
exports.entityResultKey = entityResultKey;
|
|
2794
2896
|
exports.externalRecordRefSchema = externalRecordRefSchema;
|
|
2795
2897
|
exports.findIndustry = findIndustry;
|
|
2796
2898
|
exports.formatDistanceToNow = formatDistanceToNow;
|
|
@@ -2827,6 +2929,7 @@ exports.isAppCategory = isAppCategory;
|
|
|
2827
2929
|
exports.isCompanyRequired = isCompanyRequired;
|
|
2828
2930
|
exports.isKnownAppId = isKnownAppId;
|
|
2829
2931
|
exports.isKnownPlatform = isKnownPlatform;
|
|
2932
|
+
exports.isPseudoEmployer = isPseudoEmployer;
|
|
2830
2933
|
exports.isValidRgbColor = isValidRgbColor;
|
|
2831
2934
|
exports.isVisibleActivityItem = isVisibleActivityItem;
|
|
2832
2935
|
exports.languageTagSchema = languageTagSchema;
|
|
@@ -2856,6 +2959,7 @@ exports.resolveCardUrl = resolveCardUrl;
|
|
|
2856
2959
|
exports.rgbToString = rgbToString;
|
|
2857
2960
|
exports.sanitizeDisplayText = sanitizeDisplayText;
|
|
2858
2961
|
exports.sanitizeHandleInput = sanitizeHandleInput;
|
|
2962
|
+
exports.searchResultDisambiguation = searchResultDisambiguation;
|
|
2859
2963
|
exports.selfLabelsSchema = selfLabelsSchema;
|
|
2860
2964
|
exports.singleDateExtractor = singleDateExtractor;
|
|
2861
2965
|
exports.sortByDateDesc = sortByDateDesc;
|