@ossy/consultancy 3.25.0 → 3.26.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.
Files changed (53) hide show
  1. package/README.md +7 -7
  2. package/package.json +7 -5
  3. package/src/ConsultancyNav.jsx +6 -6
  4. package/src/CreateConsultancyButton.jsx +21 -7
  5. package/src/Forecast.jsx +38 -37
  6. package/src/RequestMatches.jsx +29 -19
  7. package/src/RequestStatsPanel.jsx +1 -1
  8. package/src/ResumeMatches.jsx +51 -0
  9. package/src/calendar-quarter-months.js +36 -0
  10. package/src/calendar-quarter-months.spec.js +22 -0
  11. package/src/create-company.flow.js +9 -9
  12. package/src/current-month.component.jsx +14 -25
  13. package/src/delete-company.flow.js +5 -5
  14. package/src/en.translations.json +17 -32
  15. package/src/extract-request.task.js +20 -13
  16. package/src/extract-request.task.spec.js +7 -3
  17. package/src/file-inbound-request.task.js +93 -0
  18. package/src/file-inbound-request.task.spec.js +118 -0
  19. package/src/forecast-figures.jsx +42 -0
  20. package/src/forecast-panels.jsx +29 -42
  21. package/src/index.js +0 -1
  22. package/src/intake-categories.js +6 -22
  23. package/src/kpi-trend.component.jsx +1 -1
  24. package/src/match-reasons.js +85 -0
  25. package/src/match-reasons.spec.js +73 -0
  26. package/src/match-resumes.js +12 -7
  27. package/src/match-resumes.spec.js +13 -8
  28. package/src/match-resumes.task.js +1 -22
  29. package/src/match-resumes.task.spec.js +19 -14
  30. package/src/{consultancy.page.jsx → overview.page.jsx} +7 -7
  31. package/src/refresh-matches.js +38 -0
  32. package/src/refresh-matches.spec.js +31 -1
  33. package/src/refresh-matches.task.js +322 -72
  34. package/src/refresh-matches.task.spec.js +229 -27
  35. package/src/request.schema.js +0 -1
  36. package/src/{resume-inbound-screening.task.js → resume-inbound-requests.task.js} +12 -14
  37. package/src/{resume-inbound-screening.task.spec.js → resume-inbound-requests.task.spec.js} +32 -18
  38. package/src/resumes.page.jsx +43 -12
  39. package/src/schema-ids.js +0 -1
  40. package/src/spend-for-month.js +67 -0
  41. package/src/spend-for-month.spec.js +41 -0
  42. package/src/spend-year.jsx +91 -0
  43. package/src/{org.page.jsx → spend.page.jsx} +14 -13
  44. package/src/sv.translations.json +17 -32
  45. package/src/use-chart-months.js +5 -2
  46. package/src/use-spend-by-month.js +52 -0
  47. package/src/utilization.component.jsx +1 -1
  48. package/src/view-forecasts.flow.js +3 -3
  49. package/src/year-totals.component.jsx +1 -1
  50. package/src/Overview.jsx +0 -91
  51. package/src/company-basic-info.schema.js +0 -25
  52. package/src/screen-inbound.task.js +0 -133
  53. package/src/screen-inbound.task.spec.js +0 -154
@@ -1,15 +1,17 @@
1
1
  import { location as resumeLocation } from '@ossy/resumes/locations'
2
2
  import { referenceId, referenceIds } from '@ossy/resumes/resume-links'
3
3
  import { ResumesSchema } from '@ossy/resumes/schema-ids'
4
- import { cosineSimilarity, getEmbedding, loadWorkspaceEmbeddings } from '@ossy/platform/vector/vector-store'
4
+ import { cosineSimilarity, getEmbedding, searchEmbeddings, setEmbeddingKind } from '@ossy/platform/vector/vector-store'
5
5
  import { ConsultancySchema } from './schema-ids.js'
6
6
  import { location, matchesLocation } from './locations.js'
7
- import { rankMatches, requestMatchText, resumeMatchText } from './match-resumes.js'
7
+ import { rankMatches, requestMatchText, resumeMatchText, resourceTags } from './match-resumes.js'
8
8
  import {
9
+ MATCH_LIMIT,
9
10
  PROFILE_SCHEMA,
11
+ caseInsensitiveTagFilter,
10
12
  embeddingIsCurrent,
11
13
  matchesEqual,
12
- resumesLinking,
14
+ matchesToStore,
13
15
  textHash,
14
16
  } from './refresh-matches.js'
