@absolutejs/sync-pack-favorites 0.1.0 → 0.2.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.
package/dist/index.d.ts CHANGED
@@ -21,6 +21,12 @@ export type FavoriteRow = {
21
21
  resourceKind: string;
22
22
  resourceId: string;
23
23
  createdAt: number;
24
+ /**
25
+ * When the actor pinned this favorite, or `null` when unpinned.
26
+ * Clients can sort pinned-first by descending `pinnedAt`. Set by the
27
+ * `favorites:pin` / `favorites:togglePin` mutations.
28
+ */
29
+ pinnedAt: number | null;
24
30
  };
25
31
  /** A `FavoriteRow` paired with the host's resource row, from the optional join. */
26
32
  export type FavoriteWithResource<ResourceRow = unknown> = FavoriteRow & {
package/dist/index.js CHANGED
@@ -58,7 +58,7 @@ var createFavoritesPack = (config = {}) => {
58
58
  name: "@absolutejs/sync-pack-favorites",
59
59
  ownsTables: [table],
60
60
  readsTables: joinResources === undefined ? [] : [joinResources.table],
61
- version: "0.1.0",
61
+ version: "0.2.0",
62
62
  schemas: defineSchema({
63
63
  [table]: {
64
64
  fields: {
@@ -66,7 +66,8 @@ var createFavoritesPack = (config = {}) => {
66
66
  actorId: field.string,
67
67
  resourceKind: field.string,
68
68
  resourceId: field.string,
69
- createdAt: field.number
69
+ createdAt: field.number,
70
+ pinnedAt: (value) => value === null || typeof value === "number"
70
71
  }
71
72
  }
72
73
  }),
@@ -131,6 +132,7 @@ var createFavoritesPack = (config = {}) => {
131
132
  actorId,
132
133
  createdAt: now(),
133
134
  id,
135
+ pinnedAt: null,
134
136
  resourceId: args.resourceId,
135
137
  resourceKind: args.resourceKind
136
138
  };
@@ -158,6 +160,7 @@ var createFavoritesPack = (config = {}) => {
158
160
  actorId,
159
161
  createdAt: now(),
160
162
  id,
163
+ pinnedAt: null,
161
164
  resourceId: args.resourceId,
162
165
  resourceKind: args.resourceKind
163
166
  };
@@ -167,6 +170,78 @@ var createFavoritesPack = (config = {}) => {
167
170
  await actions.delete(table, { id });
168
171
  return { favorited: false };
169
172
  }
173
+ }),
174
+ defineMutation({
175
+ name: `${prefix}favorites:pin`,
176
+ handler: async (args, ctx, actions) => {
177
+ const actorId = resolveActor(getActorId, ctx);
178
+ const id = rowId(actorId, args.resourceKind, args.resourceId);
179
+ const existing = store.getById(id);
180
+ if (existing === undefined) {
181
+ const row = {
182
+ actorId,
183
+ createdAt: now(),
184
+ id,
185
+ pinnedAt: now(),
186
+ resourceId: args.resourceId,
187
+ resourceKind: args.resourceKind
188
+ };
189
+ return await actions.insert(table, row);
190
+ }
191
+ if (existing.pinnedAt !== null)
192
+ return existing;
193
+ return await actions.update(table, {
194
+ ...existing,
195
+ pinnedAt: now()
196
+ });
197
+ }
198
+ }),
199
+ defineMutation({
200
+ name: `${prefix}favorites:unpin`,
201
+ handler: async (args, ctx, actions) => {
202
+ const actorId = resolveActor(getActorId, ctx);
203
+ const id = rowId(actorId, args.resourceKind, args.resourceId);
204
+ const existing = store.getById(id);
205
+ if (existing === undefined || existing.pinnedAt === null) {
206
+ return existing;
207
+ }
208
+ return await actions.update(table, {
209
+ ...existing,
210
+ pinnedAt: null
211
+ });
212
+ }
213
+ }),
214
+ defineMutation({
215
+ name: `${prefix}favorites:togglePin`,
216
+ handler: async (args, ctx, actions) => {
217
+ const actorId = resolveActor(getActorId, ctx);
218
+ const id = rowId(actorId, args.resourceKind, args.resourceId);
219
+ const existing = store.getById(id);
220
+ if (existing === undefined) {
221
+ const row = {
222
+ actorId,
223
+ createdAt: now(),
224
+ id,
225
+ pinnedAt: now(),
226
+ resourceId: args.resourceId,
227
+ resourceKind: args.resourceKind
228
+ };
229
+ await actions.insert(table, row);
230
+ return { pinned: true };
231
+ }
232
+ if (existing.pinnedAt === null) {
233
+ await actions.update(table, {
234
+ ...existing,
235
+ pinnedAt: now()
236
+ });
237
+ return { pinned: true };
238
+ }
239
+ await actions.update(table, {
240
+ ...existing,
241
+ pinnedAt: null
242
+ });
243
+ return { pinned: false };
244
+ }
170
245
  })
171
246
  ]
