@serve.zone/platformclient 2.4.0 → 3.0.1
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/dist_ts/00_commitinfo_data.js +1 -1
- package/dist_ts/classes.platformclient.d.ts +11 -1
- package/dist_ts/classes.platformclient.js +64 -32
- package/dist_ts/coremail/classes.coremailconnector.d.ts +72 -0
- package/dist_ts/coremail/classes.coremailconnector.js +663 -0
- package/dist_ts/email/classes.emailconnector.d.ts +0 -1
- package/dist_ts/email/classes.emailconnector.js +2 -16
- package/dist_ts/index.d.ts +1 -0
- package/dist_ts/index.js +2 -1
- package/dist_ts/plugins.d.ts +2 -2
- package/dist_ts/plugins.js +3 -3
- package/dist_ts/webpush/classes.webpushconnector.js +2 -23
- package/package.json +8 -8
- package/readme.md +64 -12
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/classes.platformclient.ts +77 -34
- package/ts/coremail/classes.coremailconnector.ts +931 -0
- package/ts/email/classes.emailconnector.ts +1 -13
- package/ts/index.ts +1 -0
- package/ts/plugins.ts +2 -2
- package/ts/webpush/classes.webpushconnector.ts +1 -28
|
@@ -404,19 +404,7 @@ export class SzEmailConnector {
|
|
|
404
404
|
}
|
|
405
405
|
|
|
406
406
|
private async readMailEnvVar(envNameArg: string): Promise<string | undefined> {
|
|
407
|
-
return await this.platformClientRef.getConfiguredEnvVar(envNameArg)
|
|
408
|
-
|| this.getCredentialEnvVarFromBindings(envNameArg);
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
private getCredentialEnvVarFromBindings(envNameArg: string): string | undefined {
|
|
412
|
-
for (const binding of this.platformClientRef.platformBindings || []) {
|
|
413
|
-
if (binding.desiredState === 'disabled' || binding.status === 'failed') continue;
|
|
414
|
-
if (binding.capability !== 'email') continue;
|
|
415
|
-
for (const credential of binding.credentials || []) {
|
|
416
|
-
const value = credential.env?.[envNameArg];
|
|
417
|
-
if (value) return value;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
407
|
+
return await this.platformClientRef.getConfiguredEnvVar(envNameArg);
|
|
420
408
|
}
|
|
421
409
|
|
|
422
410
|
private hasAnyMailEnvValue(envArg?: {
|
package/ts/index.ts
CHANGED
package/ts/plugins.ts
CHANGED
|
@@ -17,11 +17,11 @@ export {
|
|
|
17
17
|
|
|
18
18
|
// @api.global scope
|
|
19
19
|
import * as typedrequest from '@api.global/typedrequest';
|
|
20
|
-
import * as
|
|
20
|
+
import * as typedrequestInterfaces from '@api.global/typedrequest-interfaces';
|
|
21
21
|
import * as typedsocket from '@api.global/typedsocket';
|
|
22
22
|
|
|
23
23
|
export {
|
|
24
24
|
typedrequest,
|
|
25
|
-
|
|
25
|
+
typedrequestInterfaces,
|
|
26
26
|
typedsocket,
|
|
27
27
|
}
|
|
@@ -238,34 +238,7 @@ export class SzWebPushConnector {
|
|
|
238
238
|
if (this.hasCredentialBundleValue(directEnv)) {
|
|
239
239
|
return directEnv;
|
|
240
240
|
}
|
|
241
|
-
|
|
242
|
-
const bindingCredentialBundles: Array<Partial<IServiceWebPushCredentials>> = [];
|
|
243
|
-
for (const binding of this.platformClientRef.platformBindings || []) {
|
|
244
|
-
if (
|
|
245
|
-
binding.capability !== 'pushnotification'
|
|
246
|
-
|| binding.desiredState !== 'enabled'
|
|
247
|
-
|| binding.status !== 'ready'
|
|
248
|
-
) {
|
|
249
|
-
continue;
|
|
250
|
-
}
|
|
251
|
-
for (const credential of binding.credentials || []) {
|
|
252
|
-
const credentialBundle = this.normalizeCredentialBundle({
|
|
253
|
-
typedUrl: credential.env?.WEB_PUSH_TYPED_URL,
|
|
254
|
-
credentialId: credential.env?.WEB_PUSH_API_CREDENTIAL_ID,
|
|
255
|
-
credentialSecret: credential.env?.WEB_PUSH_API_CREDENTIAL_SECRET,
|
|
256
|
-
});
|
|
257
|
-
if (this.hasCredentialBundleValue(credentialBundle)) {
|
|
258
|
-
bindingCredentialBundles.push(credentialBundle);
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
if (bindingCredentialBundles.length > 1) {
|
|
264
|
-
throw new Error(
|
|
265
|
-
'Multiple ready Web Push credential bundles are configured; exactly one is required',
|
|
266
|
-
);
|
|
267
|
-
}
|
|
268
|
-
return bindingCredentialBundles[0] || {};
|
|
241
|
+
return {};
|
|
269
242
|
}
|
|
270
243
|
|
|
271
244
|
private normalizeCredentialBundle(bundleArg: {
|