@todoist/comms-sdk 5.1.1 → 5.1.2

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.
@@ -1,4 +1,5 @@
1
1
  import { v4 as uuid } from 'uuid';
2
+ import { BASE_URI } from './consts/endpoints.js';
2
3
  import { isSuccess, request } from './transport/http-client.js';
3
4
  import { CommsRequestError } from './types/errors.js';
4
5
  /**
@@ -110,6 +111,10 @@ export function getAuthStateParameter() {
110
111
  /**
111
112
  * Generates the authorization URL for the OAuth2 flow.
112
113
  *
114
+ * The URL carries the Comms API as its `resource` indicator
115
+ * ({@link https://datatracker.ietf.org/doc/html/rfc8707 RFC 8707}), so Todoist
116
+ * issues a token for Comms rather than a Todoist API token.
117
+ *
113
118
  * The `clientId` can be either a traditional client ID string (e.g. from
114
119
  * {@link registerClient}) or an HTTPS URL pointing to a client metadata document,
115
120
  * as defined in {@link https://drafts.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/ RFC draft-ietf-oauth-client-id-metadata-document}.
@@ -125,6 +130,7 @@ export function getAuthorizationUrl(clientId, scopes, state, redirectUri, baseUr
125
130
  response_type: 'code',
126
131
  scope,
127
132
  state,
133
+ resource: BASE_URI,
128
134
  });
129
135
  if (redirectUri) {
130
136
  params.append('redirect_uri', redirectUri);
@@ -1,5 +1,5 @@
1
1
  import { DEFAULT_API_VERSION } from '../types/api-version.js';
2
- const BASE_URI = 'https://comms.todoist.com';
2
+ export const BASE_URI = 'https://comms.todoist.com';
3
3
  /**
4
4
  * Gets the base URI for Comms API requests.
5
5
  *
@@ -137,6 +137,10 @@ export declare function getAuthStateParameter(): string;
137
137
  /**
138
138
  * Generates the authorization URL for the OAuth2 flow.
139
139
  *
140
+ * The URL carries the Comms API as its `resource` indicator
141
+ * ({@link https://datatracker.ietf.org/doc/html/rfc8707 RFC 8707}), so Todoist
142
+ * issues a token for Comms rather than a Todoist API token.
143
+ *
140
144
  * The `clientId` can be either a traditional client ID string (e.g. from
141
145
  * {@link registerClient}) or an HTTPS URL pointing to a client metadata document,
142
146
  * as defined in {@link https://drafts.ietf.org/doc/draft-ietf-oauth-client-id-metadata-document/ RFC draft-ietf-oauth-client-id-metadata-document}.
@@ -1,4 +1,5 @@
1
1
  import type { ApiVersion } from '../types/api-version.js';
2
+ export declare const BASE_URI = "https://comms.todoist.com";
2
3
  /**
3
4
  * Gets the base URI for Comms API requests.
4
5
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@todoist/comms-sdk",
3
- "version": "5.1.1",
3
+ "version": "5.1.2",
4
4
  "description": "A TypeScript wrapper for the Comms REST API.",
5
5
  "author": "Doist developers",
6
6
  "homepage": "https://doist.github.io/comms-sdk-typescript/",