nylas 8.0.4 → 8.1.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.
Files changed (41) hide show
  1. package/lib/cjs/models/agentLists.js +2 -0
  2. package/lib/cjs/models/index.js +3 -0
  3. package/lib/cjs/models/policies.js +2 -0
  4. package/lib/cjs/models/rules.js +2 -0
  5. package/lib/cjs/nylas.js +6 -0
  6. package/lib/cjs/resources/agentLists.js +99 -0
  7. package/lib/cjs/resources/attachments.js +28 -0
  8. package/lib/cjs/resources/availability.js +19 -0
  9. package/lib/cjs/resources/policies.js +66 -0
  10. package/lib/cjs/resources/rules.js +79 -0
  11. package/lib/cjs/resources/scheduler.js +2 -0
  12. package/lib/cjs/version.js +1 -1
  13. package/lib/esm/models/agentLists.js +1 -0
  14. package/lib/esm/models/index.js +3 -0
  15. package/lib/esm/models/policies.js +1 -0
  16. package/lib/esm/models/rules.js +1 -0
  17. package/lib/esm/nylas.js +6 -0
  18. package/lib/esm/resources/agentLists.js +95 -0
  19. package/lib/esm/resources/attachments.js +28 -0
  20. package/lib/esm/resources/availability.js +15 -0
  21. package/lib/esm/resources/policies.js +62 -0
  22. package/lib/esm/resources/rules.js +75 -0
  23. package/lib/esm/resources/scheduler.js +2 -0
  24. package/lib/esm/version.js +1 -1
  25. package/lib/types/models/agentLists.d.ts +123 -0
  26. package/lib/types/models/attachments.d.ts +81 -0
  27. package/lib/types/models/auth.d.ts +1 -1
  28. package/lib/types/models/grants.d.ts +37 -2
  29. package/lib/types/models/index.d.ts +3 -0
  30. package/lib/types/models/policies.d.ts +167 -0
  31. package/lib/types/models/rules.d.ts +318 -0
  32. package/lib/types/models/scheduler.d.ts +20 -0
  33. package/lib/types/nylas.d.ts +15 -0
  34. package/lib/types/resources/agentLists.d.ts +108 -0
  35. package/lib/types/resources/attachments.d.ts +31 -1
  36. package/lib/types/resources/availability.d.ts +18 -0
  37. package/lib/types/resources/policies.d.ts +69 -0
  38. package/lib/types/resources/rules.d.ts +82 -0
  39. package/lib/types/resources/scheduler.d.ts +2 -0
  40. package/lib/types/version.d.ts +1 -1
  41. package/package.json +1 -1
@@ -0,0 +1,75 @@
1
+ import { makePathParams } from '../utils.js';
2
+ import { Resource } from './resource.js';
3
+ /**
4
+ * Nylas Agent Account Rules API
5
+ *
6
+ * Rules define inbound and outbound filtering logic for Agent Accounts.
7
+ */
8
+ export class Rules extends Resource {
9
+ /**
10
+ * Return all rules.
11
+ * @return The list of rules.
12
+ */
13
+ list({ queryParams, overrides, } = {}) {
14
+ return super._list({
15
+ queryParams,
16
+ path: makePathParams('/v3/rules', {}),
17
+ overrides,
18
+ });
19
+ }
20
+ /**
21
+ * Return a rule.
22
+ * @return The rule.
23
+ */
24
+ find({ ruleId, overrides, }) {
25
+ return super._find({
26
+ path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
27
+ overrides,
28
+ });
29
+ }
30
+ /**
31
+ * Create a rule.
32
+ * @return The created rule.
33
+ */
34
+ create({ requestBody, overrides, }) {
35
+ return super._create({
36
+ path: makePathParams('/v3/rules', {}),
37
+ requestBody,
38
+ overrides,
39
+ });
40
+ }
41
+ /**
42
+ * Update a rule.
43
+ * @return The updated rule.
44
+ */
45
+ update({ ruleId, requestBody, overrides, }) {
46
+ return super._update({
47
+ path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
48
+ requestBody,
49
+ overrides,
50
+ });
51
+ }
52
+ /**
53
+ * Delete a rule.
54
+ * @return The deletion response.
55
+ */
56
+ destroy({ ruleId, overrides, }) {
57
+ return super._destroy({
58
+ path: makePathParams('/v3/rules/{ruleId}', { ruleId }),
59
+ overrides,
60
+ });
61
+ }
62
+ /**
63
+ * Return rule evaluation records for a grant.
64
+ * @return The list of rule evaluation records.
65
+ */
66
+ listEvaluations({ identifier, queryParams, overrides, }) {
67
+ return super._list({
68
+ queryParams,
69
+ path: makePathParams('/v3/grants/{identifier}/rule-evaluations', {
70
+ identifier,
71
+ }),
72
+ overrides,
73
+ });
74
+ }
75
+ }
@@ -1,10 +1,12 @@
1
1
  import { Configurations } from './configurations.js';