15
17
 
@@ -19,18 +21,25 @@ const CreateResource = { id: '@ossy/resources/actions/create' }
19
21
  const UpdateContent = { id: '@ossy/resources/actions/update-content' }
20
22
  const EmbedResource = { id: '@ossy/media-tasks/actions/embed-resource' }
21
23
 
24
+ const KIND_REQUEST = 'request'
25
+ const KIND_RESUME = 'resume'
26
+ const PAGE_SIZE = 50
27
+
22
28
  export const metadata = {
23
29
  id: '@ossy/consultancy/tasks/refresh-matches',
24
- schedule: '*/5 * * * *',
25
30
  triggers: [
26
31
  { type: ConsultancySchema.request, event: 'Created' },
27
32
  { type: ConsultancySchema.request, event: 'Updated' },
33
+ { type: ConsultancySchema.request, event: 'Patched' },
28
34
  { type: ResumesSchema.resume, event: 'Created' },
29
35
  { type: ResumesSchema.resume, event: 'Updated' },
36
+ { type: ResumesSchema.resume, event: 'Patched' },
30
37
  { type: PROFILE_SCHEMA, event: 'Created' },
31
38
  { type: PROFILE_SCHEMA, event: 'Updated' },
39
+ { type: PROFILE_SCHEMA, event: 'Patched' },
32
40
  { type: ResumesSchema.resumeExperience, event: 'Created' },
33
41
  { type: ResumesSchema.resumeExperience, event: 'Updated' },
42
+ { type: ResumesSchema.resumeExperience, event: 'Patched' },
34
43
  ],
35
44
  }
36
45
 
@@ -51,6 +60,16 @@ function workspaceIdFrom ({ event, payload, req }) {
51
60
  ?? null
52
61
  }
53
62
 
