@marcoappio/marco-config 2.0.504 → 2.0.505
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/types/AuthData.d.ts +4 -0
- package/dist/types/AuthData.d.ts.map +1 -0
- package/dist/types/AuthData.js +1 -0
- package/dist/types/IMAPSourceLocation.d.ts +7 -0
- package/dist/types/IMAPSourceLocation.d.ts.map +1 -0
- package/dist/types/IMAPSourceLocation.js +1 -0
- package/dist/types/Zero.d.ts +14 -8
- package/dist/types/Zero.d.ts.map +1 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/zero/index.d.ts +7745 -3109
- package/dist/zero/index.d.ts.map +1 -1
- package/dist/zero/index.js +14 -5
- package/dist/zero/mutatorSchemas/account.d.ts +80 -0
- package/dist/zero/mutatorSchemas/account.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/account.js +66 -0
- package/dist/zero/mutatorSchemas/draft.d.ts +150 -0
- package/dist/zero/mutatorSchemas/draft.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/draft.js +104 -0
- package/dist/zero/mutatorSchemas/index.d.ts +323 -0
- package/dist/zero/mutatorSchemas/index.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/index.js +10 -0
- package/dist/zero/mutatorSchemas/thread.d.ts +71 -0
- package/dist/zero/mutatorSchemas/thread.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/thread.js +47 -0
- package/dist/zero/mutatorSchemas/user.d.ts +26 -0
- package/dist/zero/mutatorSchemas/user.d.ts.map +1 -0
- package/dist/zero/mutatorSchemas/user.js +27 -0
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts +3 -188
- package/dist/zero/mutators/accountMutators/accountMutators.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/accountMutators.js +82 -118
- package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts +2 -0
- package/dist/zero/mutators/accountMutators/accountMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/accountMutators/accountMutators.test.js +372 -0
- package/dist/zero/mutators/accountMutators/index.d.ts +1 -1
- package/dist/zero/mutators/accountMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/accountMutators/index.js +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts +3 -305
- package/dist/zero/mutators/draftMutators/draftMutators.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/draftMutators.js +83 -157
- package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts +2 -0
- package/dist/zero/mutators/draftMutators/draftMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/draftMutators/draftMutators.test.js +416 -0
- package/dist/zero/mutators/draftMutators/index.d.ts +1 -1
- package/dist/zero/mutators/draftMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/draftMutators/index.js +1 -1
- package/dist/zero/mutators/index.d.ts +1 -251
- package/dist/zero/mutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/index.js +1 -11
- package/dist/zero/mutators/mutators.d.ts +17 -1519
- package/dist/zero/mutators/mutators.d.ts.map +1 -1
- package/dist/zero/mutators/mutators.js +38 -11
- package/dist/zero/mutators/threadMutators/index.d.ts +1 -1
- package/dist/zero/mutators/threadMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/index.js +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts +6 -199
- package/dist/zero/mutators/threadMutators/threadMutators.d.ts.map +1 -1
- package/dist/zero/mutators/threadMutators/threadMutators.js +87 -119
- package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts +2 -0
- package/dist/zero/mutators/threadMutators/threadMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/threadMutators/threadMutators.test.js +755 -0
- package/dist/zero/mutators/userMutators/index.d.ts +1 -1
- package/dist/zero/mutators/userMutators/index.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/index.js +1 -1
- package/dist/zero/mutators/userMutators/userMutators.d.ts +3 -56
- package/dist/zero/mutators/userMutators/userMutators.d.ts.map +1 -1
- package/dist/zero/mutators/userMutators/userMutators.js +26 -40
- package/dist/zero/mutators/userMutators/userMutators.test.d.ts +2 -0
- package/dist/zero/mutators/userMutators/userMutators.test.d.ts.map +1 -0
- package/dist/zero/mutators/userMutators/userMutators.test.js +84 -0
- package/dist/zero/queries/getAccounts.d.ts +1025 -4
- package/dist/zero/queries/getAccounts.d.ts.map +1 -1
- package/dist/zero/queries/getAccounts.js +3 -6
- package/dist/zero/queries/getContacts.d.ts +1033 -18
- package/dist/zero/queries/getContacts.d.ts.map +1 -1
- package/dist/zero/queries/getContacts.js +15 -11
- package/dist/zero/queries/getDrafts.d.ts +1031 -11
- package/dist/zero/queries/getDrafts.d.ts.map +1 -1
- package/dist/zero/queries/getDrafts.js +11 -7
- package/dist/zero/queries/getThread.d.ts +1028 -7
- package/dist/zero/queries/getThread.d.ts.map +1 -1
- package/dist/zero/queries/getThread.js +9 -5
- package/dist/zero/queries/getThreadList.d.ts +1035 -23
- package/dist/zero/queries/getThreadList.d.ts.map +1 -1
- package/dist/zero/queries/getThreadList.js +18 -14
- package/dist/zero/queries/getThreads.d.ts +1035 -23
- package/dist/zero/queries/getThreads.d.ts.map +1 -1
- package/dist/zero/queries/getThreads.js +18 -14
- package/dist/zero/queries/getUser.d.ts +1025 -4
- package/dist/zero/queries/getUser.d.ts.map +1 -1
- package/dist/zero/queries/getUser.js +7 -10
- package/dist/zero/queries/index.d.ts +141 -460
- package/dist/zero/queries/index.d.ts.map +1 -1
- package/dist/zero/queries/index.js +10 -18
- package/dist/zero/schema.d.ts +133 -133
- package/dist/zero/schema.d.ts.map +1 -1
- package/dist/zero/schema.js +1 -0
- package/package.json +2 -2
- package/dist/zero/crud.d.ts +0 -1024
- package/dist/zero/crud.d.ts.map +0 -1
- package/dist/zero/crud.js +0 -3
- package/dist/zero/mutators/typedMutator.d.ts +0 -2056
- package/dist/zero/mutators/typedMutator.d.ts.map +0 -1
- package/dist/zero/mutators/typedMutator.js +0 -2
- package/dist/zero/queries/z.d.ts +0 -14439
- package/dist/zero/queries/z.d.ts.map +0 -1
- package/dist/zero/queries/z.js +0 -3
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './userMutators';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export
|
|
1
|
+
export * from './userMutators';
|
|
@@ -1,57 +1,4 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
5
|
-
readonly token: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
6
|
-
}, undefined>;
|
|
7
|
-
setSettingsName: v.ObjectSchema<{
|
|
8
|
-
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
9
|
-
readonly name: v.NullableSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
10
|
-
}, undefined>;
|
|
11
|
-
setSettingsPushNotificationToken: v.ObjectSchema<{
|
|
12
|
-
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
13
|
-
readonly pushNotificationToken: v.ObjectSchema<{
|
|
14
|
-
readonly createdAt: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.NumberSchema<undefined>, v.IntegerAction<number, undefined>, v.MinValueAction<number, 0, undefined>]>, undefined>;
|
|
15
|
-
readonly id: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
16
|
-
readonly token: v.NonOptionalSchema<v.SchemaWithPipe<readonly [v.StringSchema<undefined>, v.NonEmptyAction<string, undefined>, v.MaxLengthAction<string, number, undefined>]>, undefined>;
|
|
17
|
-
}, undefined>;
|
|
18
|
-
}, undefined>;
|
|
19
|
-
};
|
|
20
|
-
export declare const userMutators: {
|
|
21
|
-
deleteSettingsPushNotificationToken: import("@rocicorp/zero").MutatorDefinition<{
|
|
22
|
-
id: string;
|
|
23
|
-
token: string;
|
|
24
|
-
}, {
|
|
25
|
-
id: string;
|
|
26
|
-
token: string;
|
|
27
|
-
}, {
|
|
28
|
-
readonly userId: string;
|
|
29
|
-
}, unknown>;
|
|
30
|
-
setSettingsName: import("@rocicorp/zero").MutatorDefinition<{
|
|
31
|
-
id: string;
|
|
32
|
-
name: string | null;
|
|
33
|
-
}, {
|
|
34
|
-
id: string;
|
|
35
|
-
name: string | null;
|
|
36
|
-
}, {
|
|
37
|
-
readonly userId: string;
|
|
38
|
-
}, unknown>;
|
|
39
|
-
setSettingsPushNotificationToken: import("@rocicorp/zero").MutatorDefinition<{
|
|
40
|
-
id: string;
|
|
41
|
-
pushNotificationToken: {
|
|
42
|
-
createdAt: number;
|
|
43
|
-
id: string;
|
|
44
|
-
token: string;
|
|
45
|
-
};
|
|
46
|
-
}, {
|
|
47
|
-
id: string;
|
|
48
|
-
pushNotificationToken: {
|
|
49
|
-
createdAt: number;
|
|
50
|
-
id: string;
|
|
51
|
-
token: string;
|
|
52
|
-
};
|
|
53
|
-
}, {
|
|
54
|
-
readonly userId: string;
|
|
55
|
-
}, unknown>;
|
|
56
|
-
};
|
|
1
|
+
import type { AuthData, HandlerMap } from '../../../types';
|
|
2
|
+
import type { ZeroMutatorSchemas } from '../../../zero/mutatorSchemas';
|
|
3
|
+
export declare const createUserMutators: (_authData: AuthData | undefined) => HandlerMap<ZeroMutatorSchemas["user"]>;
|
|
57
4
|
//# sourceMappingURL=userMutators.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"userMutators.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAA;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,mCAAmC,CAAA;AAE3E,eAAO,MAAM,kBAAkB,cAAe,QAAQ,GAAG,SAAS,KAAG,UAAU,CAAC,kBAAkB,CAAC,MAAM,CAAC,CA4BxG,CAAA"}
|
|
@@ -1,42 +1,28 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
id: marcoSchemas.string.required(),
|
|
20
|
-
token: marcoSchemas.string.required(),
|
|
21
|
-
}),
|
|
22
|
-
}),
|
|
23
|
-
};
|
|
24
|
-
export const userMutators = {
|
|
25
|
-
deleteSettingsPushNotificationToken: defineMutator(userMutatorSchemas.deleteSettingsPushNotificationToken, async ({ tx, args: { id } }) => {
|
|
26
|
-
await tx.mutate(zeroCRUD.userPushNotificationToken.delete({ id }));
|
|
27
|
-
}),
|
|
28
|
-
setSettingsName: defineMutator(userMutatorSchemas.setSettingsName, async ({ tx, args: { id, name } }) => {
|
|
29
|
-
await tx.mutate(zeroCRUD.user.update({ id, name }));
|
|
30
|
-
}),
|
|
31
|
-
setSettingsPushNotificationToken: defineMutator(userMutatorSchemas.setSettingsPushNotificationToken, async ({ tx, args: { id, pushNotificationToken } }) => {
|
|
32
|
-
const existing = await tx.run(z.userPushNotificationToken.where('userId', id).where('token', pushNotificationToken.token).one());
|
|
1
|
+
export const createUserMutators = (_authData) => ({
|
|
2
|
+
deleteSettingsPushNotificationToken: async (tx, args) => {
|
|
3
|
+
await tx.mutate.userPushNotificationToken.delete({
|
|
4
|
+
id: args.id,
|
|
5
|
+
});
|
|
6
|
+
},
|
|
7
|
+
setSettingsName: async (tx, args) => {
|
|
8
|
+
await tx.mutate.user.update({
|
|
9
|
+
id: args.id,
|
|
10
|
+
name: args.name,
|
|
11
|
+
});
|
|
12
|
+
},
|
|
13
|
+
setSettingsPushNotificationToken: async (tx, args) => {
|
|
14
|
+
const existing = await tx.query.userPushNotificationToken
|
|
15
|
+
.where('userId', args.id)
|
|
16
|
+
.where('token', args.pushNotificationToken.token)
|
|
17
|
+
.one()
|
|
18
|
+
.run();
|
|
33
19
|
if (!existing) {
|
|
34
|
-
await tx.mutate
|
|
35
|
-
createdAt: pushNotificationToken.createdAt,
|
|
36
|
-
id: pushNotificationToken.id,
|
|
37
|
-
token: pushNotificationToken.token,
|
|
38
|
-
userId: id,
|
|
39
|
-
})
|
|
20
|
+
await tx.mutate.userPushNotificationToken.insert({
|
|
21
|
+
createdAt: args.pushNotificationToken.createdAt,
|
|
22
|
+
id: args.pushNotificationToken.id,
|
|
23
|
+
token: args.pushNotificationToken.token,
|
|
24
|
+
userId: args.id,
|
|
25
|
+
});
|
|
40
26
|
}
|
|
41
|
-
}
|
|
42
|
-
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"userMutators.test.d.ts","sourceRoot":"","sources":["../../../../src/zero/mutators/userMutators/userMutators.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { describe, expect, it, mock } from 'bun:test';
|
|
2
|
+
import { createMutators } from '../mutators';
|
|
3
|
+
describe('userMutators', () => {
|
|
4
|
+
describe('deleteSettingsPushNotificationToken', () => {
|
|
5
|
+
it('deletes push notification token', async () => {
|
|
6
|
+
const tokenDelete = mock(async () => { });
|
|
7
|
+
const transaction = {
|
|
8
|
+
mutate: {
|
|
9
|
+
userPushNotificationToken: {
|
|
10
|
+
delete: tokenDelete,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
query: {},
|
|
14
|
+
};
|
|
15
|
+
const mutators = createMutators();
|
|
16
|
+
await mutators.user.deleteSettingsPushNotificationToken(transaction, {
|
|
17
|
+
id: 'test-user-id',
|
|
18
|
+
token: 'test-token',
|
|
19
|
+
});
|
|
20
|
+
expect(tokenDelete).toHaveBeenCalledWith({
|
|
21
|
+
id: 'test-user-id',
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe('setSettingsName', () => {
|
|
26
|
+
it('sets user name', async () => {
|
|
27
|
+
const userUpdate = mock(async () => { });
|
|
28
|
+
const transaction = {
|
|
29
|
+
mutate: {
|
|
30
|
+
user: {
|
|
31
|
+
update: userUpdate,
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
query: {},
|
|
35
|
+
};
|
|
36
|
+
const mutators = createMutators();
|
|
37
|
+
await mutators.user.setSettingsName(transaction, {
|
|
38
|
+
id: 'test-user-id',
|
|
39
|
+
name: 'John Doe',
|
|
40
|
+
});
|
|
41
|
+
expect(userUpdate).toHaveBeenCalledWith({
|
|
42
|
+
id: 'test-user-id',
|
|
43
|
+
name: 'John Doe',
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
});
|
|
47
|
+
describe('setSettingsPushNotificationToken', () => {
|
|
48
|
+
it('sets push notification token when token does not exist', async () => {
|
|
49
|
+
const run = mock(async () => null);
|
|
50
|
+
const one = mock(() => ({ run }));
|
|
51
|
+
const whereToken = mock(() => ({ one }));
|
|
52
|
+
const whereUserId = mock(() => ({ where: whereToken }));
|
|
53
|
+
const tokenInsert = mock(async () => { });
|
|
54
|
+
const transaction = {
|
|
55
|
+
mutate: {
|
|
56
|
+
userPushNotificationToken: {
|
|
57
|
+
insert: tokenInsert,
|
|
58
|
+
update: mock(async () => { }),
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
query: {
|
|
62
|
+
userPushNotificationToken: {
|
|
63
|
+
where: whereUserId,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
const mutators = createMutators();
|
|
68
|
+
await mutators.user.setSettingsPushNotificationToken(transaction, {
|
|
69
|
+
id: 'test-user-id',
|
|
70
|
+
pushNotificationToken: {
|
|
71
|
+
createdAt: 1_000,
|
|
72
|
+
id: 'test-user-id-test-device-id',
|
|
73
|
+
token: 'test-token',
|
|
74
|
+
},
|
|
75
|
+
});
|
|
76
|
+
expect(tokenInsert).toHaveBeenCalledWith({
|
|
77
|
+
createdAt: 1_000,
|
|
78
|
+
id: 'test-user-id-test-device-id',
|
|
79
|
+
token: 'test-token',
|
|
80
|
+
userId: 'test-user-id',
|
|
81
|
+
});
|
|
82
|
+
});
|
|
83
|
+
});
|
|
84
|
+
});
|