@octane-xplat/contacts 0.18.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 +3 -25
- package/package.json +87 -94
- package/src/contacts.macos.ts +377 -13
- package/src/contacts.ts +235 -201
- package/src/contacts.web.ts +41 -33
- package/src/contacts.windows.ts +12 -9
- package/src/types.ts +116 -66
- package/types/generated/.tsrx-typegen-manifest.json +0 -6
- package/types/generated/contacts.d.ts +1 -0
- package/types/generated/types.d.ts +50 -0
- package/LICENSE +0 -21
- package/types/generated/contacts.linux.d.ts +0 -1
- package/types/generated/contacts.macos.d.ts +0 -2
- package/types/generated/contacts.web.d.ts +0 -2
- package/types/generated/contacts.windows.d.ts +0 -2
- package/types/generated/index.macos.d.ts +0 -2
- package/types/generated/index.web.d.ts +0 -2
package/src/types.ts
CHANGED
|
@@ -1,97 +1,147 @@
|
|
|
1
|
+
/** Coarse permission answer; unsupported means no contacts/permission path. */
|
|
1
2
|
export type PermissionResult = 'granted' | 'denied' | 'unsupported'
|
|
2
3
|
|
|
3
4
|
/** Fields the app asks for — a superset is fetched natively, this selects
|
|
4
5
|
* which members are populated on the returned Contact. */
|
|
5
6
|
export type ContactField =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
7
|
+
| 'name'
|
|
8
|
+
| 'emails'
|
|
9
|
+
| 'phoneNumbers'
|
|
10
|
+
| 'addresses'
|
|
11
|
+
| 'urls'
|
|
12
|
+
| 'company'
|
|
13
|
+
| 'note'
|
|
14
|
+
| 'image'
|
|
15
|
+
| 'nickname'
|
|
15
16
|
|
|
17
|
+
/** One labeled email field. */
|
|
16
18
|
export interface ContactEmail {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
20
|
+
label?: string
|
|
21
|
+
/** Email address value. */
|
|
22
|
+
email: string
|
|
19
23
|
}
|
|
20
24
|
|
|
25
|
+
/** One labeled phone field. */
|
|
21
26
|
export interface ContactPhone {
|
|
22
|
-
|
|
23
|
-
|
|
27
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
28
|
+
label?: string
|
|
29
|
+
/** Phone number string as stored. */
|
|
30
|
+
number: string
|
|
24
31
|
}
|
|
25
32
|
|
|
33
|
+
/** One labeled postal address. */
|
|
26
34
|
export interface ContactAddress {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
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
|
|
33
47
|
}
|
|
34
48
|
|
|
49
|
+
/** One labeled URL field. */
|
|
35
50
|
export interface ContactUrl {
|
|
36
|
-
|
|
37
|
-
|
|
51
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
52
|
+
label?: string
|
|
53
|
+
/** URL value. */
|
|
54
|
+
url: string
|
|
38
55
|
}
|
|
39
56
|
|
|
57
|
+
/** A stored contact record. */
|
|
40
58
|
export interface Contact {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
|
59
89
|
}
|
|
60
90
|
|
|
91
|
+
/** Contact fields for add/update — no store id. */
|
|
61
92
|
export interface NewContact {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
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
|
|
71
111
|
}
|
|
72
112
|
|
|
113
|
+
/** Paging options for getAll(). */
|
|
73
114
|
export interface GetContactsOptions {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
|
80
123
|
}
|
|
81
124
|
|
|
125
|
+
/** System address-book facade; false supported off mobile. */
|
|
82
126
|
export interface Contacts {
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
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>
|
|
95
145
|
}
|
|
96
146
|
|
|
97
147
|
export declare const contacts: Contacts
|
|
@@ -1,78 +1,128 @@
|
|
|
1
|
+
/** Coarse permission answer; unsupported means no contacts/permission path. */
|
|
1
2
|
export type PermissionResult = 'granted' | 'denied' | 'unsupported';
|
|
2
3
|
/** Fields the app asks for — a superset is fetched natively, this selects
|
|
3
4
|
* which members are populated on the returned Contact. */
|
|
4
5
|
export type ContactField = 'name' | 'emails' | 'phoneNumbers' | 'addresses' | 'urls' | 'company' | 'note' | 'image' | 'nickname';
|
|
6
|
+
/** One labeled email field. */
|
|
5
7
|
export interface ContactEmail {
|
|
8
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
6
9
|
label?: string;
|
|
10
|
+
/** Email address value. */
|
|
7
11
|
email: string;
|
|
8
12
|
}
|
|
13
|
+
/** One labeled phone field. */
|
|
9
14
|
export interface ContactPhone {
|
|
15
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
10
16
|
label?: string;
|
|
17
|
+
/** Phone number string as stored. */
|
|
11
18
|
number: string;
|
|
12
19
|
}
|
|
20
|
+
/** One labeled postal address. */
|
|
13
21
|
export interface ContactAddress {
|
|
22
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
14
23
|
label?: string;
|
|
24
|
+
/** Street line(s). */
|
|
15
25
|
street?: string;
|
|
26
|
+
/** City. */
|
|
16
27
|
city?: string;
|
|
28
|
+
/** State/province region. */
|
|
17
29
|
region?: string;
|
|
30
|
+
/** Postal/ZIP code. */
|
|
18
31
|
postalCode?: string;
|
|
32
|
+
/** Country name or code. */
|
|
19
33
|
country?: string;
|
|
20
34
|
}
|
|
35
|
+
/** One labeled URL field. */
|
|
21
36
|
export interface ContactUrl {
|
|
37
|
+
/** Free-form label (home/work/custom) as stored. */
|
|
22
38
|
label?: string;
|
|
39
|
+
/** URL value. */
|
|
23
40
|
url: string;
|
|
24
41
|
}
|
|
42
|
+
/** A stored contact record. */
|
|
25
43
|
export interface Contact {
|
|
44
|
+
/** Store-assigned contact id. */
|
|
26
45
|
id: string;
|
|
27
46
|
/** Display name — falls back to composed given/family when the store
|
|
28
47
|
* lacks a display string. */
|
|
29
48
|
name: string;
|
|
49
|
+
/** Given name. */
|
|
30
50
|
firstName?: string;
|
|
51
|
+
/** Middle name(s). */
|
|
31
52
|
middleName?: string;
|
|
53
|
+
/** Family name. */
|
|
32
54
|
lastName?: string;
|
|
55
|
+
/** Nickname. */
|
|
33
56
|
nickname?: string;
|
|
57
|
+
/** Email addresses with labels. */
|
|
34
58
|
emails?: ContactEmail[];
|
|
59
|
+
/** Phone numbers with labels. */
|
|
35
60
|
phoneNumbers?: ContactPhone[];
|
|
61
|
+
/** Postal addresses with labels. */
|
|
36
62
|
addresses?: ContactAddress[];
|
|
63
|
+
/** Associated URLs with labels. */
|
|
37
64
|
urls?: ContactUrl[];
|
|
65
|
+
/** Organization name. */
|
|
38
66
|
company?: string;
|
|
67
|
+
/** Role within the organization. */
|
|
39
68
|
jobTitle?: string;
|
|
69
|
+
/** Free-text note field. */
|
|
40
70
|
note?: string;
|
|
41
71
|
/** Platform image reference when 'image' was requested — a file path or
|
|
42
72
|
* data reference; shape is platform-dependent. */
|
|
43
73
|
image?: unknown;
|
|
44
74
|
}
|
|
75
|
+
/** Contact fields for add/update — no store id. */
|
|
45
76
|
export interface NewContact {
|
|
77
|
+
/** Given name. */
|
|
46
78
|
firstName?: string;
|
|
79
|
+
/** Middle name(s). */
|
|
47
80
|
middleName?: string;
|
|
81
|
+
/** Family name. */
|
|
48
82
|
lastName?: string;
|
|
83
|
+
/** Nickname. */
|
|
49
84
|
nickname?: string;
|
|
85
|
+
/** Email addresses with labels. */
|
|
50
86
|
emails?: ContactEmail[];
|
|
87
|
+
/** Phone numbers with labels. */
|
|
51
88
|
phoneNumbers?: ContactPhone[];
|
|
89
|
+
/** Organization name. */
|
|
52
90
|
company?: string;
|
|
91
|
+
/** Role within the organization. */
|
|
53
92
|
jobTitle?: string;
|
|
93
|
+
/** Free-text note field. */
|
|
54
94
|
note?: string;
|
|
55
95
|
}
|
|
96
|
+
/** Paging options for getAll(). */
|
|
56
97
|
export interface GetContactsOptions {
|
|
57
98
|
/** Restrict which members are populated (all fetched by default). */
|
|
58
99
|
fields?: ContactField[];
|
|
59
100
|
/** Client-side sort — the native stores return an unspecified order. */
|
|
60
101
|
sort?: 'firstName' | 'lastName' | 'none';
|
|
102
|
+
/** Max contacts per page. */
|
|
61
103
|
pageSize?: number;
|
|
104
|
+
/** Start offset into the result set. */
|
|
62
105
|
pageOffset?: number;
|
|
63
106
|
}
|
|
107
|
+
/** System address-book facade; false supported off mobile. */
|
|
64
108
|
export interface Contacts {
|
|
109
|
+
/** Whether the system address book is reachable on this target — false off mobile. */
|
|
65
110
|
readonly supported: boolean;
|
|
66
111
|
/** Ensure the contacts permission without prompting twice — returns the
|
|
67
112
|
* post-request grant state, 'unsupported' when the store can't be reached. */
|
|
68
113
|
ensure(): Promise<PermissionResult>;
|
|
114
|
+
/** Fetch contacts in pages. */
|
|
69
115
|
getAll(options?: GetContactsOptions): Promise<Contact[]>;
|
|
116
|
+
/** Substring search over display names. */
|
|
70
117
|
getByName(predicate: string, fields?: ContactField[]): Promise<Contact[]>;
|
|
71
118
|
/** iOS: direct id fetch. Android: the plugin ships no id lookup, so this
|
|
72
119
|
* fetches the full store and filters — read-all cost, call sparingly. */
|
|
73
120
|
getById(id: string, fields?: ContactField[]): Promise<Contact | null>;
|
|
121
|
+
/** Insert a contact; resolves the store-assigned id. */
|
|
74
122
|
add(contact: NewContact): Promise<string>;
|
|
123
|
+
/** Patch fields of an existing contact by id. */
|
|
75
124
|
update(id: string, contact: NewContact): Promise<string>;
|
|
125
|
+
/** Delete a contact by id. */
|
|
76
126
|
remove(id: string): Promise<void>;
|
|
77
127
|
}
|
|
78
128
|
export declare const contacts: Contacts;
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Alec Larson
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in
|
|
13
|
-
all copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
-
THE SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { contacts } from './contacts.web.js';
|