@axium/contacts 0.3.0 → 0.3.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/db.json +15 -0
- package/dist/client/api.js +4 -2
- package/dist/server/db.js +4 -0
- package/package.json +4 -4
package/db.json
CHANGED
|
@@ -116,6 +116,21 @@
|
|
|
116
116
|
"contact_dates_id": { "on": "contact_dates", "columns": ["id"] },
|
|
117
117
|
"contact_custom_id": { "on": "contact_custom", "columns": ["id"] }
|
|
118
118
|
}
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
"delta": true,
|
|
122
|
+
"alter_tables": {
|
|
123
|
+
"contacts": {
|
|
124
|
+
"add_triggers": {
|
|
125
|
+
"sync_events": {
|
|
126
|
+
"forEach": "row",
|
|
127
|
+
"when": "after",
|
|
128
|
+
"events": ["insert", "update", "delete"],
|
|
129
|
+
"execute": "add_sync_event"
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
119
134
|
}
|
|
120
135
|
],
|
|
121
136
|
"wipe": [
|
package/dist/client/api.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import { fetchAPI
|
|
1
|
+
import { fetchAPI } from '@axium/client';
|
|
2
|
+
import Cache from '@axium/client/cache';
|
|
3
|
+
const cache = new Cache((id) => fetchAPI('GET', 'contacts/:id', {}, id));
|
|
2
4
|
export async function getContact(id) {
|
|
3
|
-
return await cache.
|
|
5
|
+
return await cache.get(id);
|
|
4
6
|
}
|
package/dist/server/db.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { getConfig } from '@axium/core';
|
|
2
2
|
import { database } from '@axium/server/database';
|
|
3
3
|
import { error } from '@axium/server/requests';
|
|
4
|
+
import { addObjectType as addSyncObjectType } from '@axium/server/sync';
|
|
4
5
|
import { jsonArrayFrom } from 'kysely/helpers/postgres';
|
|
5
6
|
import * as contact from '../common.js';
|
|
6
7
|
export function contactsFields(eb) {
|
|
@@ -15,6 +16,9 @@ export function contactsFields(eb) {
|
|
|
15
16
|
}
|
|
16
17
|
return [select('addresses'), select('emails'), select('phones'), select('dates'), select('relationships'), select('custom')];
|
|
17
18
|
}
|
|
19
|
+
addSyncObjectType('contacts', {
|
|
20
|
+
queryAdditions: qb => qb.select(contactsFields),
|
|
21
|
+
});
|
|
18
22
|
/**
|
|
19
23
|
* Try to automatically link the contact to a user
|
|
20
24
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@axium/contacts",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"author": "James Prevett <axium@jamespre.dev>",
|
|
5
5
|
"description": "Contacts for Axium",
|
|
6
6
|
"funding": {
|
|
@@ -38,9 +38,9 @@
|
|
|
38
38
|
"build": "tsc"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
|
-
"@axium/client": ">=0.
|
|
42
|
-
"@axium/core": ">=0.
|
|
43
|
-
"@axium/server": ">=0.
|
|
41
|
+
"@axium/client": ">=0.28.0",
|
|
42
|
+
"@axium/core": ">=0.32.0",
|
|
43
|
+
"@axium/server": ">=0.47.0",
|
|
44
44
|
"@sveltejs/kit": "^2.27.3",
|
|
45
45
|
"kysely": "^0.28.15",
|
|
46
46
|
"utilium": "^3.0.0"
|