172
247
  };
@@ -214,5 +289,5 @@ export {
214
289
  createFavoritesPack
215
290
  };
216
291
 
217
- //# debugId=E27906193B10A86564756E2164756E21
292
+ //# debugId=157685E60C5FD0FF64756E2164756E21
218
293
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -2,9 +2,9 @@
2
2
  "version": 3,
3
3
  "sources": ["../src/index.ts"],
4
4
  "sourcesContent": [
5
- "/**\n * `@absolutejs/sync-pack-favorites` — per-actor saved resources.\n *\n * Owns a `favorites` table; rows are `(actorId, resourceKind, resourceId)`\n * triples with a stable primary key derived from them, so toggling\n * favorite/unfavorite is an upsert/delete with no extra bookkeeping.\n *\n * Each actor sees only their own rows. Optional `joinResources` registers\n * a `favorites-with-resource` join collection that pairs each favorite\n * with the host's resource row (same shape as comments-with-author from\n * the comments pack). Useful when the UI wants \"title + body + favorited?\"\n * in one subscription.\n */\n\nimport {\n\tdefineCollection,\n\tdefineJoinCollection,\n\tdefineMutation,\n\tdefineSchema,\n\tdefineSyncPack,\n\tfield,\n\tUnauthorizedError,\n\ttype CollectionContext,\n\ttype SyncPack,\n\ttype TableReader,\n\ttype TableWriter\n} from '@absolutejs/sync/engine';\n\n/** A single favorited resource for a single actor. */\nexport type FavoriteRow = {\n\t/** `${actorId}:${resourceKind}:${resourceId}` — deterministic so toggling is idempotent. */\n\tid: string;\n\tactorId: string;\n\t/** App-level resource type (\"doc\", \"task\", \"issue\", ...). Lets one inbox span multiple kinds. */\n\tresourceKind: string;\n\tresourceId: string;\n\tcreatedAt: number;\n};\n\n/** A `FavoriteRow` paired with the host's resource row, from the optional join. */\nexport type FavoriteWithResource<ResourceRow = unknown> = FavoriteRow & {\n\tresource: ResourceRow;\n};\n\nexport type FavoritesStore = {\n\treader: TableReader<CollectionContext>;\n\twriter: TableWriter<FavoriteRow, CollectionContext, unknown>;\n\tgetById: (id: string) => FavoriteRow | undefined;\n};\n\nexport const createInMemoryFavoritesStore = (): FavoritesStore => {\n\tconst rows = new Map<string, FavoriteRow>();\n\treturn {\n\t\tgetById: (id) => rows.get(id),\n\t\treader: {\n\t\t\tall: () => [...rows.values()]\n\t\t},\n\t\twriter: {\n\t\t\tdelete: (row) => {\n\t\t\t\trows.delete((row as { id: string }).id);\n\t\t\t},\n\t\t\tinsert: (data) => {\n\t\t\t\trows.set(data.id, data);\n\t\t\t\treturn data;\n\t\t\t},\n\t\t\tupdate: (data) => {\n\t\t\t\tconst prior = rows.get(data.id);\n\t\t\t\tconst merged = { ...(prior ?? {}), ...data } as FavoriteRow;\n\t\t\t\trows.set(data.id, merged);\n\t\t\t\treturn merged;\n\t\t\t}\n\t\t}\n\t};\n};\n\nexport type JoinResourcesConfig<Ctx, ResourceRow = unknown> = {\n\t/**\n\t * The host's resource table name. Surfaced in `readsTables` so the\n\t * dependency graph is reviewable. Required when the join is enabled\n\t * (no default — many apps have multiple resource tables).\n\t */\n\ttable: string;\n\t/** Get the host resource's id (the join field). Default `(row) => row.id`. */\n\tkey?: (resource: ResourceRow) => string;\n\t/**\n\t * Host-side hydrate for the resources side of the join. The pack\n\t * passes the subscription params + ctx; this returns candidate\n\t * resources. The engine inner-joins on\n\t * `favorite.resourceId === resource.id`.\n\t */\n\thydrate: (\n\t\tparams: { actorId: string | undefined; resourceKind?: string },\n\t\tctx: Ctx\n\t) => Iterable<ResourceRow> | Promise<Iterable<ResourceRow>>;\n};\n\nexport type FavoritesPackConfig<Ctx = CollectionContext, ResourceRow = unknown> = {\n\tprefix?: string;\n\tgetActorId?: (ctx: Ctx) => string | undefined;\n\t/** Custom storage adapter. Default per-instance in-memory. */\n\tstore?: FavoritesStore;\n\t/** Wall-clock. Default `Date.now`. */\n\tnow?: () => number;\n\t/**\n\t * Optional join collection. When set, registers\n\t * `favorites-with-resource` and adds the resource table to\n\t * `readsTables`.\n\t */\n\tjoinResources?: JoinResourcesConfig<Ctx, ResourceRow>;\n};\n\nconst resolveActor = (\n\tgetActorId: NonNullable<FavoritesPackConfig['getActorId']>,\n\tctx: unknown\n): string => {\n\tconst actorId = getActorId(ctx as CollectionContext);\n\tif (actorId === undefined || actorId === '') {\n\t\tthrow new UnauthorizedError('favorites mutation (no actor id)');\n\t}\n\treturn actorId;\n};\n\nconst rowId = (\n\tactorId: string,\n\tresourceKind: string,\n\tresourceId: string\n): string => `${actorId}:${resourceKind}:${resourceId}`;\n\n/**\n * Build a {@link SyncPack} that exposes a per-actor list of favorited\n * host-side resources. Optional join collection pairs each favorite with\n * its host resource row.\n */\nexport const createFavoritesPack = <\n\tCtx = CollectionContext,\n\tResourceRow = unknown\n>(\n\tconfig: FavoritesPackConfig<Ctx, ResourceRow> = {}\n): SyncPack => {\n\tconst prefix = config.prefix ?? '';\n\tconst table = `${prefix}favorites`;\n\tconst collectionName = table;\n\tconst joinCollectionName = `${prefix}favorites-with-resource`;\n\tconst favoriteMutationName = `${prefix}favorites:favorite`;\n\tconst unfavoriteMutationName = `${prefix}favorites:unfavorite`;\n\tconst toggleMutationName = `${prefix}favorites:toggle`;\n\tconst store = config.store ?? createInMemoryFavoritesStore();\n\tconst now = config.now ?? Date.now;\n\tconst getActorId = (config.getActorId ??\n\t\t((ctx: CollectionContext) =>\n\t\t\t(ctx as { userId?: string }).userId)) as (\n\t\tctx: CollectionContext\n\t) => string | undefined;\n\tconst joinResources = config.joinResources;\n\tconst resourceKey = (joinResources?.key ?? ((row: unknown) =>\n\t\t(row as { id: string }).id)) as (resource: unknown) => string;\n\n\ttype Params = { resourceKind?: string };\n\n\tconst pack: SyncPack = {\n\t\tname: '@absolutejs/sync-pack-favorites',\n\t\townsTables: [table],\n\t\treadsTables:\n\t\t\tjoinResources === undefined ? [] : [joinResources.table],\n\t\tversion: '0.1.0',\n\n\t\tschemas: defineSchema({\n\t\t\t[table]: {\n\t\t\t\tfields: {\n\t\t\t\t\tid: field.string,\n\t\t\t\t\tactorId: field.string,\n\t\t\t\t\tresourceKind: field.string,\n\t\t\t\t\tresourceId: field.string,\n\t\t\t\t\tcreatedAt: field.number\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\n\t\treaders: { [table]: store.reader },\n\t\twriters: { [table]: store.writer },\n\n\t\tpermissions: {\n\t\t\t[table]: {\n\t\t\t\tread: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tinsert: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tupdate: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tdelete: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\tif (callerId === undefined) return false;\n\t\t\t\t\tconst ownerId =\n\t\t\t\t\t\t(row as { actorId?: string }).actorId ??\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst id = (row as { id?: string }).id;\n\t\t\t\t\t\t\treturn id === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: store.getById(id)?.actorId;\n\t\t\t\t\t\t})();\n\t\t\t\t\treturn ownerId === callerId;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tcollections: [\n\t\t\tdefineCollection<FavoriteRow, Params, CollectionContext>({\n\t\t\t\tname: collectionName,\n\t\t\t\ttables: [table],\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\thydrate: (params, ctx) => {\n\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\tif (callerId === undefined) return [];\n\t\t\t\t\treturn (store.reader.all(ctx) as FavoriteRow[]).filter(\n\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\trow.actorId === callerId &&\n\t\t\t\t\t\t\t(params.resourceKind === undefined ||\n\t\t\t\t\t\t\t\trow.resourceKind === params.resourceKind)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmatch: (row, params, ctx) => {\n\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\tif (callerId === undefined || row.actorId !== callerId)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\treturn (\n\t\t\t\t\t\tparams.resourceKind === undefined ||\n\t\t\t\t\t\trow.resourceKind === params.resourceKind\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tauthorize: (_params, ctx) =>\n\t\t\t\t\tgetActorId(ctx as CollectionContext) !== undefined\n\t\t\t})\n\t\t],\n\n\t\tmutations: [\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tFavoriteRow\n\t\t\t>({\n\t\t\t\tname: favoriteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing !== undefined) return existing;\n\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\tactorId,\n\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.insert(table, row)) as FavoriteRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tvoid\n\t\t\t>({\n\t\t\t\tname: unfavoriteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tif (store.getById(id) === undefined) return;\n\t\t\t\t\tawait actions.delete(table, { id });\n\t\t\t\t}\n\t\t\t}),\n\t\t\t// Convenience: toggle is one round-trip from the client.\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\t{ favorited: boolean }\n\t\t\t>({\n\t\t\t\tname: toggleMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\t\tactorId,\n\t\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t\t};\n\t\t\t\t\t\tawait actions.insert(table, row);\n\t\t\t\t\t\treturn { favorited: true };\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.delete(table, { id });\n\t\t\t\t\treturn { favorited: false };\n\t\t\t\t}\n\t\t\t})\n\t\t]\n\t};\n\n\tif (joinResources !== undefined) {\n\t\tconst resourceHydrate = joinResources.hydrate;\n\t\tpack.joinCollections = [\n\t\t\tdefineJoinCollection<\n\t\t\t\tFavoriteRow,\n\t\t\t\tunknown,\n\t\t\t\tFavoriteWithResource,\n\t\t\t\tParams,\n\t\t\t\tCollectionContext\n\t\t\t>({\n\t\t\t\tname: joinCollectionName,\n\t\t\t\tkey: (out) => out.id,\n\t\t\t\tleft: {\n\t\t\t\t\ttable,\n\t\t\t\t\thydrate: (params, ctx) => {\n\t\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\t\tif (callerId === undefined) return [];\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tstore.reader.all(ctx) as FavoriteRow[]\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\t\trow.actorId === callerId &&\n\t\t\t\t\t\t\t\t(params.resourceKind === undefined ||\n\t\t\t\t\t\t\t\t\trow.resourceKind === params.resourceKind)\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tkey: (row) => row.id,\n\t\t\t\t\ton: (row) => row.resourceId,\n\t\t\t\t\tmatch: (row, params, ctx) => {\n\t\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\t\tif (callerId === undefined || row.actorId !== callerId)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tparams.resourceKind === undefined ||\n\t\t\t\t\t\t\trow.resourceKind === params.resourceKind\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tright: {\n\t\t\t\t\ttable: joinResources.table,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\tresourceHydrate(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tactorId: getActorId(ctx),\n\t\t\t\t\t\t\t\tresourceKind: params.resourceKind\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tctx as Ctx\n\t\t\t\t\t\t) as Iterable<unknown>,\n\t\t\t\t\tkey: (resource) => resourceKey(resource),\n\t\t\t\t\ton: (resource) => resourceKey(resource)\n\t\t\t\t},\n\t\t\t\tselect: (favorite, resource) => ({ ...favorite, resource }),\n\t\t\t\tauthorize: (_params, ctx) =>\n\t\t\t\t\tgetActorId(ctx as CollectionContext) !== undefined\n\t\t\t})\n\t\t];\n\t}\n\n\treturn defineSyncPack(pack);\n};\n"
5
+ "/**\n * `@absolutejs/sync-pack-favorites` — per-actor saved resources.\n *\n * Owns a `favorites` table; rows are `(actorId, resourceKind, resourceId)`\n * triples with a stable primary key derived from them, so toggling\n * favorite/unfavorite is an upsert/delete with no extra bookkeeping.\n *\n * Each actor sees only their own rows. Optional `joinResources` registers\n * a `favorites-with-resource` join collection that pairs each favorite\n * with the host's resource row (same shape as comments-with-author from\n * the comments pack). Useful when the UI wants \"title + body + favorited?\"\n * in one subscription.\n */\n\nimport {\n\tdefineCollection,\n\tdefineJoinCollection,\n\tdefineMutation,\n\tdefineSchema,\n\tdefineSyncPack,\n\tfield,\n\tUnauthorizedError,\n\ttype CollectionContext,\n\ttype SyncPack,\n\ttype TableReader,\n\ttype TableWriter\n} from '@absolutejs/sync/engine';\n\n/** A single favorited resource for a single actor. */\nexport type FavoriteRow = {\n\t/** `${actorId}:${resourceKind}:${resourceId}` — deterministic so toggling is idempotent. */\n\tid: string;\n\tactorId: string;\n\t/** App-level resource type (\"doc\", \"task\", \"issue\", ...). Lets one inbox span multiple kinds. */\n\tresourceKind: string;\n\tresourceId: string;\n\tcreatedAt: number;\n\t/**\n\t * When the actor pinned this favorite, or `null` when unpinned.\n\t * Clients can sort pinned-first by descending `pinnedAt`. Set by the\n\t * `favorites:pin` / `favorites:togglePin` mutations.\n\t */\n\tpinnedAt: number | null;\n};\n\n/** A `FavoriteRow` paired with the host's resource row, from the optional join. */\nexport type FavoriteWithResource<ResourceRow = unknown> = FavoriteRow & {\n\tresource: ResourceRow;\n};\n\nexport type FavoritesStore = {\n\treader: TableReader<CollectionContext>;\n\twriter: TableWriter<FavoriteRow, CollectionContext, unknown>;\n\tgetById: (id: string) => FavoriteRow | undefined;\n};\n\nexport const createInMemoryFavoritesStore = (): FavoritesStore => {\n\tconst rows = new Map<string, FavoriteRow>();\n\treturn {\n\t\tgetById: (id) => rows.get(id),\n\t\treader: {\n\t\t\tall: () => [...rows.values()]\n\t\t},\n\t\twriter: {\n\t\t\tdelete: (row) => {\n\t\t\t\trows.delete((row as { id: string }).id);\n\t\t\t},\n\t\t\tinsert: (data) => {\n\t\t\t\trows.set(data.id, data);\n\t\t\t\treturn data;\n\t\t\t},\n\t\t\tupdate: (data) => {\n\t\t\t\tconst prior = rows.get(data.id);\n\t\t\t\tconst merged = { ...(prior ?? {}), ...data } as FavoriteRow;\n\t\t\t\trows.set(data.id, merged);\n\t\t\t\treturn merged;\n\t\t\t}\n\t\t}\n\t};\n};\n\nexport type JoinResourcesConfig<Ctx, ResourceRow = unknown> = {\n\t/**\n\t * The host's resource table name. Surfaced in `readsTables` so the\n\t * dependency graph is reviewable. Required when the join is enabled\n\t * (no default — many apps have multiple resource tables).\n\t */\n\ttable: string;\n\t/** Get the host resource's id (the join field). Default `(row) => row.id`. */\n\tkey?: (resource: ResourceRow) => string;\n\t/**\n\t * Host-side hydrate for the resources side of the join. The pack\n\t * passes the subscription params + ctx; this returns candidate\n\t * resources. The engine inner-joins on\n\t * `favorite.resourceId === resource.id`.\n\t */\n\thydrate: (\n\t\tparams: { actorId: string | undefined; resourceKind?: string },\n\t\tctx: Ctx\n\t) => Iterable<ResourceRow> | Promise<Iterable<ResourceRow>>;\n};\n\nexport type FavoritesPackConfig<Ctx = CollectionContext, ResourceRow = unknown> = {\n\tprefix?: string;\n\tgetActorId?: (ctx: Ctx) => string | undefined;\n\t/** Custom storage adapter. Default per-instance in-memory. */\n\tstore?: FavoritesStore;\n\t/** Wall-clock. Default `Date.now`. */\n\tnow?: () => number;\n\t/**\n\t * Optional join collection. When set, registers\n\t * `favorites-with-resource` and adds the resource table to\n\t * `readsTables`.\n\t */\n\tjoinResources?: JoinResourcesConfig<Ctx, ResourceRow>;\n};\n\nconst resolveActor = (\n\tgetActorId: NonNullable<FavoritesPackConfig['getActorId']>,\n\tctx: unknown\n): string => {\n\tconst actorId = getActorId(ctx as CollectionContext);\n\tif (actorId === undefined || actorId === '') {\n\t\tthrow new UnauthorizedError('favorites mutation (no actor id)');\n\t}\n\treturn actorId;\n};\n\nconst rowId = (\n\tactorId: string,\n\tresourceKind: string,\n\tresourceId: string\n): string => `${actorId}:${resourceKind}:${resourceId}`;\n\n/**\n * Build a {@link SyncPack} that exposes a per-actor list of favorited\n * host-side resources. Optional join collection pairs each favorite with\n * its host resource row.\n */\nexport const createFavoritesPack = <\n\tCtx = CollectionContext,\n\tResourceRow = unknown\n>(\n\tconfig: FavoritesPackConfig<Ctx, ResourceRow> = {}\n): SyncPack => {\n\tconst prefix = config.prefix ?? '';\n\tconst table = `${prefix}favorites`;\n\tconst collectionName = table;\n\tconst joinCollectionName = `${prefix}favorites-with-resource`;\n\tconst favoriteMutationName = `${prefix}favorites:favorite`;\n\tconst unfavoriteMutationName = `${prefix}favorites:unfavorite`;\n\tconst toggleMutationName = `${prefix}favorites:toggle`;\n\tconst store = config.store ?? createInMemoryFavoritesStore();\n\tconst now = config.now ?? Date.now;\n\tconst getActorId = (config.getActorId ??\n\t\t((ctx: CollectionContext) =>\n\t\t\t(ctx as { userId?: string }).userId)) as (\n\t\tctx: CollectionContext\n\t) => string | undefined;\n\tconst joinResources = config.joinResources;\n\tconst resourceKey = (joinResources?.key ?? ((row: unknown) =>\n\t\t(row as { id: string }).id)) as (resource: unknown) => string;\n\n\ttype Params = { resourceKind?: string };\n\n\tconst pack: SyncPack = {\n\t\tname: '@absolutejs/sync-pack-favorites',\n\t\townsTables: [table],\n\t\treadsTables:\n\t\t\tjoinResources === undefined ? [] : [joinResources.table],\n\t\tversion: '0.2.0',\n\n\t\tschemas: defineSchema({\n\t\t\t[table]: {\n\t\t\t\tfields: {\n\t\t\t\t\tid: field.string,\n\t\t\t\t\tactorId: field.string,\n\t\t\t\t\tresourceKind: field.string,\n\t\t\t\t\tresourceId: field.string,\n\t\t\t\t\tcreatedAt: field.number,\n\t\t\t\t\tpinnedAt: (value) =>\n\t\t\t\t\t\tvalue === null || typeof value === 'number'\n\t\t\t\t}\n\t\t\t}\n\t\t}),\n\n\t\treaders: { [table]: store.reader },\n\t\twriters: { [table]: store.writer },\n\n\t\tpermissions: {\n\t\t\t[table]: {\n\t\t\t\tread: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tinsert: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tupdate: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\treturn callerId !== undefined && row.actorId === callerId;\n\t\t\t\t},\n\t\t\t\tdelete: (ctx: unknown, row: FavoriteRow) => {\n\t\t\t\t\tconst callerId = getActorId(ctx as CollectionContext);\n\t\t\t\t\tif (callerId === undefined) return false;\n\t\t\t\t\tconst ownerId =\n\t\t\t\t\t\t(row as { actorId?: string }).actorId ??\n\t\t\t\t\t\t(() => {\n\t\t\t\t\t\t\tconst id = (row as { id?: string }).id;\n\t\t\t\t\t\t\treturn id === undefined\n\t\t\t\t\t\t\t\t? undefined\n\t\t\t\t\t\t\t\t: store.getById(id)?.actorId;\n\t\t\t\t\t\t})();\n\t\t\t\t\treturn ownerId === callerId;\n\t\t\t\t}\n\t\t\t}\n\t\t},\n\n\t\tcollections: [\n\t\t\tdefineCollection<FavoriteRow, Params, CollectionContext>({\n\t\t\t\tname: collectionName,\n\t\t\t\ttables: [table],\n\t\t\t\tkey: (row) => row.id,\n\t\t\t\thydrate: (params, ctx) => {\n\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\tif (callerId === undefined) return [];\n\t\t\t\t\treturn (store.reader.all(ctx) as FavoriteRow[]).filter(\n\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\trow.actorId === callerId &&\n\t\t\t\t\t\t\t(params.resourceKind === undefined ||\n\t\t\t\t\t\t\t\trow.resourceKind === params.resourceKind)\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tmatch: (row, params, ctx) => {\n\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\tif (callerId === undefined || row.actorId !== callerId)\n\t\t\t\t\t\treturn false;\n\t\t\t\t\treturn (\n\t\t\t\t\t\tparams.resourceKind === undefined ||\n\t\t\t\t\t\trow.resourceKind === params.resourceKind\n\t\t\t\t\t);\n\t\t\t\t},\n\t\t\t\tauthorize: (_params, ctx) =>\n\t\t\t\t\tgetActorId(ctx as CollectionContext) !== undefined\n\t\t\t})\n\t\t],\n\n\t\tmutations: [\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tFavoriteRow\n\t\t\t>({\n\t\t\t\tname: favoriteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing !== undefined) return existing;\n\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\tactorId,\n\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\tid,\n\t\t\t\t\t\tpinnedAt: null,\n\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t};\n\t\t\t\t\treturn (await actions.insert(table, row)) as FavoriteRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tvoid\n\t\t\t>({\n\t\t\t\tname: unfavoriteMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tif (store.getById(id) === undefined) return;\n\t\t\t\t\tawait actions.delete(table, { id });\n\t\t\t\t}\n\t\t\t}),\n\t\t\t// Convenience: toggle is one round-trip from the client.\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\t{ favorited: boolean }\n\t\t\t>({\n\t\t\t\tname: toggleMutationName,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\t\tactorId,\n\t\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tpinnedAt: null,\n\t\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t\t};\n\t\t\t\t\t\tawait actions.insert(table, row);\n\t\t\t\t\t\treturn { favorited: true };\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.delete(table, { id });\n\t\t\t\t\treturn { favorited: false };\n\t\t\t\t}\n\t\t\t}),\n\t\t\t// 0.2: pinning — flips a per-actor `pinnedAt` timestamp so\n\t\t\t// clients can sort pinned-first. Idempotent: pinning twice\n\t\t\t// keeps the original `pinnedAt`; unpinning a non-favorite is\n\t\t\t// a no-op.\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tFavoriteRow\n\t\t\t>({\n\t\t\t\tname: `${prefix}favorites:pin`,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\t\tactorId,\n\t\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tpinnedAt: now(),\n\t\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t\t};\n\t\t\t\t\t\treturn (await actions.insert(\n\t\t\t\t\t\t\ttable,\n\t\t\t\t\t\t\trow\n\t\t\t\t\t\t)) as FavoriteRow;\n\t\t\t\t\t}\n\t\t\t\t\tif (existing.pinnedAt !== null) return existing;\n\t\t\t\t\treturn (await actions.update(table, {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tpinnedAt: now()\n\t\t\t\t\t})) as FavoriteRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\tFavoriteRow | undefined\n\t\t\t>({\n\t\t\t\tname: `${prefix}favorites:unpin`,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing === undefined || existing.pinnedAt === null) {\n\t\t\t\t\t\treturn existing;\n\t\t\t\t\t}\n\t\t\t\t\treturn (await actions.update(table, {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tpinnedAt: null\n\t\t\t\t\t})) as FavoriteRow;\n\t\t\t\t}\n\t\t\t}),\n\t\t\tdefineMutation<\n\t\t\t\t{ resourceKind: string; resourceId: string },\n\t\t\t\tCollectionContext,\n\t\t\t\t{ pinned: boolean }\n\t\t\t>({\n\t\t\t\tname: `${prefix}favorites:togglePin`,\n\t\t\t\thandler: async (args, ctx, actions) => {\n\t\t\t\t\tconst actorId = resolveActor(getActorId, ctx);\n\t\t\t\t\tconst id = rowId(actorId, args.resourceKind, args.resourceId);\n\t\t\t\t\tconst existing = store.getById(id);\n\t\t\t\t\tif (existing === undefined) {\n\t\t\t\t\t\tconst row: FavoriteRow = {\n\t\t\t\t\t\t\tactorId,\n\t\t\t\t\t\t\tcreatedAt: now(),\n\t\t\t\t\t\t\tid,\n\t\t\t\t\t\t\tpinnedAt: now(),\n\t\t\t\t\t\t\tresourceId: args.resourceId,\n\t\t\t\t\t\t\tresourceKind: args.resourceKind\n\t\t\t\t\t\t};\n\t\t\t\t\t\tawait actions.insert(table, row);\n\t\t\t\t\t\treturn { pinned: true };\n\t\t\t\t\t}\n\t\t\t\t\tif (existing.pinnedAt === null) {\n\t\t\t\t\t\tawait actions.update(table, {\n\t\t\t\t\t\t\t...existing,\n\t\t\t\t\t\t\tpinnedAt: now()\n\t\t\t\t\t\t});\n\t\t\t\t\t\treturn { pinned: true };\n\t\t\t\t\t}\n\t\t\t\t\tawait actions.update(table, {\n\t\t\t\t\t\t...existing,\n\t\t\t\t\t\tpinnedAt: null\n\t\t\t\t\t});\n\t\t\t\t\treturn { pinned: false };\n\t\t\t\t}\n\t\t\t})\n\t\t]\n\t};\n\n\tif (joinResources !== undefined) {\n\t\tconst resourceHydrate = joinResources.hydrate;\n\t\tpack.joinCollections = [\n\t\t\tdefineJoinCollection<\n\t\t\t\tFavoriteRow,\n\t\t\t\tunknown,\n\t\t\t\tFavoriteWithResource,\n\t\t\t\tParams,\n\t\t\t\tCollectionContext\n\t\t\t>({\n\t\t\t\tname: joinCollectionName,\n\t\t\t\tkey: (out) => out.id,\n\t\t\t\tleft: {\n\t\t\t\t\ttable,\n\t\t\t\t\thydrate: (params, ctx) => {\n\t\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\t\tif (callerId === undefined) return [];\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tstore.reader.all(ctx) as FavoriteRow[]\n\t\t\t\t\t\t).filter(\n\t\t\t\t\t\t\t(row) =>\n\t\t\t\t\t\t\t\trow.actorId === callerId &&\n\t\t\t\t\t\t\t\t(params.resourceKind === undefined ||\n\t\t\t\t\t\t\t\t\trow.resourceKind === params.resourceKind)\n\t\t\t\t\t\t);\n\t\t\t\t\t},\n\t\t\t\t\tkey: (row) => row.id,\n\t\t\t\t\ton: (row) => row.resourceId,\n\t\t\t\t\tmatch: (row, params, ctx) => {\n\t\t\t\t\t\tconst callerId = getActorId(ctx);\n\t\t\t\t\t\tif (callerId === undefined || row.actorId !== callerId)\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\treturn (\n\t\t\t\t\t\t\tparams.resourceKind === undefined ||\n\t\t\t\t\t\t\trow.resourceKind === params.resourceKind\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t},\n\t\t\t\tright: {\n\t\t\t\t\ttable: joinResources.table,\n\t\t\t\t\thydrate: (params, ctx) =>\n\t\t\t\t\t\tresourceHydrate(\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tactorId: getActorId(ctx),\n\t\t\t\t\t\t\t\tresourceKind: params.resourceKind\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\tctx as Ctx\n\t\t\t\t\t\t) as Iterable<unknown>,\n\t\t\t\t\tkey: (resource) => resourceKey(resource),\n\t\t\t\t\ton: (resource) => resourceKey(resource)\n\t\t\t\t},\n\t\t\t\tselect: (favorite, resource) => ({ ...favorite, resource }),\n\t\t\t\tauthorize: (_params, ctx) =>\n\t\t\t\t\tgetActorId(ctx as CollectionContext) !== undefined\n\t\t\t})\n\t\t];\n\t}\n\n\treturn defineSyncPack(pack);\n};\n"
6
6
  ],
7
- "mappings": ";;AAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCO,IAAM,+BAA+B,MAAsB;AAAA,EACjE,MAAM,OAAO,IAAI;AAAA,EACjB,OAAO;AAAA,IACN,SAAS,CAAC,OAAO,KAAK,IAAI,EAAE;AAAA,IAC5B,QAAQ;AAAA,MACP,KAAK,MAAM,CAAC,GAAG,KAAK,OAAO,CAAC;AAAA,IAC7B;AAAA,IACA,QAAQ;AAAA,MACP,QAAQ,CAAC,QAAQ;AAAA,QAChB,KAAK,OAAQ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}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@absolutejs/sync-pack-favorites",
3
- "version": "0.1.0",
4
- "description": "Per-actor saved-resources pack for @absolutejs/sync — favorite/unfavorite/list with optional join to host resources",
3
+ "version": "0.2.0",
4
+ "description": "Per-actor saved-resources pack for @absolutejs/sync — favorite/unfavorite/pin/list with optional join to host resources",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/absolutejs/sync-packs.git",