@tellescope/sdk 1.4.24 → 1.4.27
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 +1 -0
- package/lib/cjs/enduser.d.ts.map +1 -1
- package/lib/cjs/sdk.d.ts +6 -2
- package/lib/cjs/sdk.d.ts.map +1 -1
- package/lib/cjs/sdk.js +1 -0
- package/lib/cjs/sdk.js.map +1 -1
- package/lib/cjs/session.d.ts +2 -0
- package/lib/cjs/session.d.ts.map +1 -1
- package/lib/cjs/session.js +8 -3
- package/lib/cjs/session.js.map +1 -1
- package/lib/cjs/tests/tests.d.ts.map +1 -1
- package/lib/cjs/tests/tests.js +37 -77
- package/lib/cjs/tests/tests.js.map +1 -1
- package/lib/cjs/tests/webhooks_tests.js +13 -7
- package/lib/cjs/tests/webhooks_tests.js.map +1 -1
- package/lib/esm/enduser.d.ts +0 -1
- package/lib/esm/enduser.d.ts.map +1 -1
- package/lib/esm/sdk.d.ts +7 -3
- package/lib/esm/sdk.d.ts.map +1 -1
- package/lib/esm/sdk.js +1 -0
- package/lib/esm/sdk.js.map +1 -1
- package/lib/esm/session.d.ts +1 -1
- package/lib/esm/session.d.ts.map +1 -1
- package/lib/esm/session.js +8 -3
- package/lib/esm/session.js.map +1 -1
- package/lib/esm/tests/tests.d.ts.map +1 -1
- package/lib/esm/tests/tests.js +37 -77
- package/lib/esm/tests/tests.js.map +1 -1
- package/lib/esm/tests/webhooks_tests.js +13 -7
- package/lib/esm/tests/webhooks_tests.js.map +1 -1
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -10
- package/src/sdk.ts +7 -0
- package/src/session.ts +11 -3
- package/src/tests/tests.ts +6 -55
- package/src/tests/webhooks_tests.ts +6 -0
package/src/session.ts
CHANGED
|
@@ -273,7 +273,13 @@ export class Session {
|
|
|
273
273
|
}
|
|
274
274
|
return
|
|
275
275
|
}
|
|
276
|
-
this.socket = io(
|
|
276
|
+
this.socket = io(
|
|
277
|
+
`${this.host}/${this.userInfo.businessId || this.businessId}`,
|
|
278
|
+
{
|
|
279
|
+
auth: { token: this.authToken },
|
|
280
|
+
transports: ['websocket'] // supporting polling requires sticky session at load balancer
|
|
281
|
+
}
|
|
282
|
+
);
|
|
277
283
|
}
|
|
278
284
|
authenticate_socket = () => {
|
|
279
285
|
this.initialize_socket()
|
|
@@ -302,9 +308,11 @@ export class Session {
|
|
|
302
308
|
// })
|
|
303
309
|
})
|
|
304
310
|
|
|
305
|
-
|
|
311
|
+
// no longer necessary
|
|
312
|
+
// this.socket.emit('authenticate', this.authToken)
|
|
306
313
|
}
|
|
307
314
|
|
|
315
|
+
/** @deprecated */
|
|
308
316
|
connectSocket = async () => {
|
|
309
317
|
if (this.socketAuthenticated) return
|
|
310
318
|
|
|
@@ -317,7 +325,7 @@ export class Session {
|
|
|
317
325
|
}
|
|
318
326
|
|
|
319
327
|
if (loopCount === 10) {
|
|
320
|
-
console.error(
|
|
328
|
+
console.error(`Failed to authenticate ${this.type} ${this.userInfo.id} after 10 attempts`)
|
|
321
329
|
return
|
|
322
330
|
}
|
|
323
331
|
|
package/src/tests/tests.ts
CHANGED
|
@@ -616,11 +616,12 @@ const enduser_tests = async (queries=sdk.api.endusers) => {
|
|
|
616
616
|
() => queries.updateOne(e1.id ?? '', { email: e2.email }),
|
|
617
617
|
{ shouldError: true, onError: () => true }
|
|
618
618
|
)
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
)
|
|
619
|
+
// no longer restricted
|
|
620
|
+
// await async_test(
|
|
621
|
+
// `update-enduser phone conflict`,
|
|
622
|
+
// () => queries.updateOne(e1.id ?? '', { phone: e2.phone }),
|
|
623
|
+
// { shouldError: true, onError: () => true }
|
|
624
|
+
// )
|
|
624
625
|
await async_test(
|
|
625
626
|
`update-enduser email and phone conflict`,
|
|
626
627
|
() => queries.updateOne(e1.id ?? '', { email: e2.email, phone: e2.phone }),
|
|
@@ -3140,56 +3141,6 @@ export const role_based_access_permissions_tests = async () => {
|
|
|
3140
3141
|
await sdkNonAdmin.authenticate(nonAdminEmail, nonAdminPassword) // to use new role, handle logout on role change
|
|
3141
3142
|
}
|
|
3142
3143
|
|
|
3143
|
-
const example_hep_record = async () => {
|
|
3144
|
-
await sdk.api.managed_content_records.createOne({
|
|
3145
|
-
"title": "Squats For Days (output.title)",
|
|
3146
|
-
"assignmentType": "Individual",
|
|
3147
|
-
"enduserId": "tellescope_enduser_id_here",
|
|
3148
|
-
"htmlContent": "",
|
|
3149
|
-
"textContent": "",
|
|
3150
|
-
"blocks": [
|
|
3151
|
-
{
|
|
3152
|
-
"type": "h1",
|
|
3153
|
-
"info": {
|
|
3154
|
-
"text": "Standing stability in partial squat with support from table/chair"
|
|
3155
|
-
}
|
|
3156
|
-
},
|
|
3157
|
-
{
|
|
3158
|
-
"type": "h2",
|
|
3159
|
-
"info": {
|
|
3160
|
-
"text": "Stand in front of a counter and hold onto the countertop.\nWhile maintaining your back straight and your hips above the level of your knees, slowly lower your body into a semi-squat position without leaning forward and keeping your heels in contact with the ground at all times."
|
|
3161
|
-
}
|
|
3162
|
-
},
|
|
3163
|
-
{
|
|
3164
|
-
"type": "html",
|
|
3165
|
-
"info": {
|
|
3166
|
-
"html": "<div>custom content synthesizing weight, repetition, frequency, duration, sets, etc.</div>"
|
|
3167
|
-
},
|
|
3168
|
-
},
|
|
3169
|
-
{
|
|
3170
|
-
"type": "image",
|
|
3171
|
-
"info": {
|
|
3172
|
-
"link": "https://hep.physiotec.ca/image.php?param=ZzZySkRIVXBqN2JTejF5U0cvZWtaSkk5MUdyNDYvRmQ3YkFjMm1CU2NEbm9iOENKNEs1ZXlXTXhWcXZyRWZQOERBNVBYVkpNTXlIOVlBWm5PTkVJaFE9PQ=="
|
|
3173
|
-
}
|
|
3174
|
-
},
|
|
3175
|
-
{
|
|
3176
|
-
"type": "image",
|
|
3177
|
-
"info": {
|
|
3178
|
-
"link": "https://hep.physiotec.ca/image.php?param=ZzZySkRIVXBqN2JTejF5U0cvZWtaSkk5MUdyNDYvRmQ3YkFjMm1CU2NEazBlY1g2TFpaYVZsa0wrT3F3aGdsMGd6dTkyVXFvNVdBOUlVUFZpcmltM0E9PQ=="
|
|
3179
|
-
}
|
|
3180
|
-
},
|
|
3181
|
-
{
|
|
3182
|
-
"type": "iframe",
|
|
3183
|
-
"info": {
|
|
3184
|
-
"link": "videos.sproutvideo.com/embed/a09bdeb3191ae5c428/50796be0534425e7?type=sd",
|
|
3185
|
-
"width": 630,
|
|
3186
|
-
"height": 354
|
|
3187
|
-
}
|
|
3188
|
-
}
|
|
3189
|
-
]
|
|
3190
|
-
})
|
|
3191
|
-
}
|
|
3192
|
-
|
|
3193
3144
|
const NO_TEST = () => {}
|
|
3194
3145
|
const tests: { [K in keyof ClientModelForName]: () => void } = {
|
|
3195
3146
|
role_based_access_permissions: role_based_access_permissions_tests,
|
|
@@ -226,6 +226,12 @@ const endusers_tests = async (isSubscribed: boolean) => {
|
|
|
226
226
|
'Enduser update error', 'Update enduser webhook', isSubscribed
|
|
227
227
|
)
|
|
228
228
|
|
|
229
|
+
await sdk.api.endusers.set_password({ id: enduser.id, password: 'initialPassword' })
|
|
230
|
+
await check_next_webhook(
|
|
231
|
+
a => (a.records?.[0] as any)?.password === 'initialPassword',
|
|
232
|
+
'Enduser set password error', 'Set enduser password webhook', isSubscribed
|
|
233
|
+
)
|
|
234
|
+
|
|
229
235
|
// cleanup
|
|
230
236
|
if (isSubscribed) {
|
|
231
237
|
await sdk.api.webhooks.update({ subscriptionUpdates: {
|