target-supabase-sdk 0.2.20 → 0.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/dist/node.js CHANGED
@@ -6,8 +6,8 @@ export { C as CLI_PROD_FLAG, S as SERVICE_ENV_PROFILE_ENV_KEY, w as SERVICE_ENV_
6
6
  import { randomBytes, createHash } from 'node:crypto';
7
7
  import { readFile, unlink, mkdir, writeFile, rename, access, stat, readdir, constants } from 'node:fs/promises';
8
8
  import { dirname, resolve, join, isAbsolute } from 'node:path';
9
- import { bx as sha256Hex, bD as getErrorMessage, bE as LOG_TOPIC_NODE, a_ as postRegisterNode, aE as patchChangeNodeStatus, N as NodeStatus, aP as patchStopNode, aM as patchNodeHeartBeat, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, bn as runRegistrySlotGuardCheck, bc as registrySlotRuntimePatchFromGuardResult, c as CategoryNode, a1 as evaluateBusyNodeLiveness, aO as patchServiceRuntime, at as isLogEntry, J as claimServiceRegistrySlot, m as ServiceRegistryError, a4 as fetchWithRetry, aw as isRetryableHttpStatus, a3 as fetchBinaryWithRetry, av as isOpaqueChunkUrl, e as CategoryRepo, aq as isHttpUrl, bF as isFeedIngestSource, bG as resolveFeedOriginalStorageProvider, b as CategoryLink, bH as buildFeedTagList, ap as isFeedValue, an as guessMediaMime, M as MEDIA_CONTENT_HASH_ALGORITHM, au as isMediaValue, ay as mediaLinkDedupFilters, B as buildMediaLinkDraft, R as ResultCode, bI as LOG_TOPIC_TASK, o as TASK_REPO_USAGE, ah as getScanRemoteRepoValues, aI as patchClaimTask, bJ as CRITICAL_UNKNOWN_TASK_TRACE_ID, aG as patchChangeTaskStatus, q as TaskStatusAction, bK as toError, b6 as postTaskSchema, bL as createTaskRow, p as TaskStatus } from './chunks/task-queue-CqmIVCBi.js';
10
- export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, d as CategoryParcel, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, bM as FEED_INGEST_SOURCES, F as FEED_VALUES, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, i as MEDIA_CONTENT_HASH_PREFIX_LENGTH, j as MEDIA_VALUES, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, k as ParcelManager, l as PostLinkValidator, S as ServiceLifecycleStatus, n as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, r as apiDetailsSchema, s as appendSystemRegistryEmptySlots, t as assertRegistrySlotAvailable, u as assertRegistrySlotOwner, v as buildEmptyServiceSlots, w as buildFeedLinkDraft, x as buildFeedLinkName, y as buildLinkTargetDraft, z as buildListTargetDraft, G as buildMediaNameFromLocator, H as buildReviewLinkDraft, I as buildSystemRegistryConfigDetails, K as classifyNetworkError, O as countTasksByType, Q as createActiveServiceLifecycle, U as createClaimedRegistrySlotRuntimeState, V as createStorageProviderRegistry, W as createUploadTracker, X as decodeLogBatch, Y as decodeLogBatchList, Z as defaultL3ServiceDetails, _ as deleteParcel, $ as deleteParcelSchema, a0 as escapeIlikePattern, a2 as feedLinkDedupFilters, a5 as fieldDefinitionSchema, a6 as flattenLogBatch, a7 as flattenLogBatches, a8 as formatNetworkError, a9 as getApi, aa as getApiSchema, ab as getConfig, ac as getConfigSchema, ad as getExtraction, ae as getExtractionSchema, af as getParcel, ag as getParcelSchema, ai as getScanRemoteRepoValuesSchema, aj as getService, ak as getServiceSchema, al as getTargetSystemRegistry, am as getValueAtPath, ao as installChunkFetchRegistry, ar as isLocalFilesystemPath, as as isLogBatchList, ax as linkTargetDraftBuildInputSchema, az as parcelDetailsSchema, aA as parseLogBatchMeta, aB as parseProviderPrefixedUrl, aC as parseServiceSlot, aD as parseServiceSlots, aF as patchChangeNodeStatusSchema, aH as patchChangeTaskStatusSchema, aJ as patchClaimTaskSchema, aK as patchExtractionObjects, aL as patchExtractionObjectsSchema, aN as patchNodeHeartBeatSchema, aQ as patchStopNodeSchema, aR as patchTaskProgress, aS as patchTaskProgressSchema, aT as postApi, aU as postApiSchema, aV as postExtraction, aW as postExtractionSchema, aX as postLinkCreate, aY as postParcel, aZ as postParcelSchema, a$ as postRegisterNodeSchema, b0 as postService, b1 as postServiceInstance, b2 as postServiceSchema, b3 as postSystemRegistryConfig, b4 as postSystemRegistryConfigSchema, b5 as postTask, b7 as postTaskWithRetry, b8 as publishParcel, b9 as registerProviderChunkResolver, ba as registerService, bb as registerServiceAtStartup, bd as releaseSystemRegistrySlots, be as releaseSystemRegistrySlotsByServiceId, bf as requestHasBody, bg as resetSystemRegistryConfig, bh as resetSystemRegistryConfigSchema, bi as resolveActiveRegistryServiceId, bj as resolveFetchUrl, bk as restoreParcel, bl as restoreParcelById, bm as reviewLinksForTargetFilters, bo as sanitizeFileName, bp as sanitizeParcelFileName, bq as scanExtractionList, br as scanExtractionListSchema, bs as schemaDefinitionSchema, bt as serviceDetailsSchema, bu as serviceLifecycleSchema, bv as serviceNodeSnapshotSchema, bw as serviceRuntimeSchema, by as summarizeTaskQueue, bz as systemRegistrySeedSlotSchema, bA as toPostgrestTextArrayLiteral, bB as unregisterService, bC as unregisterServiceAtShutdown } from './chunks/task-queue-CqmIVCBi.js';
9
+ import { bx as sha256Hex, bD as getErrorMessage, bE as LOG_TOPIC_NODE, a_ as postRegisterNode, aE as patchChangeNodeStatus, N as NodeStatus, aP as patchStopNode, aM as patchNodeHeartBeat, E as EMPTY_REGISTRY_SLOT_RUNTIME_STATE, bn as runRegistrySlotGuardCheck, bc as registrySlotRuntimePatchFromGuardResult, c as CategoryNode, a1 as evaluateBusyNodeLiveness, aO as patchServiceRuntime, at as isLogEntry, J as claimServiceRegistrySlot, m as ServiceRegistryError, a4 as fetchWithRetry, aw as isRetryableHttpStatus, a3 as fetchBinaryWithRetry, av as isOpaqueChunkUrl, e as CategoryRepo, aq as isHttpUrl, bF as isFeedIngestSource, bG as resolveFeedOriginalStorageProvider, b as CategoryLink, bH as buildFeedTagList, ap as isFeedValue, an as guessMediaMime, M as MEDIA_CONTENT_HASH_ALGORITHM, au as isMediaValue, ay as mediaLinkDedupFilters, B as buildMediaLinkDraft, R as ResultCode, bI as LOG_TOPIC_TASK, o as TASK_REPO_USAGE, ah as getScanRemoteRepoValues, aI as patchClaimTask, bJ as CRITICAL_UNKNOWN_TASK_TRACE_ID, aG as patchChangeTaskStatus, q as TaskStatusAction, bK as toError, b6 as postTaskSchema, bL as createTaskRow, p as TaskStatus } from './chunks/task-queue-FygwujNS.js';
10
+ export { A as ApiMethod, C as CategoryConfig, a as CategoryExtraction, d as CategoryParcel, f as CategoryService, g as CategoryTask, D as DEFAULT_SYSTEM_REGISTRY_SEED_SLOTS, bM as FEED_INGEST_SOURCES, F as FEED_VALUES, L as LINK_MANIFEST_VERSION, h as LIST_MANIFEST_VERSION, i as MEDIA_CONTENT_HASH_PREFIX_LENGTH, j as MEDIA_VALUES, P as POST_TASK_DEFAULT_MAX_ATTEMPTS, k as ParcelManager, l as PostLinkValidator, S as ServiceLifecycleStatus, n as ServiceSlotStatus, T as TARGET_SYSTEM_REGISTRY_KEY, r as apiDetailsSchema, s as appendSystemRegistryEmptySlots, t as assertRegistrySlotAvailable, u as assertRegistrySlotOwner, v as buildEmptyServiceSlots, w as buildFeedLinkDraft, x as buildFeedLinkName, y as buildLinkTargetDraft, z as buildListTargetDraft, G as buildMediaNameFromLocator, H as buildReviewLinkDraft, I as buildSystemRegistryConfigDetails, K as classifyNetworkError, O as countTasksByType, Q as createActiveServiceLifecycle, U as createClaimedRegistrySlotRuntimeState, V as createStorageProviderRegistry, W as createUploadTracker, X as decodeLogBatch, Y as decodeLogBatchList, Z as defaultL3ServiceDetails, _ as deleteParcel, $ as deleteParcelSchema, a0 as escapeIlikePattern, a2 as feedLinkDedupFilters, a5 as fieldDefinitionSchema, a6 as flattenLogBatch, a7 as flattenLogBatches, a8 as formatNetworkError, a9 as getApi, aa as getApiSchema, ab as getConfig, ac as getConfigSchema, ad as getExtraction, ae as getExtractionSchema, af as getParcel, ag as getParcelSchema, ai as getScanRemoteRepoValuesSchema, aj as getService, ak as getServiceSchema, al as getTargetSystemRegistry, am as getValueAtPath, ao as installChunkFetchRegistry, ar as isLocalFilesystemPath, as as isLogBatchList, ax as linkTargetDraftBuildInputSchema, az as parcelDetailsSchema, aA as parseLogBatchMeta, aB as parseProviderPrefixedUrl, aC as parseServiceSlot, aD as parseServiceSlots, aF as patchChangeNodeStatusSchema, aH as patchChangeTaskStatusSchema, aJ as patchClaimTaskSchema, aK as patchExtractionObjects, aL as patchExtractionObjectsSchema, aN as patchNodeHeartBeatSchema, aQ as patchStopNodeSchema, aR as patchTaskProgress, aS as patchTaskProgressSchema, aT as postApi, aU as postApiSchema, aV as postExtraction, aW as postExtractionSchema, aX as postLinkCreate, aY as postParcel, aZ as postParcelSchema, a$ as postRegisterNodeSchema, b0 as postService, b1 as postServiceInstance, b2 as postServiceSchema, b3 as postSystemRegistryConfig, b4 as postSystemRegistryConfigSchema, b5 as postTask, b7 as postTaskWithRetry, b8 as publishParcel, b9 as registerProviderChunkResolver, ba as registerService, bb as registerServiceAtStartup, bd as releaseSystemRegistrySlots, be as releaseSystemRegistrySlotsByServiceId, bf as requestHasBody, bg as resetSystemRegistryConfig, bh as resetSystemRegistryConfigSchema, bi as resolveActiveRegistryServiceId, bj as resolveFetchUrl, bk as restoreParcel, bl as restoreParcelById, bm as reviewLinksForNameFilters, bo as sanitizeFileName, bp as sanitizeParcelFileName, bq as scanExtractionList, br as scanExtractionListSchema, bs as schemaDefinitionSchema, bt as serviceDetailsSchema, bu as serviceLifecycleSchema, bv as serviceNodeSnapshotSchema, bw as serviceRuntimeSchema, by as summarizeTaskQueue, bz as systemRegistrySeedSlotSchema, bA as toPostgrestTextArrayLiteral, bB as unregisterService, bC as unregisterServiceAtShutdown } from './chunks/task-queue-FygwujNS.js';
11
11
  import { spawn } from 'node:child_process';
