@marcoappio/marco-config 2.0.494 → 2.0.495

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/zero/index.d.ts +224 -0
  2. package/dist/zero/index.d.ts.map +1 -1
  3. package/dist/zero/index.js +2 -1
  4. package/dist/zero/mutators/accountMutators/accountMutators.d.ts +61 -0
  5. package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
  6. package/dist/zero/mutators/accountMutators/accountMutators.js +78 -78
  7. package/dist/zero/mutators/accountMutators/index.d.ts +1 -1
  8. package/dist/zero/mutators/accountMutators/index.d.ts.map +1 -1
  9. package/dist/zero/mutators/accountMutators/index.js +1 -1
  10. package/dist/zero/mutators/draftMutators/draftMutators.d.ts +94 -0
  11. package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
  12. package/dist/zero/mutators/draftMutators/draftMutators.js +75 -76
  13. package/dist/zero/mutators/draftMutators/index.d.ts +1 -1
  14. package/dist/zero/mutators/draftMutators/index.d.ts.map +1 -1
  15. package/dist/zero/mutators/draftMutators/index.js +1 -1
  16. package/dist/zero/mutators/index.d.ts +224 -0
  17. package/dist/zero/mutators/index.d.ts.map +1 -1
  18. package/dist/zero/mutators/index.js +10 -0
  19. package/dist/zero/mutators/threadMutators/index.d.ts +1 -1
  20. package/dist/zero/mutators/threadMutators/index.d.ts.map +1 -1
  21. package/dist/zero/mutators/threadMutators/index.js +1 -1
  22. package/dist/zero/mutators/threadMutators/threadMutators.d.ts +52 -0
  23. package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
  24. package/dist/zero/mutators/threadMutators/threadMutators.js +41 -30
  25. package/dist/zero/mutators/userMutators/index.d.ts +1 -1
  26. package/dist/zero/mutators/userMutators/index.d.ts.map +1 -1
  27. package/dist/zero/mutators/userMutators/index.js +1 -1
  28. package/dist/zero/mutators/userMutators/userMutators.d.ts +19 -0
  29. package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
  30. package/dist/zero/mutators/userMutators/userMutators.js +25 -26
  31. package/package.json +1 -1
@@ -2,44 +2,43 @@ import { defineMutator } from '@rocicorp/zero';
2
2
  import * as v from 'valibot';
3
3
  import { marcoSchemas } from '../../../schemas';
4
4
  import { zeroCRUD } from '../../../zero/crud';
5
- const userPushNotificationTokenSchema = v.object({
6
- createdAt: marcoSchemas.number.positiveInteger(),
7
- id: marcoSchemas.string.required(),
8
- token: marcoSchemas.string.required(),
9
- });
10
- export const userMutators = {
11
- deleteSettingsPushNotificationToken: defineMutator(v.object({
5
+ export const userMutatorSchemas = {
6
+ deleteSettingsPushNotificationToken: v.object({
12
7
  id: marcoSchemas.string.required(),
13
8
  token: marcoSchemas.string.required(),
14
- }), async ({ tx, args }) => {
15
- await tx.mutate(zeroCRUD.userPushNotificationToken.delete({
16
- id: args.id,
17
- }));
18
9
  }),
19
- setSettingsName: defineMutator(v.object({
10
+ setSettingsName: v.object({
20
11
  id: marcoSchemas.string.required(),
21
12
  name: marcoSchemas.string.nullable(),
22
- }), async ({ tx, args }) => {
23
- await tx.mutate(zeroCRUD.user.update({
24
- id: args.id,
25
- name: args.name,
26
- }));
27
13
  }),
28
- setSettingsPushNotificationToken: defineMutator(v.object({
14
+ setSettingsPushNotificationToken: v.object({
29
15
  id: marcoSchemas.string.required(),
30
- pushNotificationToken: userPushNotificationTokenSchema,
31
- }), async ({ tx, args }) => {
16
+ pushNotificationToken: v.object({
17
+ createdAt: marcoSchemas.number.positiveInteger(),
18
+ id: marcoSchemas.string.required(),
19
+ token: marcoSchemas.string.required(),
20
+ }),
21
+ }),
22
+ };
23
+ export const userMutators = {
24
+ deleteSettingsPushNotificationToken: defineMutator(userMutatorSchemas.deleteSettingsPushNotificationToken, async ({ tx, args: { id } }) => {
25
+ await tx.mutate(zeroCRUD.userPushNotificationToken.delete({ id }));
26
+ }),
27
+ setSettingsName: defineMutator(userMutatorSchemas.setSettingsName, async ({ tx, args: { id, name } }) => {
28
+ await tx.mutate(zeroCRUD.user.update({ id, name }));
29
+ }),
30
+ setSettingsPushNotificationToken: defineMutator(userMutatorSchemas.setSettingsPushNotificationToken, async ({ tx, args: { id, pushNotificationToken } }) => {
32
31
  const existing = await tx.query.userPushNotificationToken
33
- .where('userId', args.id)
34
- .where('token', args.pushNotificationToken.token)
32
+ .where('userId', id)
33
+ .where('token', pushNotificationToken.token)
35
34
  .one()
36
35
  .run();
37
36
  if (!existing) {
38
37
  await tx.mutate(zeroCRUD.userPushNotificationToken.insert({
39
- createdAt: args.pushNotificationToken.createdAt,
40
- id: args.pushNotificationToken.id,
41
- token: args.pushNotificationToken.token,
42
- userId: args.id,
38
+ createdAt: pushNotificationToken.createdAt,
39
+ id: pushNotificationToken.id,
40
+ token: pushNotificationToken.token,
41
+ userId: id,
43
42
  }));
44
43
  }
45
44
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@marcoappio/marco-config",
3
- "version": "2.0.494",
3
+ "version": "2.0.495",
4
4
  "author": "team@marcoapp.io",
5
5
  "main": "dist/index.js",
6
6
  "repository": "git@github.com:marcoappio/marco-config.git",