@tellescope/sdk 1.4.44 → 1.4.48
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/lib/cjs/enduser.d.ts +124 -1
- package/lib/cjs/enduser.d.ts.map +1 -1
- package/lib/cjs/enduser.js +5 -0
- package/lib/cjs/enduser.js.map +1 -1
- package/lib/cjs/sdk.d.ts +141 -3
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +10 -3
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/session.d.ts +5 -2
- package/lib/cjs/session.d.ts.map +1 -1
- package/lib/cjs/session.js +10 -3
- package/lib/cjs/session.js.map +1 -1
- package/lib/cjs/tests/tests.js +6 -1
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/cjs/tests/webhooks_tests.js +3 -1
- package/lib/cjs/tests/webhooks_tests.js.map +1 -1
- package/lib/esm/enduser.d.ts +124 -1
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/enduser.js +5 -0
- package/lib/esm/enduser.js.map +1 -1
- package/lib/esm/sdk.d.ts +139 -1
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +10 -3
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/session.d.ts +5 -2
- package/lib/esm/session.d.ts.map +1 -1
- package/lib/esm/session.js +10 -3
- package/lib/esm/session.js.map +1 -1
- package/lib/esm/tests/tests.js +6 -1
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/esm/tests/webhooks_tests.js +3 -1
- package/lib/esm/tests/webhooks_tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +9 -9
- package/src/enduser.ts +16 -0
- package/src/sdk.ts +16 -3
- package/src/session.ts +12 -4
- package/src/tests/tests.ts +6 -1
- package/src/tests/webhooks_tests.ts +3 -2
package/src/sdk.ts
CHANGED
|
@@ -82,6 +82,8 @@ export const defaultQueries = <N extends keyof ClientModelForName>(
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
const loadDefaultQueries = (s: Session): { [K in keyof ClientModelForName] : APIQuery<K> } => ({
|
|
85
|
+
appointment_booking_pages: defaultQueries(s, 'appointment_booking_pages'),
|
|
86
|
+
appointment_locations: defaultQueries(s, 'appointment_locations'),
|
|
85
87
|
portal_customizations: defaultQueries(s, 'portal_customizations'),
|
|
86
88
|
endusers: defaultQueries(s, 'endusers'),
|
|
87
89
|
enduser_status_updates: defaultQueries(s, 'enduser_status_updates'),
|
|
@@ -124,7 +126,10 @@ const loadDefaultQueries = (s: Session): { [K in keyof ClientModelForName] : API
|
|
|
124
126
|
database_records: defaultQueries(s, 'database_records'),
|
|
125
127
|
care_plans: defaultQueries(s, 'care_plans'),
|
|
126
128
|
enduser_tasks: defaultQueries(s, 'enduser_tasks'),
|
|
127
|
-
role_based_access_permissions: defaultQueries(s, 'role_based_access_permissions')
|
|
129
|
+
role_based_access_permissions: defaultQueries(s, 'role_based_access_permissions'),
|
|
130
|
+
products: defaultQueries(s, 'products'),
|
|
131
|
+
purchase_credits: defaultQueries(s, 'purchase_credits'),
|
|
132
|
+
purchases: defaultQueries(s, 'purchases'),
|
|
128
133
|
})
|
|
129
134
|
|
|
130
135
|
type Queries = { [K in keyof ClientModelForName]: APIQuery<K> } & {
|
|
@@ -239,6 +244,12 @@ type Queries = { [K in keyof ClientModelForName]: APIQuery<K> } & {
|
|
|
239
244
|
disconnect_google_integration: (args: extractFields<CustomActions['integrations']['disconnect_google_integration']['parameters']>) => (
|
|
240
245
|
Promise<extractFields<CustomActions['integrations']['disconnect_google_integration']['returns']>>
|
|
241
246
|
),
|
|
247
|
+
generate_oauth2_auth_url: (args: extractFields<CustomActions['integrations']['generate_oauth2_auth_url']['parameters']>) => (
|
|
248
|
+
Promise<extractFields<CustomActions['integrations']['generate_oauth2_auth_url']['returns']>>
|
|
249
|
+
),
|
|
250
|
+
disconnect_oauth2_integration: (args: extractFields<CustomActions['integrations']['disconnect_oauth2_integration']['parameters']>) => (
|
|
251
|
+
Promise<extractFields<CustomActions['integrations']['disconnect_oauth2_integration']['returns']>>
|
|
252
|
+
),
|
|
242
253
|
refresh_oauth2_session: (args: extractFields<CustomActions['integrations']['refresh_oauth2_session']['parameters']>) => (
|
|
243
254
|
Promise<extractFields<CustomActions['integrations']['refresh_oauth2_session']['returns']>>
|
|
244
255
|
),
|
|
@@ -330,6 +341,8 @@ export class Session extends SessionManager {
|
|
|
330
341
|
queries.integrations.generate_google_auth_url = a => this._POST(`/v1/${schema.integrations.customActions.generate_google_auth_url.path}`, a)
|
|
331
342
|
queries.integrations.disconnect_google_integration = a => this._POST(`/v1/${schema.integrations.customActions.disconnect_google_integration.path}`, a)
|
|
332
343
|
queries.integrations.refresh_oauth2_session = a => this._POST(`/v1/${schema.integrations.customActions.refresh_oauth2_session.path}`, a)
|
|
344
|
+
queries.integrations.generate_oauth2_auth_url = a => this._POST(`/v1/${schema.integrations.customActions.generate_oauth2_auth_url.path}`, a)
|
|
345
|
+
queries.integrations.disconnect_oauth2_integration = a => this._POST(`/v1/${schema.integrations.customActions.disconnect_oauth2_integration.path}`, a)
|
|
333
346
|
|
|
334
347
|
queries.emails.sync_integrations = a => this._POST(`/v1/${schema.emails.customActions.sync_integrations.path}`, a)
|
|
335
348
|
|
|
@@ -341,9 +354,9 @@ export class Session extends SessionManager {
|
|
|
341
354
|
this.api = queries
|
|
342
355
|
}
|
|
343
356
|
|
|
344
|
-
_POST = async <A,R=void>(endpoint: string, args?: A, authenticated=true) => {
|
|
357
|
+
_POST = async <A,R=void>(endpoint: string, args?: A, authenticated=true, o?: { withCredentials?: boolean }) => {
|
|
345
358
|
await this.refresh_session_if_expiring_soon()
|
|
346
|
-
return await this.POST<A,R>(endpoint, args, authenticated)
|
|
359
|
+
return await this.POST<A,R>(endpoint, args, authenticated, o)
|
|
347
360
|
}
|
|
348
361
|
|
|
349
362
|
_GET = async <A,R=void>(endpoint: string, params?: A, authenticated=true) => {
|
package/src/session.ts
CHANGED
|
@@ -163,13 +163,14 @@ export class Session {
|
|
|
163
163
|
|
|
164
164
|
return err
|
|
165
165
|
}
|
|
166
|
-
POST = async <A,R=void>(endpoint: string, args?: A, authenticated=true) => {
|
|
166
|
+
POST = async <A,R=void>(endpoint: string, args?: A, authenticated=true, o?: { withCredentials?: boolean }) => {
|
|
167
167
|
try {
|
|
168
168
|
return (await axios.post(
|
|
169
169
|
this.host + endpoint,
|
|
170
170
|
{ ...args, ...this.getAuthInfo(authenticated) },
|
|
171
|
-
this.config
|
|
172
|
-
|
|
171
|
+
{ ...this.config, ...o }
|
|
172
|
+
)
|
|
173
|
+
).data as R
|
|
173
174
|
} catch(err) { throw await this.errorHandler(err) }
|
|
174
175
|
}
|
|
175
176
|
|
|
@@ -263,10 +264,17 @@ export class Session {
|
|
|
263
264
|
|
|
264
265
|
handle_events = ( handlers: { [index: string]: (a: any) => void } ) => {
|
|
265
266
|
for (const handler in handlers) this.ON(handler, handlers[handler])
|
|
267
|
+
|
|
268
|
+
// this.socket?.onAny((e, v) => console.log('got event', e, v))
|
|
269
|
+
// console.log('handle_events', Object.keys(handlers))
|
|
270
|
+
// for (const handler in handlers) this.ON(handler, r => console.log(r, handler))
|
|
266
271
|
}
|
|
267
272
|
|
|
268
273
|
unsubscribe = (roomIds: string[]) => this.EMIT('leave-rooms', { roomIds })
|
|
269
|
-
removeAllSocketListeners = () =>
|
|
274
|
+
removeAllSocketListeners = () => {
|
|
275
|
+
// console.log('removeAllSocketListeners')
|
|
276
|
+
this.socket?.removeAllListeners()
|
|
277
|
+
}
|
|
270
278
|
|
|
271
279
|
socket_log = (message: string) => {
|
|
272
280
|
console.log(`${this.type} ${this.userInfo.id} got socket message: ${message}`)
|
package/src/tests/tests.ts
CHANGED
|
@@ -1939,7 +1939,7 @@ const removeFromJourneyTests = async () => {
|
|
|
1939
1939
|
{ onResult: e => e.journeys?.[journey.id] !== 'Delayed Step' }
|
|
1940
1940
|
)
|
|
1941
1941
|
|
|
1942
|
-
await wait(undefined,
|
|
1942
|
+
await wait(undefined, 4 * TEST_DELAY) // wait long enough for automation to process and delay to pass
|
|
1943
1943
|
await async_test(
|
|
1944
1944
|
`Sequenced action triggered`,
|
|
1945
1945
|
() => sdk.api.endusers.getOne(enduser.id),
|
|
@@ -3306,6 +3306,11 @@ export const role_based_access_permissions_tests = async () => {
|
|
|
3306
3306
|
|
|
3307
3307
|
const NO_TEST = () => {}
|
|
3308
3308
|
const tests: { [K in keyof ClientModelForName]: () => void } = {
|
|
3309
|
+
products: NO_TEST,
|
|
3310
|
+
purchase_credits: NO_TEST,
|
|
3311
|
+
purchases: NO_TEST,
|
|
3312
|
+
appointment_locations: NO_TEST,
|
|
3313
|
+
appointment_booking_pages: NO_TEST,
|
|
3309
3314
|
role_based_access_permissions: role_based_access_permissions_tests,
|
|
3310
3315
|
chat_rooms: chat_room_tests,
|
|
3311
3316
|
automation_steps: automation_events_tests,
|
|
@@ -417,9 +417,10 @@ const run_tests = async () => {
|
|
|
417
417
|
{ onResult: _ => true }
|
|
418
418
|
)
|
|
419
419
|
await async_test(
|
|
420
|
-
'configure webhook (
|
|
420
|
+
'configure webhook (overwrite)',
|
|
421
421
|
() => sdk.api.webhooks.configure({ url: webhookURL, secret: TEST_SECRET }),
|
|
422
|
-
{
|
|
422
|
+
{ onResult: () => true }
|
|
423
|
+
// { shouldError: true, onError: e => e.message === "Only one webhook configuration is supported per organization. Use /update-webooks to update your configuration." }
|
|
423
424
|
)
|
|
424
425
|
await async_test(
|
|
425
426
|
'get initial webhook configuration',
|