12
12
  import { ProxyAgent } from 'undici';
13
13
  import { tmpdir } from 'node:os';
@@ -3,5 +3,5 @@
3
3
  */
4
4
  export type { BuildReviewLinkDraftInput } from "./review.build";
5
5
  export { buildReviewLinkDraft } from "./review.build";
6
- export { reviewLinksForTargetFilters } from "./review.query";
6
+ export { reviewLinksForNameFilters } from "./review.query";
7
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/review/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,2BAA2B,EAAE,MAAM,gBAAgB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/shared/review/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,YAAY,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC;AAChE,OAAO,EAAE,oBAAoB,EAAE,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAE,yBAAyB,EAAE,MAAM,gBAAgB,CAAC"}
@@ -1,11 +1,8 @@
1
1
  import type { TargetDraft } from "../../core.interface";
2
2
  import type { Link } from "../../link/link.interface";
3
- import { type ReviewValue } from "./review.interface";
4
3
  export interface BuildReviewLinkDraftInput {
5
- /** Must be {@link REVIEW_VALUE}. */
6
- value: ReviewValue;
7
- /** Associated Target id — written to `Link.name`. */
8
- refId: string;
4
+ /** Written to `Link.name` (caller-defined; often a subject Target id). */
5
+ name: string;
9
6
  /** Interaction payload — written to `Link.details.original`. */
10
7
  original: unknown;
11
8
  tagList?: string[];
@@ -13,7 +10,7 @@ export interface BuildReviewLinkDraftInput {
13
10
  }
14
11
  /**
15
12
  * Assemble a review {@link Link} draft (`category=link`, `loaderKey === value === "review"`).
16
- * Does not validate `refId` existence or write to Supabase.
13
+ * Does not validate `name` or write to Supabase.
17
14
  */
18
15
  export declare function buildReviewLinkDraft(input: BuildReviewLinkDraftInput): TargetDraft<Link>;
19
16
  //# sourceMappingURL=review.build.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.build.d.ts","sourceRoot":"","sources":["../../../src/shared/review/review.build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,EAA+B,KAAK,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAEnF,MAAM,WAAW,yBAAyB;IACtC,oCAAoC;IACpC,KAAK,EAAE,WAAW,CAAC;IACnB,qDAAqD;IACrD,KAAK,EAAE,MAAM,CAAC;IACd,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,WAAW,CAAC,IAAI,CAAC,CAkBxF"}
1
+ {"version":3,"file":"review.build.d.ts","sourceRoot":"","sources":["../../../src/shared/review/review.build.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAExD,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,2BAA2B,CAAC;AAGtD,MAAM,WAAW,yBAAyB;IACtC,0EAA0E;IAC1E,IAAI,EAAE,MAAM,CAAC;IACb,gEAAgE;IAChE,QAAQ,EAAE,OAAO,CAAC;IAClB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,yBAAyB,GAAG,WAAW,CAAC,IAAI,CAAC,CAexF"}
@@ -2,8 +2,8 @@
2
2
  * Review Link protocol — Link rows with `value` / `loaderKey` === {@link REVIEW_VALUE}.
3
3
  * No separate Target category; category remains `link`.
4
4
  *
5
- * A Review records one user interaction with a subject Target (`Link.name` = that Target's id).
6
- * Many review Links may share the same subject id.
5
+ * A Review records one user interaction; `Link.name` is caller-defined (often a subject Target id).
6
+ * Many review Links may share the same `name`.
7
7
  */
8
8
  export declare const REVIEW_VALUE: "review";
9
9
  /** Discriminator stored in both `Link.value` and `details.loaderKey`. */
@@ -1,7 +1,7 @@
1
1
  import type { QueryFilter } from "../../core.interface";
2
2
  /**
3
- * Filters for all review Links whose subject Target is `refId` (`Link.name === refId`).
3
+ * Filters for review Links with `Link.name === name`.
4
4
  * Many rows may match — the SDK does not define dedup for reviews.
5
5
  */
6
- export declare function reviewLinksForTargetFilters(refId: string): QueryFilter[];
6
+ export declare function reviewLinksForNameFilters(name: string): QueryFilter[];
7
7
  //# sourceMappingURL=review.query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review.query.d.ts","sourceRoot":"","sources":["../../../src/shared/review/review.query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD;;;GAGG;AACH,wBAAgB,2BAA2B,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW,EAAE,CAOxE"}
1
+ {"version":3,"file":"review.query.d.ts","sourceRoot":"","sources":["../../../src/shared/review/review.query.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAIxD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,WAAW,EAAE,CAOrE"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "target-supabase-sdk",
3
- "version": "0.2.20",
3
+ "version": "0.2.21",
4
4
  "description": "Supabase client initializer and data access APIs",
5
5
  "license": "MIT",
6
6
  "author": "KyLoc20",
package/src/browser.ts CHANGED
@@ -242,7 +242,7 @@ export {
242
242
  mediaLinkDedupFilters,
243
243
  } from "./shared/media";
244
244
  export type { BuildReviewLinkDraftInput } from "./shared/review";
245
- export { buildReviewLinkDraft, reviewLinksForTargetFilters } from "./shared/review";
245
+ export { buildReviewLinkDraft, reviewLinksForNameFilters } from "./shared/review";
246
246
  export { isHttpUrl, resolveFetchUrl } from "./shared/utils/fetch-url";
247
247
  export { getValueAtPath } from "./shared/utils/get-value-at-path";
248
248
  export type {
@@ -2,7 +2,7 @@
2
2
 
3
3
  Review is a **convention on `Link`**, not a new Target category (`category` stays `link`).
4
4
 
5
- A **Review** records **one user interaction** with a **subject Target** (for example: open, play, complete, rate, dismiss). **Each interaction creates a new Review row.** The subject is linked by storing the Target id on `Link.name` (`refId` at create time). **Many review Links may share the same `refId`** — the SDK does not define dedup or idempotent create for reviews.
5
+ A **Review** records **one user interaction** (for example: open, play, complete, rate, dismiss). **Each interaction creates a new Review row.** **Many review Links may share the same `Link.name`** — the SDK does not define dedup or idempotent create for reviews.
6
6
 
7
7
  All review code lives under **`src/shared/review/`**. There is no Node-only ingest layer (unlike feed/media register flows) — create drafts on any host and persist with `postTarget` / `createTarget`.
8
8
 
@@ -19,12 +19,12 @@ src/shared/review/
19
19
 
20
20
  | Consumer import | What you get |
21
21
  |-----------------|--------------|
22
- | `from "target-supabase-sdk"` | Draft builder, constants, list filters |
22
+ | `from "target-supabase-sdk"` | Draft builder, list filters |
23
23
 
24
24
  ```typescript
25
25
  import {
26
26
  buildReviewLinkDraft,
27
- reviewLinksForTargetFilters,
27
+ reviewLinksForNameFilters,
28
28
  } from "target-supabase-sdk";
29
29
  ```
30
30
 
@@ -34,12 +34,12 @@ import {
34
34
 
35
35
  | Concept | Where it lives |
36
36
  |---------|----------------|
37
- | Subject Target | `Link.name` — the associated Target id (`refId` when building the draft) |
37
+ | Grouping key | `Link.name` — caller-defined (often a subject Target id, not required) |
38
38
  | Interaction body | `Link.details.original` — caller-defined JSON-serializable payload |
39
39
  | Review kind | Fixed `Link.value` / `details.loaderKey` = `"review"` |
40
40
  | Labels | Optional `tagList` (e.g. interaction type, client, experiment) |
41
41
 
42
- Each persisted Review is its **own** Target row (its own `id`). Repeating the same `refId` on `name` is expected when listing interaction history for one subject.
42
+ Each persisted Review is its **own** Target row (its own `id`). Repeating the same `name` is expected when listing interaction history under one grouping key.
43
43
 
44
44
  `details.original` is intentionally **untyped** (`unknown`) in the SDK so products can store scores, dwell time, UI state, model output, etc., without a shared schema in this package.
45
45
 
@@ -51,8 +51,7 @@ Built via `buildReviewLinkDraft` → `buildLinkTargetDraft`.
51
51
 
52
52
  | Create field | Required | Link field |
53
53
  |--------------|----------|------------|
54
- | `value` | yes | `value` — must be `"review"` |
55
- | `refId` | yes | `name` — subject Target id |
54
+ | `name` | yes | `name` |
56
55
  | `original` | yes | `details.original` |
57
56
  | `tagList` | no | `tagList` (default `[]`) |
58
57
  | `description` | no | `details.description` (default `""`) |
@@ -61,8 +60,9 @@ Fixed at build time (not on create input):
61
60
 
62
61
  | Link field | Value |
63
62
  |------------|--------|
63
+ | `value` | `"review"` |
64
64
  | `category` | `link` |
65
- | `details.loaderKey` | `"review"` (same as `value`) |
65
+ | `details.loaderKey` | `"review"` |
66
66
  | `details.manifestVersion` | `0` |
67
67
  | `details.preview` | `""` |
68
68
 
@@ -75,8 +75,7 @@ import { buildReviewLinkDraft } from "target-supabase-sdk";
75
75
  import { postTarget } from "target-supabase-sdk"; // or your create API
76
76
 
77
77
  const draft = buildReviewLinkDraft({
78
- value: "review",
79
- refId: subjectTargetId,
78
+ name: subjectTargetId,
80
79
  original: {
81
80
  action: "complete",
82
81
  progress: 1,
@@ -88,23 +87,23 @@ const draft = buildReviewLinkDraft({
88
87
  await postTarget(draft);
89
88
  ```
90
89
 
91
- Every interaction: build a new draft (same `refId` is fine) and insert again.
90
+ Every interaction: build a new draft (same `name` is fine) and insert again.
92
91
 
93
92
  ---
94
93
 
95
94
  ## Query
96
95
 
97
- List review Links for one subject Target:
96
+ List review Links sharing a `Link.name`:
98
97
 
99
98
  ```typescript
100
- import { reviewLinksForTargetFilters, scanTargetList } from "target-supabase-sdk";
99
+ import { reviewLinksForNameFilters, scanTargetList } from "target-supabase-sdk";
101
100
 
102
101
  const reviews = await scanTargetList({
103
- filters: reviewLinksForTargetFilters(subjectTargetId),
102
+ filters: reviewLinksForNameFilters(subjectTargetId),
104
103
  });
105
104
  ```
106
105
 
107
- Filters: `category=link`, `value=review`, `name=refId`. Use pagination / `scanTargetList` when history is long.
106
+ Filters: `category=link`, `value=review`, `name=<trimmed name>`. Use pagination / `scanTargetList` when history is long.
108
107
 
109
108
  There is **no** SDK helper for dedup or “find existing review” — callers always create new rows unless they add their own policy.
110
109
 
@@ -114,7 +113,7 @@ There is **no** SDK helper for dedup or “find existing review” — callers a
114
113
 
115
114
  ```typescript
116
115
  if (link.category === "link" && link.value === "review") {
117
- const subjectTargetId = link.name;
116
+ const groupingKey = link.name;
118
117
  const payload = link.details.original;
119
118
  }
120
119
  ```
@@ -4,4 +4,4 @@
4
4
 
5
5
  export type { BuildReviewLinkDraftInput } from "./review.build";
6
6
  export { buildReviewLinkDraft } from "./review.build";
7
- export { reviewLinksForTargetFilters } from "./review.query";
7
+ export { reviewLinksForNameFilters } from "./review.query";
@@ -1,13 +1,11 @@
1
1
  import type { TargetDraft } from "../../core.interface";
2
2
  import { buildLinkTargetDraft } from "../../link/link.build";
3
3
  import type { Link } from "../../link/link.interface";
4
- import { isReviewValue, REVIEW_VALUE, type ReviewValue } from "./review.interface";
4
+ import { REVIEW_VALUE } from "./review.interface";
5
5
 
6
6
  export interface BuildReviewLinkDraftInput {
7
- /** Must be {@link REVIEW_VALUE}. */
8
- value: ReviewValue;
9
- /** Associated Target id — written to `Link.name`. */
10
- refId: string;
7
+ /** Written to `Link.name` (caller-defined; often a subject Target id). */
8
+ name: string;
11
9
  /** Interaction payload — written to `Link.details.original`. */
12
10
  original: unknown;
13
11
  tagList?: string[];
@@ -16,19 +14,16 @@ export interface BuildReviewLinkDraftInput {
16
14
 
17
15
  /**
18
16
  * Assemble a review {@link Link} draft (`category=link`, `loaderKey === value === "review"`).
19
- * Does not validate `refId` existence or write to Supabase.
17
+ * Does not validate `name` or write to Supabase.
20
18
  */
21
19
  export function buildReviewLinkDraft(input: BuildReviewLinkDraftInput): TargetDraft<Link> {
22
- if (!isReviewValue(input.value)) {
23
- throw new Error(`buildReviewLinkDraft: unsupported review value: ${String(input.value)}`);
24
- }
25
- const refId = input.refId.trim();
26
- if (refId === "") {
27
- throw new Error("buildReviewLinkDraft: refId is empty");
20
+ const name = input.name.trim();
21
+ if (name === "") {
22
+ throw new Error("buildReviewLinkDraft: name is empty");
28
23
  }
29
24
 
30
25
  return buildLinkTargetDraft({
31
- name: refId,
26
+ name,
32
27
  value: REVIEW_VALUE,
33
28
  description: input.description ?? "",
34
29
  preview: "",
@@ -2,8 +2,8 @@
2
2
  * Review Link protocol — Link rows with `value` / `loaderKey` === {@link REVIEW_VALUE}.
3
3
  * No separate Target category; category remains `link`.
4
4
  *
5
- * A Review records one user interaction with a subject Target (`Link.name` = that Target's id).
6
- * Many review Links may share the same subject id.
5
+ * A Review records one user interaction; `Link.name` is caller-defined (often a subject Target id).
6
+ * Many review Links may share the same `name`.
7
7
  */
8
8
 
9
9
  export const REVIEW_VALUE = "review" as const;
@@ -3,14 +3,14 @@ import { CategoryLink } from "../../link/link.interface";
3
3
  import { REVIEW_VALUE } from "./review.interface";
4
4
 
5
5
  /**
6
- * Filters for all review Links whose subject Target is `refId` (`Link.name === refId`).
6
+ * Filters for review Links with `Link.name === name`.
7
7
  * Many rows may match — the SDK does not define dedup for reviews.
8
8
  */
9
- export function reviewLinksForTargetFilters(refId: string): QueryFilter[] {
10
- const name = refId.trim();
9
+ export function reviewLinksForNameFilters(name: string): QueryFilter[] {
10
+ const trimmed = name.trim();
11
11
  return [
12
12
  { field: "category", operator: "eq", value: CategoryLink.LINK },
13
13
  { field: "value", operator: "eq", value: REVIEW_VALUE },
14
- { field: "name", operator: "eq", value: name },
14
+ { field: "name", operator: "eq", value: trimmed },
15
15
  ];
16
16
  }