2
2
  import { Sessions } from './sessions.js';
3
3
  import { Bookings } from './bookings.js';
4
+ import { SchedulerAvailability } from './availability.js';
4
5
  export class Scheduler {
5
6
  constructor(apiClient) {
6
7
  this.configurations = new Configurations(apiClient);
7
8
  this.bookings = new Bookings(apiClient);
8
9
  this.sessions = new Sessions(apiClient);
10
+ this.availability = new SchedulerAvailability(apiClient);
9
11
  }
10
12
  }
@@ -1,2 +1,2 @@
1
1
  // This file is generated by scripts/exportVersion.js
2
- export const SDK_VERSION = '8.0.4';
2
+ export const SDK_VERSION = '8.1.0';
@@ -0,0 +1,123 @@
1
+ import { ListQueryParams } from './listQueryParams.js';
2
+ /**
3
+ * Type for values a Nylas Agent Account list can hold.
4
+ */
5
+ export type AgentListType = 'domain' | 'tld' | 'address';
6
+ /**
7
+ * Interface representing a Nylas Agent Account list.
8
+ */
9
+ export interface AgentList {
10
+ /**
11
+ * Globally unique identifier for the list.
12
+ */
13
+ id: string;
14
+ /**
15
+ * Human-readable name for the list.
16
+ */
17
+ name: string;
18
+ /**
19
+ * Optional description of the list's purpose.
20
+ */
21
+ description?: string;
22
+ /**
23
+ * The kind of values the list holds.
24
+ */
25
+ type: AgentListType;
26
+ /**
27
+ * Number of items currently in the list.
28
+ */
29
+ itemsCount?: number;
30
+ /**
31
+ * The ID of the application that owns the list.
32
+ */
33
+ applicationId?: string;
34
+ /**
35
+ * The ID of the Nylas organization that owns the list.
36
+ */
37
+ organizationId?: string;
38
+ /**
39
+ * Unix timestamp when the list was created.
40
+ */
41
+ createdAt?: number;
42
+ /**
43
+ * Unix timestamp when the list was last updated.
44
+ */
45
+ updatedAt?: number;
46
+ }
47
+ /**
48
+ * Interface representing an item in a Nylas Agent Account list.
49
+ */
50
+ export interface AgentListItem {
51
+ /**
52
+ * Globally unique identifier for the list item.
53
+ */
54
+ id: string;
55
+ /**
56
+ * The ID of the list that contains the item.
57
+ */
58
+ listId: string;
59
+ /**
60
+ * The normalized list item value.
61
+ */
62
+ value: string;
63
+ /**
64
+ * Unix timestamp when the item was added to the list.
65
+ */
66
+ createdAt?: number;
67
+ }
68
+ /**
69
+ * Interface representing a request to create a Nylas Agent Account list.
70
+ */
71
+ export interface CreateAgentListRequest {
72
+ /**
73
+ * Human-readable name for the list.
74
+ */
75
+ name: string;
76
+ /**
77
+ * Optional description of the list's purpose.
78
+ */
79
+ description?: string;
80
+ /**
81
+ * The kind of values the list holds.
82
+ */
83
+ type: AgentListType;
84
+ }
85
+ /**
86
+ * Interface representing a request to update a Nylas Agent Account list.
87
+ */
88
+ export interface UpdateAgentListRequest {
89
+ /**
90
+ * Human-readable name for the list.
91
+ */
92
+ name?: string;
93
+ /**
94
+ * Optional description of the list's purpose.
95
+ */
96
+ description?: string;
97
+ }
98
+ /**
99
+ * Interface representing a request to add items to a Nylas Agent Account list.
100
+ */
101
+ export interface AddAgentListItemsRequest {
102
+ /**
103
+ * Values to add to the list.
104
+ */
105
+ items: string[];
106
+ }
107
+ /**
108
+ * Interface representing a request to remove items from a Nylas Agent Account list.
109
+ */
110
+ export interface RemoveAgentListItemsRequest {
111
+ /**
112
+ * Values to remove from the list.
113
+ */
114
+ items: string[];
115
+ }
116
+ /**
117
+ * Interface representing query parameters for listing Agent Account lists.
118
+ */
119
+ export type ListAgentListsQueryParams = ListQueryParams;
120
+ /**
121
+ * Interface representing query parameters for listing Agent Account list items.
122
+ */
123
+ export type ListAgentListItemsQueryParams = ListQueryParams;
@@ -65,4 +65,85 @@ export interface FindAttachmentQueryParams {
65
65
  * Interface representing of the query parameters for downloading an attachment.
66
66
  */
67
67
  export type DownloadAttachmentQueryParams = FindAttachmentQueryParams;
68
+ /**
69
+ * Status of a large-attachment upload session.
70
+ * @see https://developer.nylas.com/docs/v3/email/send-large-attachments/
71
+ */
72
+ export type AttachmentUploadSessionStatusType = 'uploading' | 'ready' | 'failed' | 'expired';
73
+ /**
74
+ * Request body for creating a large-attachment upload session.
75
+ * Sent to the API as snake_case (`content_type`, etc.).
76
+ */
77
+ export interface CreateAttachmentUploadSessionRequest {
78
+ /**
79
+ * The name of the file as it will appear in the email.
80
+ */
81
+ filename: string;
82
+ /**
83
+ * MIME type of the file (for example, `application/pdf`).
84
+ */
85
+ contentType: string;
86
+ /**
87
+ * Expected file size in bytes. Recommended — Nylas validates the upload matches at completion.
88
+ * Maximum: 157286400 (150 MB).
89
+ */
90
+ size?: number;
91
+ }
92
+ /**
93
+ * Upload session returned when creating a large-attachment upload session.
94
+ * Corresponds to the `data` object in the create-session API response.
95
+ */
96
+ export interface AttachmentUploadSession {
97
+ /**
98
+ * Unique identifier for the upload session. Use when completing the session and when referencing the attachment in send or draft.
99
+ */
100
+ attachmentId: string;
101
+ /**
102
+ * HTTP method to use when uploading to {@link AttachmentUploadSession.url}. Always `PUT`.
103
+ */
104
+ method: string;
105
+ /**
106
+ * Pre-signed URL to upload file bytes (no Nylas auth header on this request).
107
+ */
108
+ url: string;
109
+ /**
110
+ * Headers to include when uploading to {@link AttachmentUploadSession.url}.
111
+ */
112
+ headers: Record<string, string>;
113
+ /**
114
+ * When the upload session expires (RFC 3339).
115
+ */
116
+ expiresAt: string;
117
+ /**
118
+ * Maximum allowed file size in bytes.
119
+ */
120
+ maxSize: number;
121
+ /**
122
+ * Expected file size in bytes, echoing the request. `0` if `size` was omitted on creation.
123
+ */
124
+ size: number;
125
+ /**
126
+ * MIME type of the file.
127
+ */
128
+ contentType: string;
129
+ /**
130
+ * Name of the file.
131
+ */
132
+ filename: string;
133
+ /**
134
+ * The grant ID the upload session belongs to.
135
+ */
136
+ grantId: string;
137
+ }
138
+ /**
139
+ * Result of completing an upload session (`data` in the complete API response).
140
+ */
141
+ export interface AttachmentUploadSessionComplete {
142
+ attachmentId: string;
143
+ grantId: string;
144
+ /**
145
+ * After successful completion, typically `ready`.
146
+ */
147
+ status: AttachmentUploadSessionStatusType;
148
+ }
68
149
  export {};
@@ -5,7 +5,7 @@ type AccessType = 'online' | 'offline';
5
5
  /**
6
6
  * Type for the different OAuth providers Nylas supports.
7
7
  */
8
- export type Provider = 'google' | 'imap' | 'microsoft' | 'icloud' | 'virtual-calendar' | 'ews' | 'zoom';
8
+ export type Provider = 'google' | 'imap' | 'microsoft' | 'icloud' | 'virtual-calendar' | 'ews' | 'zoom' | 'nylas';
9
9
  /**
10
10
  * Configuration for generating a URL for OAuth 2.0 authentication.
11
11
  */
@@ -64,11 +64,11 @@ export interface Grant {
64
64
  /**
65
65
  * Interface representing a request to create a grant.
66
66
  */
67
- export interface CreateGrantRequest {
67
+ export interface CreateCustomAuthenticationGrantRequest {
68
68
  /**
69
69
  * OAuth provider
70
70
  */
71
- provider: Provider;
71
+ provider: Exclude<Provider, 'nylas'>;
72
72
  /**
73
73
  * Settings required by provider.
74
74
  * Can include 'credentialId' to specify which credential to use for authentication.
@@ -90,6 +90,41 @@ export interface CreateGrantRequest {
90
90
  */
91
91
  scope?: string[];
92
92
  }
93
+ /**
94
+ * Interface representing settings to create a Nylas Agent Account grant.
95
+ */
96
+ export interface CreateAgentAccountSettings {
97
+ /**
98
+ * The Agent Account email address.
99
+ */
100
+ email: string;
101
+ /**
102
+ * A policy to apply to this grant.
103
+ */
104
+ policyId?: string;
105
+ /**
106
+ * Password for IMAP and SMTP-submission access.
107
+ */
108
+ appPassword?: string;
109
+ }
110
+ /**
111
+ * Interface representing a request to create a Nylas Agent Account grant.
112
+ */
113
+ export interface CreateAgentAccountRequest {
114
+ /**
115
+ * The Nylas provider provisions an Agent Account.
116
+ */
117
+ provider: 'nylas';
118
+ /**
119
+ * Settings required to provision the Agent Account.
120
+ */
121
+ settings: CreateAgentAccountSettings;
122
+ /**
123
+ * Optional state value to return to developer's website after authentication flow is completed.
124
+ */
125
+ state?: string;
126
+ }
127
+ export type CreateGrantRequest = CreateCustomAuthenticationGrantRequest | CreateAgentAccountRequest;
93
128
  /**
94
129
  * Interface representing a request to update a grant.
95
130
  */
@@ -1,3 +1,4 @@
1
+ export * from './agentLists.js';
1
2
  export * from './applicationDetails.js';
2
3
  export * from './attachments.js';
3
4
  export * from './auth.js';
@@ -15,8 +16,10 @@ export * from './grants.js';
15
16
  export * from './listQueryParams.js';
16
17
  export * from './messages.js';
17
18
  export * from './notetakers.js';
19
+ export * from './policies.js';
18
20
  export * from './redirectUri.js';
19
21
  export * from './response.js';
22
+ export * from './rules.js';
20
23
  export * from './scheduler.js';
21
24
  export * from './smartCompose.js';
22
25
  export * from './threads.js';
@@ -0,0 +1,167 @@
1
+ import { ListQueryParams } from './listQueryParams.js';
2
+ /**
3
+ * Interface representing operational limits for Nylas Agent Accounts.
4
+ */
5
+ export interface PolicyLimits {
6
+ /**
7
+ * Maximum size, in bytes, for a single attachment.
8
+ */
9
+ limitAttachmentSizeLimit?: number;
10
+ /**
11
+ * Maximum number of attachments allowed on a single message.
12
+ */
13
+ limitAttachmentCountLimit?: number;
14
+ /**
15
+ * Allowed attachment MIME types.
16
+ */
17
+ limitAttachmentAllowedTypes?: string[];
18
+ /**
19
+ * Maximum total MIME size, in bytes, for a single message.
20
+ */
21
+ limitSizeTotalMime?: number;
22
+ /**
23
+ * Maximum total storage, in bytes, for each inbox using this policy.
24
+ */
25
+ limitStorageTotal?: number;
26
+ /**
27
+ * Maximum number of messages each grant can send per day.
28
+ */
29
+ limitCountDailyMessagePerGrant?: number;
30
+ /**
31
+ * How long, in days, to retain messages in the inbox.
32
+ */
33
+ limitInboxRetentionPeriod?: number;
34
+ /**
35
+ * How long, in days, to retain messages in the spam folder.
36
+ */
37
+ limitSpamRetentionPeriod?: number;
38
+ }
39
+ /**
40
+ * Interface representing spam detection settings for Nylas Agent Accounts.
41
+ */
42
+ export interface PolicySpamDetection {
43
+ /**
44
+ * Whether to enable DNS-based block list checking on inbound messages.
45
+ */
46
+ useListDnsbl?: boolean;
47
+ /**
48
+ * Whether to enable header anomaly detection on inbound messages.
49
+ */
50
+ useHeaderAnomalyDetection?: boolean;
51
+ /**
52
+ * Spam detection sensitivity. Higher values mark more messages as spam.
53
+ */
54
+ spamSensitivity?: number;
55
+ }
56
+ /**
57
+ * Interface representing miscellaneous policy options.
58
+ */
59
+ export interface PolicyOptions {
60
+ /**
61
+ * Extra folders to create for inboxes that use this policy.
62
+ */
63
+ additionalFolders?: string[];
64
+ /**
65
+ * Whether to enable CIDR-based email aliasing for inboxes that use this policy.
66
+ */
67
+ useCidrAliasing?: boolean;
68
+ }
69
+ /**
70
+ * Interface representing a Nylas Agent Account policy.
71
+ */
72
+ export interface Policy {
73
+ /**
74
+ * Globally unique identifier for the policy.
75
+ */
76
+ id: string;
77
+ /**
78
+ * Human-readable name for the policy.
79
+ */
80
+ name: string;
81
+ /**
82
+ * The ID of the application that owns the policy.
83
+ */
84
+ applicationId?: string;
85
+ /**
86
+ * The ID of the Nylas organization that owns the policy.
87
+ */
88
+ organizationId?: string;
89
+ /**
90
+ * Miscellaneous options for inboxes that use this policy.
91
+ */
92
+ options?: PolicyOptions;
93
+ /**
94
+ * Operational limits enforced for inboxes that use this policy.
95
+ */
96
+ limits?: PolicyLimits;
97
+ /**
98
+ * Rule IDs linked to this policy for inbound processing.
99
+ */
100
+ rules?: string[];
101
+ /**
102
+ * Spam detection configuration for inboxes that use this policy.
103
+ */
104
+ spamDetection?: PolicySpamDetection;
105
+ /**
106
+ * Unix timestamp when the policy was created.
107
+ */
108
+ createdAt?: number;
109
+ /**
110
+ * Unix timestamp when the policy was last updated.
111
+ */
112
+ updatedAt?: number;
113
+ }
114
+ /**
115
+ * Interface representing a request to create a Nylas Agent Account policy.
116
+ */
117
+ export interface CreatePolicyRequest {
118
+ /**
119
+ * Human-readable name for the policy.
120
+ */
121
+ name: string;
122
+ /**
123
+ * Miscellaneous options for inboxes that use this policy.
124
+ */
125
+ options?: PolicyOptions;
126
+ /**
127
+ * Operational limits enforced for inboxes that use this policy.
128
+ */
129
+ limits?: PolicyLimits;
130
+ /**
131
+ * Rule IDs to link to this policy for inbound processing.
132
+ */
133
+ rules?: string[];
134
+ /**
135
+ * Spam detection configuration for inboxes that use this policy.
136
+ */
137
+ spamDetection?: PolicySpamDetection;
138
+ }
139
+ /**
140
+ * Interface representing a request to update a Nylas Agent Account policy.
141
+ */
142
+ export interface UpdatePolicyRequest {
143
+ /**
144
+ * Human-readable name for the policy.
145
+ */
146
+ name?: string;
147
+ /**
148
+ * Miscellaneous options for inboxes that use this policy.
149
+ */
150
+ options?: PolicyOptions;
151
+ /**
152
+ * Operational limits enforced for inboxes that use this policy.
153
+ */
154
+ limits?: PolicyLimits;
155
+ /**
156
+ * Rule IDs to link to this policy for inbound processing.
157
+ */
158
+ rules?: string[];
159
+ /**
160
+ * Spam detection configuration for inboxes that use this policy.
161
+ */
162
+ spamDetection?: PolicySpamDetection;
163
+ }
164
+ /**
165
+ * Interface representing query parameters for listing policies.
166
+ */
167
+ export type ListPoliciesQueryParams = ListQueryParams;