@absolutejs/sync-pack-favorites 0.1.0 → 0.2.1
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/LICENSE +202 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +78 -3
- package/dist/index.js.map +3 -3
- package/package.json +3 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
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.
|
|
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=
|
|
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;
|
|
8
|
-
"debugId": "
|
|
7
|
+
"mappings": ";;AAcA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CO,IAAM,+BAA+B,MAAsB;AAAA,EACjE,MAAM,OAAO,IA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Q,QACjB,gBACC;AAAA,YACC,SAAS,WAAW,GAAG;AAAA,YACvB,cAAc,OAAO;AAAA,UACtB,GACA,GACD;AAAA,UACD,KAAK,CAAC,aAAa,YAAY,QAAQ;AAAA,UACvC,IAAI,CAAC,aAAa,YAAY,QAAQ;AAAA,QACvC;AAAA,QACA,QAAQ,CAAC,UAAU,cAAc,KAAK,UAAU,SAAS;AAAA,QACzD,WAAW,CAAC,SAAS,QACpB,WAAW,GAAwB,MAAM;AAAA,MAC3C,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,OAAO,eAAe,IAAI;AAAA;",
|
|
8
|
+
"debugId": "157685E60C5FD0FF64756E2164756E21",
|
|
9
9
|
"names": []
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@absolutejs/sync-pack-favorites",
|
|
3
|
-
"version": "0.1
|
|
4
|
-
"description": "Per-actor saved-resources pack for @absolutejs/sync — favorite/unfavorite/list with optional join to host resources",
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"module": "./dist/index.js",
|
|
12
12
|
"types": "./dist/index.d.ts",
|
|
13
13
|
"type": "module",
|
|
14
|
-
"license": "
|
|
14
|
+
"license": "Apache-2.0",
|
|
15
15
|
"author": "Alex Kahn",
|
|
16
16
|
"publishConfig": {
|
|
17
17
|
"access": "public"
|