63
+ function mergeById (groups) {
64
+ const byId = new Map()
65
+ for (const group of groups) {
66
+ for (const item of group || []) {
67
+ if (item?.id) byId.set(item.id, item)
68
+ }
69
+ }
70
+ return [...byId.values()]
71
+ }
72
+
54
73
  async function readLinked (sdk, resourceId) {
55
74
  if (!resourceId) return null
56
75
  try {
@@ -61,30 +80,96 @@ async function readLinked (sdk, resourceId) {
61
80
  }
62
81
  }
63
82
 
64
- async function listAt (sdk, listLocation, workspaceId) {
65
- return asResourceList(await sdk.invoke(ListResources, { location: listLocation, workspaceId }))
83
+ /**
84
+ * One filtered page. `query` is required so a caller cannot list a whole folder by accident.
85
+ */
86
+ async function listMatching (sdk, { listLocation, workspaceId, type, query, limit = MATCH_LIMIT }) {
87
+ const result = await sdk.invoke(ListResources, {
88
+ location: listLocation,
89
+ workspaceId,
90
+ limit,
91
+ query: { type, ...query },
92
+ })
93
+ return asResourceList(result).filter((item) => item?.type === type)
94
+ }
95
+
96
+ /**
97
+ * Walk a filtered folder one page at a time. The page is discarded after `fn`.
98
+ */
99
+ async function forEachPage (sdk, { listLocation, workspaceId, type, query = {} }, fn) {
100
+ const seen = new Set()
101
+ let offset = 0
102
+ for (;;) {
103
+ const result = await sdk.invoke(ListResources, {
104
+ location: listLocation,
105
+ workspaceId,
106
+ limit: PAGE_SIZE,
107
+ offset,
108
+ query: { type, ...query },
109
+ })
110
+ const page = asResourceList(result).filter((item) => item?.type === type)
111
+ const fresh = page.filter((item) => item?.id && !seen.has(item.id))
112
+ if (!fresh.length) break
113
+ for (const item of fresh) seen.add(item.id)
114
+ await fn(fresh)
115
+ if (page.length < PAGE_SIZE) break
116
+ offset += page.length
117
+ }
118
+ }
119
+
120
+ /**
121
+ * Every resource matching a filter. Tag overlap must not stop at MATCH_LIMIT —
122
+ * ranking and matchesToStore decide which rows to keep.
123
+ */
124
+ async function listAllMatching (sdk, { listLocation, workspaceId, type, query }) {
125
+ const items = []
126
+ await forEachPage(sdk, { listLocation, workspaceId, type, query }, async (page) => {
127
+ items.push(...page)
128
+ })
129
+ return items
66
130
  }
67
131
 
68
132
  /**
69
133
  * Embed a request or resume when its text changed. Returns true when a new vector was written.
134
+ * `kind` is stored on the vector so a later search can ask for resumes or requests only.
70
135
  */
71
- export async function ensureEmbedded (sdk, resource, workspaceId) {
136
+ export async function ensureEmbedded (sdk, resource, workspaceId, kind) {
72
137
  const text = resource?.type === ConsultancySchema.request
73
138
  ? requestMatchText(resource)
74
139
  : await resumeText(sdk, resource)
75
140
  if (!text) return false
76
141
  const hash = textHash(text)
77
142
  const stored = await getEmbedding(resource.id)
143
+ if (stored && stored.kind !== kind) await setEmbeddingKind(resource.id, kind)
78
144
  if (embeddingIsCurrent(stored, hash)) return false
79
- await sdk.invoke(EmbedResource, {
80
- resourceId: resource.id,
81
- text,
82
- textHash: hash,
83
- workspaceId,
84
- })
145
+ try {
146
+ await sdk.invoke(EmbedResource, {
147
+ resourceId: resource.id,
148
+ text,
149
+ textHash: hash,
150
+ workspaceId,
151
+ kind,
152
+ })
153
+ } catch {
154
+ // Tag overlap still ranks when the embedder is missing, as in end-to-end.
155
+ return false
156
+ }
85
157
  return true
86
158
  }
87
159
 
160
+ /**
161
+ * A stored vector is enough on a full refresh. Re-reading the profile and
162
+ * every experience is reserved for a document that actually changed.
163
+ */
164
+ async function embedIfMissing (sdk, resource, workspaceId, kind) {
165
+ const stored = await getEmbedding(resource.id)
166
+ if (stored?.textHash) {
167
+ if (stored.kind !== kind) await setEmbeddingKind(resource.id, kind)
168
+ return false
169
+ }
170
+ return ensureEmbedded(sdk, resource, workspaceId, kind)
171
+ }
172
+
88
173
  async function resumeText (sdk, resume) {
89
174
  const profile = await readLinked(sdk, referenceId(resume?.content?.profile))
90
175
  const experiences = (await Promise.all(
@@ -93,23 +178,23 @@ async function resumeText (sdk, resume) {
93
178
  return resumeMatchText(resume, { profile, experiences })
94
179
  }
95
180
 
96
- function similaritiesFor (queryVector, resumes, vectorById) {
97
- if (!Array.isArray(queryVector) || !queryVector.length) return []
98
- const scores = []
99
- for (const resume of resumes) {
100
- const vector = vectorById.get(resume.id)
101
- if (!vector) continue
102
- scores.push({ resourceId: resume.id, score: cosineSimilarity(queryVector, vector) })
103
- }
104
- return scores
181
+ async function matchForRequest (sdk, workspaceId, requestId) {
182
+ const items = await listMatching(sdk, {
183
+ listLocation: matchesLocation,
184
+ workspaceId,
185
+ type: ConsultancySchema.requestMatches,
186
+ limit: 5,
187
+ query: { 'content.request.resourceId': requestId },
188
+ })
189
+ return items[0] || null
105
190
  }
106
191
 
107
- async function saveMatches (sdk, { workspaceId, request, matches, existing }) {
192
+ async function saveMatches (sdk, { workspaceId, request, matches }) {
108
193
  const content = {
109
194
  request: { resourceId: request.id },
110
195
  matches,
111
196
  }
112
- const current = existing.find((item) => referenceId(item?.content?.request) === request.id)
197
+ const current = await matchForRequest(sdk, workspaceId, request.id)
113
198
  if (current && matchesEqual(current.content?.matches, matches)) return current
114
199
  if (current) {
115
200
  return sdk.invoke(UpdateContent, { resourceId: current.id, workspaceId, content })
@@ -123,74 +208,239 @@ async function saveMatches (sdk, { workspaceId, request, matches, existing }) {
123
208
  })
124
209
  }
125
210
 
211
+ async function resourcesByIds (sdk, { listLocation, workspaceId, type, ids }) {
212
+ const unique = [...new Set((ids || []).filter(Boolean))]
213
+ const found = []
214
+ for (let index = 0; index < unique.length; index += MATCH_LIMIT) {
215
+ const chunk = unique.slice(index, index + MATCH_LIMIT)
216
+ found.push(...await listMatching(sdk, {
217
+ listLocation,
218
+ workspaceId,
219
+ type,
220
+ limit: chunk.length,
221
+ query: { id: { $in: chunk } },
222
+ }))
223
+ }
224
+ return found
225
+ }
226
+
126
227
  /**
127
- * Rank the given requests against stored resume vectors and save a match document each.
228
+ * Resumes that share a tag with the request, plus the nearest resume vectors.
229
+ * Tag hits outside the vector result still get a cosine when they have a vector.
128
230
  */
129
- export async function scoreRequests (sdk, { workspaceId, requests, resumes, existing }) {
130
- const stored = await loadWorkspaceEmbeddings(workspaceId)
131
- const vectorById = new Map((stored || []).map((item) => [item.resourceId, item.vector]))
132
- const saved = []
133
- for (const request of requests) {
134
- const matches = rankMatches({
135
- request,
136
- resumes,
137
- similarities: similaritiesFor(vectorById.get(request.id), resumes, vectorById),
231
+ async function candidatesForRequest (sdk, workspaceId, request) {
232
+ const stored = await getEmbedding(request.id)
233
+ const queryVector = Array.isArray(stored?.vector) ? stored.vector : null
234
+ const similarities = queryVector?.length
235
+ ? await searchEmbeddings({
236
+ workspaceId,
237
+ queryVector,
238
+ limit: MATCH_LIMIT,
239
+ kind: KIND_RESUME,
138
240
  })
139
- saved.push(await saveMatches(sdk, { workspaceId, request, matches, existing }))
241
+ : []
242
+ const scoreById = new Map()
243
+ for (const hit of similarities) {
244
+ if (hit?.resourceId && Number.isFinite(hit.score)) scoreById.set(hit.resourceId, hit.score)
245
+ }
246
+
247
+ const tagQuery = caseInsensitiveTagFilter(resourceTags(request))
248
+ const [tagged, nearest] = await Promise.all([
249
+ tagQuery
250
+ ? listAllMatching(sdk, {
251
+ listLocation: resumeLocation,
252
+ workspaceId,
253
+ type: ResumesSchema.resume,
254
+ query: tagQuery,
255
+ })
256
+ : [],
257
+ resourcesByIds(sdk, {
258
+ listLocation: resumeLocation,
259
+ workspaceId,
260
+ type: ResumesSchema.resume,
261
+ ids: similarities.map((hit) => hit.resourceId),
262
+ }),
263
+ ])
264
+
265
+ if (queryVector?.length) {
266
+ for (const resume of tagged) {
267
+ if (!resume?.id || scoreById.has(resume.id)) continue
268
+ const resumeVector = await getEmbedding(resume.id)
269
+ if (resumeVector && resumeVector.kind !== KIND_RESUME) {
270
+ await setEmbeddingKind(resume.id, KIND_RESUME)
271
+ }
272
+ if (Array.isArray(resumeVector?.vector) && resumeVector.vector.length === queryVector.length) {
273
+ scoreById.set(resume.id, cosineSimilarity(queryVector, resumeVector.vector))
274
+ }
275
+ }
276
+ }
277
+
278
+ return {
279
+ resumes: mergeById([tagged, nearest]),
280
+ similarities: [...scoreById].map(([resourceId, score]) => ({ resourceId, score })),
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Rank the given requests against a bounded set of resumes and save one match document each.
286
+ */
287
+ export async function scoreRequests (sdk, { workspaceId, requests }) {
288
+ const saved = []
289
+ for (const request of requests || []) {
290
+ const { resumes, similarities } = await candidatesForRequest(sdk, workspaceId, request)
291
+ const matches = matchesToStore(rankMatches({ request, resumes, similarities }))
292
+ saved.push(await saveMatches(sdk, { workspaceId, request, matches }))
140
293
  }
141
294
  return saved
142
295
  }
143
296
 
297
+ /**
298
+ * Requests to re-score after a resume change: nearest request vectors, requests
299
+ * that share a tag, and requests whose saved matches already include this resume
300
+ * so a resume that fell out of the ranking is removed.
301
+ */
302
+ async function requestsAffectedByResume (sdk, workspaceId, resume) {
303
+ const stored = await getEmbedding(resume.id)
304
+ const queryVector = Array.isArray(stored?.vector) ? stored.vector : null
305
+ const nearestHits = queryVector?.length
306
+ ? await searchEmbeddings({
307
+ workspaceId,
308
+ queryVector,
309
+ limit: MATCH_LIMIT,
310
+ kind: KIND_REQUEST,
311
+ })
312
+ : []
313
+ const tagQuery = caseInsensitiveTagFilter(resourceTags(resume))
314
+ const [tagged, nearest] = await Promise.all([
315
+ tagQuery
316
+ ? listAllMatching(sdk, {
317
+ listLocation: location,
318
+ workspaceId,
319
+ type: ConsultancySchema.request,
320
+ query: tagQuery,
321
+ })
322
+ : [],
323
+ resourcesByIds(sdk, {
324
+ listLocation: location,
325
+ workspaceId,
326
+ type: ConsultancySchema.request,
327
+ ids: nearestHits.map((hit) => hit.resourceId),
328
+ }),
329
+ ])
330
+ const existingMatches = []
331
+ await forEachPage(sdk, {
332
+ listLocation: matchesLocation,
333
+ workspaceId,
334
+ type: ConsultancySchema.requestMatches,
335
+ query: { 'content.matches.resourceId': resume.id },
336
+ }, async (page) => {
337
+ existingMatches.push(...page)
338
+ })
339
+ const known = mergeById([tagged, nearest])
340
+ const knownIds = new Set(known.map((item) => item.id))
341
+ const missingIds = existingMatches
342
+ .map((item) => referenceId(item?.content?.request))
343
+ .filter((id) => id && !knownIds.has(id))
344
+ const fromMatches = await resourcesByIds(sdk, {
345
+ listLocation: location,
346
+ workspaceId,
347
+ type: ConsultancySchema.request,
348
+ ids: missingIds,
349
+ })
350
+ return mergeById([known, fromMatches])
351
+ }
352
+
353
+ async function embedResumesLinking (sdk, workspaceId, resourceId) {
354
+ const requests = new Map()
355
+ let embedded = 0
356
+ await forEachPage(sdk, {
357
+ listLocation: resumeLocation,
358
+ workspaceId,
359
+ type: ResumesSchema.resume,
360
+ query: {
361
+ $or: [
362
+ { 'content.profile.resourceId': resourceId },
363
+ { 'content.experiences.resourceId': resourceId },
364
+ ],
365
+ },
366
+ }, async (page) => {
367
+ for (const resume of page) {
368
+ if (await ensureEmbedded(sdk, resume, workspaceId, KIND_RESUME)) embedded += 1
369
+ for (const request of await requestsAffectedByResume(sdk, workspaceId, resume)) {
370
+ requests.set(request.id, request)
371
+ }
372
+ }
373
+ })
374
+ const saved = await scoreRequests(sdk, { workspaceId, requests: [...requests.values()] })
375
+ return { embedded, requests: saved.length }
376
+ }
377
+
144
378
  /**
145
379
  * Keep embeddings and saved matches current.
146
380
  *
147
- * A request or resume change embeds that document. A profile or experience
148
- * change embeds the resumes that link it. A schedule pass embeds anything
149
- * that has no current vector, then re-scores. Unchanged text is not embedded again.
381
+ * A request change embeds that request and writes its one match document.
382
+ * A resume change embeds that resume and re-scores the requests it can affect.
383
+ * A profile or experience change does the same for the resumes that link it.
384
+ * A pass with no triggering document embeds only resources that have no vector,
385
+ * one page at a time, then scores each request against a bounded candidate set.
150
386
  */
151
387
  export async function run ({ event, payload, req, sdk }) {
152
388
  if (!sdk?.invoke) fail('sdk is required', 500)
153
389
  const workspaceId = workspaceIdFrom({ event, payload, req })
154
390
  if (!workspaceId) fail('workspaceId is required', 400)
155
391
 
156
- const requests = (await listAt(sdk, location, workspaceId))
157
- .filter((item) => item?.type === ConsultancySchema.request)
158
- const resumes = (await listAt(sdk, resumeLocation, workspaceId))
159
- .filter((item) => item?.type === ResumesSchema.resume)
160
- const existing = (await listAt(sdk, matchesLocation, workspaceId))
161
- .filter((item) => item?.type === ConsultancySchema.requestMatches)
162
-
163
392
  const resourceId = event?.resourceId || null
164
393
  const type = event?.type
165
- const scheduled = !resourceId || type === 'scheduled'
166
-
167
- let toEmbed = []
168
- let toScore = requests
169
- if (scheduled) {
170
- toEmbed = [...requests, ...resumes]
171
- } else if (type === ConsultancySchema.request) {
172
- toEmbed = requests.filter((item) => item.id === resourceId)
173
- if (!toEmbed.length) {
174
- const request = await readLinked(sdk, resourceId)
175
- if (request?.type === ConsultancySchema.request) toEmbed = [request]
176
- }
177
- toScore = toEmbed
178
- } else if (type === ResumesSchema.resume) {
179
- toEmbed = resumes.filter((item) => item.id === resourceId)
180
- if (!toEmbed.length) {
181
- const resume = await readLinked(sdk, resourceId)
182
- if (resume?.type === ResumesSchema.resume) toEmbed = [resume]
183
- }
184
- } else if (type === PROFILE_SCHEMA || type === ResumesSchema.resumeExperience) {
185
- toEmbed = resumesLinking(resumes, resourceId)
186
- if (!toEmbed.length) toScore = []
394
+ const fullPass = !resourceId || type === 'scheduled'
395
+
396
+ if (fullPass) {
397
+ let embedded = 0
398
+ let requests = 0
399
+ await forEachPage(sdk, {
400
+ listLocation: resumeLocation,
401
+ workspaceId,
402
+ type: ResumesSchema.resume,
403
+ }, async (page) => {
404
+ for (const resume of page) {
405
+ if (await embedIfMissing(sdk, resume, workspaceId, KIND_RESUME)) embedded += 1
406
+ }
407
+ })
408
+ await forEachPage(sdk, {
409
+ listLocation: location,
410
+ workspaceId,
411
+ type: ConsultancySchema.request,
412
+ }, async (page) => {
413
+ for (const request of page) {
414
+ if (await embedIfMissing(sdk, request, workspaceId, KIND_REQUEST)) embedded += 1
415
+ }
416
+ const saved = await scoreRequests(sdk, { workspaceId, requests: page })
417
+ requests += saved.length
418
+ })
419
+ return { embedded, requests }
187
420
  }
188
421
 
189
- let embedded = 0
190
- for (const resource of toEmbed) {
191
- if (await ensureEmbedded(sdk, resource, workspaceId)) embedded += 1
422
+ if (type === ConsultancySchema.request) {
423
+ const request = await readLinked(sdk, resourceId)
424
+ if (request?.type !== ConsultancySchema.request) return { embedded: 0, requests: 0 }
425
+ if (request.belongsTo && request.belongsTo !== workspaceId) return { embedded: 0, requests: 0 }
426
+ const embedded = await ensureEmbedded(sdk, request, workspaceId, KIND_REQUEST) ? 1 : 0
427
+ const saved = await scoreRequests(sdk, { workspaceId, requests: [request] })
428
+ return { embedded, requests: saved.length }
192
429
  }
193
430
 
194
- const saved = await scoreRequests(sdk, { workspaceId, requests: toScore, resumes, existing })
195
- return { embedded, requests: saved.length }
431
+ if (type === ResumesSchema.resume) {
432
+ const resume = await readLinked(sdk, resourceId)
433
+ if (resume?.type !== ResumesSchema.resume) return { embedded: 0, requests: 0 }
434
+ if (resume.belongsTo && resume.belongsTo !== workspaceId) return { embedded: 0, requests: 0 }
435
+ const embedded = await ensureEmbedded(sdk, resume, workspaceId, KIND_RESUME) ? 1 : 0
436
+ const affected = await requestsAffectedByResume(sdk, workspaceId, resume)
437
+ const saved = await scoreRequests(sdk, { workspaceId, requests: affected })
438
+ return { embedded, requests: saved.length }
439
+ }
440
+
441
+ if (type === PROFILE_SCHEMA || type === ResumesSchema.resumeExperience) {
442
+ return embedResumesLinking(sdk, workspaceId, resourceId)
443
+ }
444
+
445
+ return { embedded: 0, requests: 0 }
196
446
  }