@octane-xplat/contacts 0.19.0 → 0.20.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/README.md +2 -35
- package/package.json +5 -5
- package/src/contacts.macos.ts +326 -287
- package/src/contacts.ts +234 -203
- package/src/contacts.web.ts +40 -35
- package/src/contacts.windows.ts +10 -9
- package/src/types.ts +107 -107
- package/types/generated/.tsrx-typegen-manifest.json +0 -6
- package/types/generated/contacts.linux.d.ts +0 -1
- package/types/generated/contacts.macos.d.ts +0 -3
- package/types/generated/contacts.web.d.ts +0 -3
- package/types/generated/contacts.windows.d.ts +0 -3
- package/types/generated/index.macos.d.ts +0 -2
- package/types/generated/index.web.d.ts +0 -2
package/src/types.ts
CHANGED
|
@@ -4,144 +4,144 @@ export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
|
4
4
|
/** Fields the app asks for — a superset is fetched natively, this selects
|
|
5
5
|
* which members are populated on the returned Contact. */
|
|
6
6
|
export type ContactField =
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
7
|
+
| 'name'
|
|
8
|
+
| 'emails'
|
|
9
|
+
| 'phoneNumbers'
|
|
10
|
+
| 'addresses'
|
|
11
|
+
| 'urls'
|
|
12
|
+
| 'company'
|
|
13
|
+
| 'note'
|
|
14
|
+
| 'image'
|
|
15
|
+
| 'nickname'
|
|
16
16
|
|
|
17
17
|
/** One labeled email field. */
|
|
18
18
|
export interface ContactEmail {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
19
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
20
|
+
label?: string
|
|
21
|
+
/** Email address value. */
|
|
22
|
+
email: string
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
/** One labeled phone field. */
|
|
26
26
|
export interface ContactPhone {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
28
|
+
label?: string
|
|
29
|
+
/** Phone number string as stored. */
|
|
30
|
+
number: string
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
/** One labeled postal address. */
|
|
34
34
|
export interface ContactAddress {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
35
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
36
|
+
label?: string
|
|
37
|
+
/** Street line(s). */
|
|
38
|
+
street?: string
|
|
39
|
+
/** City. */
|
|
40
|
+
city?: string
|
|
41
|
+
/** State/province region. */
|
|
42
|
+
region?: string
|
|
43
|
+
/** Postal/ZIP code. */
|
|
44
|
+
postalCode?: string
|
|
45
|
+
/** Country name or code. */
|
|
46
|
+
country?: string
|
|
47
47
|
}
|
|
48
48
|
|
|
49
49
|
/** One labeled URL field. */
|
|
50
50
|
export interface ContactUrl {
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
52
|
+
label?: string
|
|
53
|
+
/** URL value. */
|
|
54
|
+
url: string
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
/** A stored contact record. */
|
|
58
58
|
export interface Contact {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
59
|
+
/** Store-assigned contact id. */
|
|
60
|
+
id: string
|
|
61
|
+
/** Display name — falls back to composed given/family when the store
|
|
62
|
+
* lacks a display string. */
|
|
63
|
+
name: string
|
|
64
|
+
/** Given name. */
|
|
65
|
+
firstName?: string
|
|
66
|
+
/** Middle name(s). */
|
|
67
|
+
middleName?: string
|
|
68
|
+
/** Family name. */
|
|
69
|
+
lastName?: string
|
|
70
|
+
/** Nickname. */
|
|
71
|
+
nickname?: string
|
|
72
|
+
/** Email addresses with labels. */
|
|
73
|
+
emails?: ContactEmail[]
|
|
74
|
+
/** Phone numbers with labels. */
|
|
75
|
+
phoneNumbers?: ContactPhone[]
|
|
76
|
+
/** Postal addresses with labels. */
|
|
77
|
+
addresses?: ContactAddress[]
|
|
78
|
+
/** Associated URLs with labels. */
|
|
79
|
+
urls?: ContactUrl[]
|
|
80
|
+
/** Organization name. */
|
|
81
|
+
company?: string
|
|
82
|
+
/** Role within the organization. */
|
|
83
|
+
jobTitle?: string
|
|
84
|
+
/** Free-text note field. */
|
|
85
|
+
note?: string
|
|
86
|
+
/** Platform image reference when 'image' was requested — a file path or
|
|
87
|
+
* data reference; shape is platform-dependent. */
|
|
88
|
+
image?: unknown
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
/** Contact fields for add/update — no store id. */
|
|
92
92
|
export interface NewContact {
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
93
|
+
/** Given name. */
|
|
94
|
+
firstName?: string
|
|
95
|
+
/** Middle name(s). */
|
|
96
|
+
middleName?: string
|
|
97
|
+
/** Family name. */
|
|
98
|
+
lastName?: string
|
|
99
|
+
/** Nickname. */
|
|
100
|
+
nickname?: string
|
|
101
|
+
/** Email addresses with labels. */
|
|
102
|
+
emails?: ContactEmail[]
|
|
103
|
+
/** Phone numbers with labels. */
|
|
104
|
+
phoneNumbers?: ContactPhone[]
|
|
105
|
+
/** Organization name. */
|
|
106
|
+
company?: string
|
|
107
|
+
/** Role within the organization. */
|
|
108
|
+
jobTitle?: string
|
|
109
|
+
/** Free-text note field. */
|
|
110
|
+
note?: string
|
|
111
111
|
}
|
|
112
112
|
|
|
113
113
|
/** Paging options for getAll(). */
|
|
114
114
|
export interface GetContactsOptions {
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
115
|
+
/** Restrict which members are populated (all fetched by default). */
|
|
116
|
+
fields?: ContactField[]
|
|
117
|
+
/** Client-side sort — the native stores return an unspecified order. */
|
|
118
|
+
sort?: 'firstName' | 'lastName' | 'none'
|
|
119
|
+
/** Max contacts per page. */
|
|
120
|
+
pageSize?: number
|
|
121
|
+
/** Start offset into the result set. */
|
|
122
|
+
pageOffset?: number
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
/** System address-book facade; false supported off mobile. */
|
|
126
126
|
export interface Contacts {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
127
|
+
/** Whether the system address book is reachable on this target — false off mobile. */
|
|
128
|
+
readonly supported: boolean
|
|
129
|
+
/** Ensure the contacts permission without prompting twice — returns the
|
|
130
|
+
* post-request grant state, 'unsupported' when the store can't be reached. */
|
|
131
|
+
ensure(): Promise<PermissionResult>
|
|
132
|
+
/** Fetch contacts in pages. */
|
|
133
|
+
getAll(options?: GetContactsOptions): Promise<Contact[]>
|
|
134
|
+
/** Substring search over display names. */
|
|
135
|
+
getByName(predicate: string, fields?: ContactField[]): Promise<Contact[]>
|
|
136
|
+
/** iOS: direct id fetch. Android: the plugin ships no id lookup, so this
|
|
137
|
+
* fetches the full store and filters — read-all cost, call sparingly. */
|
|
138
|
+
getById(id: string, fields?: ContactField[]): Promise<Contact | null>
|
|
139
|
+
/** Insert a contact; resolves the store-assigned id. */
|
|
140
|
+
add(contact: NewContact): Promise<string>
|
|
141
|
+
/** Patch fields of an existing contact by id. */
|
|
142
|
+
update(id: string, contact: NewContact): Promise<string>
|
|
143
|
+
/** Delete a contact by id. */
|
|
144
|
+
remove(id: string): Promise<void>
|
|
145
145
|
}
|
|
146
146
|
|
|
147
147
|
export declare const contacts: Contacts
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { contacts } from './contacts.web.js';
|