@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/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
- | 'name'
7
- | 'emails'
8
- | 'phoneNumbers'
9
- | 'addresses'
10
- | 'urls'
11
- | 'company'
12
- | 'note'
13
- | 'image'
14
- | 'nickname'
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
- label?: string
18
- email: string
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
- label?: string
23
- number: string
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
- label?: string
28
- street?: string
29
- city?: string
30
- region?: string
31
- postalCode?: string
32
- country?: string
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
- label?: string
37
- url: string
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
- id: string
42
- /** Display name — falls back to composed given/family when the store
43
- * lacks a display string. */
44
- name: string
45
- firstName?: string
46
- middleName?: string
47
- lastName?: string
48
- nickname?: string
49
- emails?: ContactEmail[]
50
- phoneNumbers?: ContactPhone[]
51
- addresses?: ContactAddress[]
52
- urls?: ContactUrl[]
53
- company?: string
54
- jobTitle?: string
55
- note?: string
56
- /** Platform image reference when 'image' was requested — a file path or
57
- * data reference; shape is platform-dependent. */
58
- image?: unknown
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
- firstName?: string
63
- middleName?: string
64
- lastName?: string
65
- nickname?: string
66
- emails?: ContactEmail[]
67
- phoneNumbers?: ContactPhone[]
68
- company?: string
69
- jobTitle?: string
70
- note?: string
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
- /** Restrict which members are populated (all fetched by default). */
75
- fields?: ContactField[]
76
- /** Client-side sort — the native stores return an unspecified order. */
77
- sort?: 'firstName' | 'lastName' | 'none'
78
- pageSize?: number
79
- pageOffset?: number
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
- readonly supported: boolean
84
- /** Ensure the contacts permission without prompting twice — returns the
85
- * post-request grant state, 'unsupported' when the store can't be reached. */
86
- ensure(): Promise<PermissionResult>
87
- getAll(options?: GetContactsOptions): Promise<Contact[]>
88
- getByName(predicate: string, fields?: ContactField[]): Promise<Contact[]>
89
- /** iOS: direct id fetch. Android: the plugin ships no id lookup, so this
90
- * fetches the full store and filters — read-all cost, call sparingly. */
91
- getById(id: string, fields?: ContactField[]): Promise<Contact | null>
92
- add(contact: NewContact): Promise<string>
93
- update(id: string, contact: NewContact): Promise<string>
94
- remove(id: string): Promise<void>
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
@@ -2,13 +2,7 @@
2
2
  "version": 1,
3
3
  "files": [
4
4
  "contacts.d.ts",
5
- "contacts.linux.d.ts",
6
- "contacts.macos.d.ts",
7
- "contacts.web.d.ts",
8
- "contacts.windows.d.ts",
9
5
  "index.d.ts",
10
- "index.macos.d.ts",
11
- "index.web.d.ts",
12
6
  "types.d.ts"
13
7
  ]
14
8
  }
@@ -1,2 +1,3 @@
1
1
  import type { Contacts } from './types.js';
2
+ /** Contacts service — system address book. */
2
3
  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';
@@ -1,2 +0,0 @@
1
- import type { Contacts } from './types.js';
2
- export declare const contacts: Contacts;
@@ -1,2 +0,0 @@
1
- import type { Contacts } from './types.js';
2
- export declare const contacts: Contacts;
@@ -1,2 +0,0 @@
1
- import type { Contacts } from './types.js';
2
- export declare const contacts: Contacts;
@@ -1,2 +0,0 @@
1
- export * from './types.js';
2
- export { contacts } from './contacts.macos.js';
@@ -1,2 +0,0 @@
1
- export * from './types.js';
2
- export { contacts } from './contacts.web.js';