@mpgd/platform 0.25.0 → 0.27.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.
- package/dist/notifications-conformance.d.ts +31 -114
- package/dist/notifications-conformance.js +25 -1332
- package/dist/notifications-policy.d.ts +17 -0
- package/dist/notifications-policy.js +24 -0
- package/dist/notifications-runtime-support.d.ts +20 -0
- package/dist/notifications-runtime-support.js +96 -0
- package/dist/notifications-runtime.d.ts +262 -0
- package/dist/notifications-runtime.js +1715 -0
- package/dist/notifications.d.ts +27 -3
- package/dist/notifications.js +38 -4
- package/package.json +5 -1
package/dist/notifications.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ import { type NotificationConsentRecord, type NotificationDeliveryProviderEntry,
|
|
|
11
11
|
export declare const notificationsProtocolVersion: '2.0.0-draft.1';
|
|
12
12
|
export declare const notificationsProtocol: 'mpgd.notifications.v2';
|
|
13
13
|
export type { CancelLocalNotificationsInput, LocalNotificationEntry, LocalNotificationRequest, LocalScheduleResult, NotificationCapabilities, NotificationChannel, NotificationEndpointAddress, NotificationEndpointRegistration, NotificationEvent, NotificationLocalCapabilities, NotificationOpenPath, NotificationPermissionAllowance, NotificationPermissionCapabilities, NotificationPermissionOutcome, NotificationPermissionPrompt, NotificationPermissionResult, NotificationPermissionScope, NotificationPermissionSnapshot, NotificationPermissionState, NotificationProvider, NotificationProviderId, NotificationPurpose, NotificationRemoteAddressing, NotificationRemoteCapabilities, NotificationRemoteContent, NotificationRequiredAction, NotificationSettingsResult, NotificationTopicId, NotificationTopicsInput, } from './notifications-contract.js';
|
|
14
|
-
export { applyNotificationAdvertisingLabel, checkNotificationNightWindow, checkNotificationQuietHours, createNotificationNoticeIdempotencyKey, createNotificationReminderIdempotencyKey, evaluateLocalNotificationReminder, evaluateNotificationDelivery, evaluateNotificationReminderConsent, fillNotificationTemplate, findNotificationCopy, isNotificationCalendarDate, isNotificationTimestamp, isRecordableNotificationPermissionState, isRootRelativeNotificationRoute, isSameNotificationNotice, isValidNotificationTimeZone, latestNotificationConsent, listNotificationNotices, normalizeNotificationTimestamp, notificationAdvertisingOptOutActionId, notificationAdvertisingPrefix, notificationConsentResultDueBy, notificationDefaultDeploymentTimeZone, notificationDefaultOptOutLine, notificationInputBounds, notificationKeyIssue, notificationNightWindow, notificationNoticeCopyIssues, notificationNoticeLeadDays, notificationNoticeSendFrom, notificationNoticeTopic, notificationNoticeVariantCopy, notificationNoticeVariantFallbacks, notificationNoticeVariants, notificationPermissionConsentKind, notificationPermissionStateOf, notificationProviderCarriesNotices, notificationReconfirmationDueBy, notificationReconfirmationListDays, notificationRegistryMismatch, notificationReservedKeyPrefix, notificationReservedKeyPrefixes, notificationSendFingerprint, notificationSuppressionReasons, notificationTemplateDataIssue, notificationTopicDefinitionIssues, notificationTopicNeedsNoAgreement, readNotificationTemplate, recordableNotificationPermissionStates, referenceNotificationProviders, referenceNotificationTargetProviders, renderNotificationAdvertisement, resolveNotificationAdvertisingSettings, resolveNotificationContent, routeNotificationReminder, toSeoulCalendarDate, type EvaluateLocalNotificationReminderInput, type EvaluateNotificationDeliveryInput, type EvaluateNotificationReminderConsentInput, type LocalNotificationReminderDecision, type NotificationAction, type NotificationAdvertisingRules, type NotificationAdvertisingSender, type NotificationAdvertisingSettings, type NotificationClockTime, type NotificationConsentKind, type NotificationConsentRecord, type NotificationConsentSource, type NotificationConsentState, type NotificationDeferralReason, type NotificationDeliveryContent, type NotificationDeliveryDecision, type NotificationDeliveryHistoryEntry, type NotificationDeliveryOutcome, type NotificationDeliveryProviderEntry, type NotificationDeliveryRefusal, type NotificationDeliveryStatus, type NotificationDeployment, type NotificationMappingField, type NotificationNotice, type NotificationNoticeCopy, type NotificationNoticeIdentity, type NotificationNoticeKind, type NotificationNoticeLocaleCopy, type NotificationNoticeSettings, type NotificationNoticeVariant, type NotificationProviderLimit, type NotificationProviderRegistryEntry, type NotificationQuietHours, type NotificationRecordablePermissionState, type NotificationReminderRoute, type NotificationReminderStatus, type NotificationSendRequest, type NotificationSuppressionReason, type NotificationTemplateData, type NotificationTopicCopy, type NotificationTopicDeclaration, type NotificationTopicDefinition, type NotificationTopicFrequency, type NotificationTopicIssue, type NotificationTopicMapping, type NotificationUnavailableReason, type NotificationWindowCheck, type ReminderResult, type ResolveNotificationContentInput, } from './notifications-policy.js';
|
|
14
|
+
export { applyNotificationAdvertisingLabel, checkNotificationNightWindow, checkNotificationQuietHours, createNotificationNoticeIdempotencyKey, createNotificationReminderIdempotencyKey, evaluateLocalNotificationReminder, evaluateNotificationDelivery, evaluateNotificationReminderConsent, fillNotificationTemplate, findNotificationCopy, isNotificationCalendarDate, isNotificationPlaceholderText, isNotificationTimestamp, isRecordableNotificationPermissionState, isRootRelativeNotificationRoute, isSameNotificationNotice, isValidNotificationTimeZone, latestNotificationConsent, listNotificationNotices, normalizeNotificationTimestamp, notificationAdvertisingOptOutActionId, notificationAdvertisingPrefix, notificationConsentResultDueBy, notificationDefaultDeploymentTimeZone, notificationDefaultOptOutLine, notificationInputBounds, notificationKeyIssue, notificationNightWindow, notificationNoticeCopyIssues, notificationNoticeLeadDays, notificationNoticeSendFrom, notificationNoticeTopic, notificationNoticeVariantCopy, notificationNoticeVariantFallbacks, notificationNoticeVariants, notificationPermissionConsentKind, notificationPermissionStateOf, notificationProviderCarriesNotices, notificationReconfirmationDueBy, notificationReconfirmationListDays, notificationRegistryMismatch, notificationReservedKeyPrefix, notificationReservedKeyPrefixes, notificationSendFingerprint, notificationSuppressionReasons, notificationTemplateDataIssue, notificationTopicDefinitionIssues, notificationTopicNeedsNoAgreement, readNotificationTemplate, recordableNotificationPermissionStates, referenceNotificationProviders, referenceNotificationTargetProviders, renderNotificationAdvertisement, resolveNotificationAdvertisingSettings, resolveNotificationContent, routeNotificationReminder, toSeoulCalendarDate, type EvaluateLocalNotificationReminderInput, type EvaluateNotificationDeliveryInput, type EvaluateNotificationReminderConsentInput, type LocalNotificationReminderDecision, type NotificationAction, type NotificationAdvertisingRules, type NotificationAdvertisingSender, type NotificationAdvertisingSettings, type NotificationClockTime, type NotificationConsentKind, type NotificationConsentRecord, type NotificationConsentSource, type NotificationConsentState, type NotificationDeferralReason, type NotificationDeliveryContent, type NotificationDeliveryDecision, type NotificationDeliveryHistoryEntry, type NotificationDeliveryOutcome, type NotificationDeliveryProviderEntry, type NotificationDeliveryRefusal, type NotificationDeliveryStatus, type NotificationDeployment, type NotificationMappingField, type NotificationNotice, type NotificationNoticeCopy, type NotificationNoticeIdentity, type NotificationNoticeKind, type NotificationNoticeLocaleCopy, type NotificationNoticeSettings, type NotificationNoticeVariant, type NotificationProviderLimit, type NotificationProviderRegistryEntry, type NotificationQuietHours, type NotificationRecordablePermissionState, type NotificationReminderRoute, type NotificationReminderStatus, type NotificationSendRequest, type NotificationSuppressionReason, type NotificationTemplateData, type NotificationTopicCopy, type NotificationTopicDeclaration, type NotificationTopicDefinition, type NotificationTopicFrequency, type NotificationTopicIssue, type NotificationTopicMapping, type NotificationUnavailableReason, type NotificationWindowCheck, type ReminderResult, type ResolveNotificationContentInput, } from './notifications-policy.js';
|
|
15
15
|
type NonEmptyString = string & tags.MinLength<1>;
|
|
16
16
|
type NonNegativeInteger = number & tags.Type<'uint32'>;
|
|
17
17
|
export type NotificationErrorCode =
|
|
@@ -214,8 +214,32 @@ export declare const assertNotificationNotice: (input: unknown) => NotificationN
|
|
|
214
214
|
*/
|
|
215
215
|
export declare const assertRecordNotificationNoticeInput: (input: unknown) => RecordNotificationNoticeInput;
|
|
216
216
|
export declare const assertNotificationDeliveryProviderEntry: (input: unknown) => NotificationDeliveryProviderEntry;
|
|
217
|
-
/**
|
|
218
|
-
export
|
|
217
|
+
/** Options of `assertNotificationDeployment`. */
|
|
218
|
+
export interface AssertNotificationDeploymentOptions {
|
|
219
|
+
/**
|
|
220
|
+
* Accept placeholders, for a validator that reports them itself
|
|
221
|
+
* (`notificationDeploymentPlaceholders`) next to the catalog's issues. A
|
|
222
|
+
* backend never sets it.
|
|
223
|
+
*/
|
|
224
|
+
readonly allowPlaceholders?: boolean;
|
|
225
|
+
}
|
|
226
|
+
/**
|
|
227
|
+
* The fields of a deployment under the Korean rules that still hold a
|
|
228
|
+
* template placeholder (`isNotificationPlaceholderText`): the advertising
|
|
229
|
+
* sender's name and contact and the opt-out line, which every advertising
|
|
230
|
+
* push carries there. Under `none`, or without `advertisingRules`, no push
|
|
231
|
+
* carries them, so none is reported.
|
|
232
|
+
*/
|
|
233
|
+
export declare function notificationDeploymentPlaceholders(deployment: NotificationDeployment): readonly ('advertisingSender.name' | 'advertisingSender.contact' | 'advertisingOptOutLine')[];
|
|
234
|
+
/**
|
|
235
|
+
* Validates deployment settings: a `timeZone` that `Intl` knows, which quiet
|
|
236
|
+
* hours read, and under the Korean rules an advertising sender and opt-out
|
|
237
|
+
* line that are not template placeholders
|
|
238
|
+
* (`notificationDeploymentPlaceholders`). A backend built from a refused
|
|
239
|
+
* deployment does not start, so a starter's placeholder contact never
|
|
240
|
+
* reaches an advertising push.
|
|
241
|
+
*/
|
|
242
|
+
export declare function assertNotificationDeployment(input: unknown, options?: AssertNotificationDeploymentOptions): NotificationDeployment;
|
|
219
243
|
/** Validates a topic definition's shape and the rules of `notificationTopicDefinitionIssues`. */
|
|
220
244
|
export declare function assertNotificationTopicDefinition(input: unknown): NotificationTopicDefinition;
|
|
221
245
|
export declare const assertNotificationBridgeGetCapabilitiesPayload: (input: unknown) => NotificationBridgeProtocolPayload;
|
package/dist/notifications.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as _accessExpressionAsString_1 from "typia/lib/internal/_accessExpressi
|
|
|
6
6
|
const __typia_transform__accessExpressionAsString = _accessExpressionAsString_1._accessExpressionAsString;
|
|
7
7
|
import typia from 'typia';
|
|
8
8
|
import { PlatformOperationError, } from './index.js';
|
|
9
|
-
import { isValidNotificationTimeZone, notificationPermissionStateOf, notificationRouteError, notificationTimeFieldIssue, notificationTimeFields, notificationTopicDefinitionIssues, } from './notifications-policy.js';
|
|
9
|
+
import { isNotificationPlaceholderText, isValidNotificationTimeZone, notificationPermissionStateOf, notificationRouteError, notificationTimeFieldIssue, notificationTimeFields, notificationTopicDefinitionIssues, } from './notifications-policy.js';
|
|
10
10
|
/**
|
|
11
11
|
* Notifications v2 contract module (docs/specs/notifications/notifications-v2-rfc.md).
|
|
12
12
|
* Pure types, validators, and helpers only: no provider lives here, and
|
|
@@ -15,7 +15,7 @@ import { isValidNotificationTimeZone, notificationPermissionStateOf, notificatio
|
|
|
15
15
|
*/
|
|
16
16
|
export const notificationsProtocolVersion = '2.0.0-draft.1';
|
|
17
17
|
export const notificationsProtocol = 'mpgd.notifications.v2';
|
|
18
|
-
export { applyNotificationAdvertisingLabel, checkNotificationNightWindow, checkNotificationQuietHours, createNotificationNoticeIdempotencyKey, createNotificationReminderIdempotencyKey, evaluateLocalNotificationReminder, evaluateNotificationDelivery, evaluateNotificationReminderConsent, fillNotificationTemplate, findNotificationCopy, isNotificationCalendarDate, isNotificationTimestamp, isRecordableNotificationPermissionState, isRootRelativeNotificationRoute, isSameNotificationNotice, isValidNotificationTimeZone, latestNotificationConsent, listNotificationNotices, normalizeNotificationTimestamp, notificationAdvertisingOptOutActionId, notificationAdvertisingPrefix, notificationConsentResultDueBy, notificationDefaultDeploymentTimeZone, notificationDefaultOptOutLine, notificationInputBounds, notificationKeyIssue, notificationNightWindow, notificationNoticeCopyIssues, notificationNoticeLeadDays, notificationNoticeSendFrom, notificationNoticeTopic, notificationNoticeVariantCopy, notificationNoticeVariantFallbacks, notificationNoticeVariants, notificationPermissionConsentKind, notificationPermissionStateOf, notificationProviderCarriesNotices, notificationReconfirmationDueBy, notificationReconfirmationListDays, notificationRegistryMismatch, notificationReservedKeyPrefix, notificationReservedKeyPrefixes, notificationSendFingerprint, notificationSuppressionReasons, notificationTemplateDataIssue, notificationTopicDefinitionIssues, notificationTopicNeedsNoAgreement, readNotificationTemplate, recordableNotificationPermissionStates, referenceNotificationProviders, referenceNotificationTargetProviders, renderNotificationAdvertisement, resolveNotificationAdvertisingSettings, resolveNotificationContent, routeNotificationReminder, toSeoulCalendarDate, } from './notifications-policy.js';
|
|
18
|
+
export { applyNotificationAdvertisingLabel, checkNotificationNightWindow, checkNotificationQuietHours, createNotificationNoticeIdempotencyKey, createNotificationReminderIdempotencyKey, evaluateLocalNotificationReminder, evaluateNotificationDelivery, evaluateNotificationReminderConsent, fillNotificationTemplate, findNotificationCopy, isNotificationCalendarDate, isNotificationPlaceholderText, isNotificationTimestamp, isRecordableNotificationPermissionState, isRootRelativeNotificationRoute, isSameNotificationNotice, isValidNotificationTimeZone, latestNotificationConsent, listNotificationNotices, normalizeNotificationTimestamp, notificationAdvertisingOptOutActionId, notificationAdvertisingPrefix, notificationConsentResultDueBy, notificationDefaultDeploymentTimeZone, notificationDefaultOptOutLine, notificationInputBounds, notificationKeyIssue, notificationNightWindow, notificationNoticeCopyIssues, notificationNoticeLeadDays, notificationNoticeSendFrom, notificationNoticeTopic, notificationNoticeVariantCopy, notificationNoticeVariantFallbacks, notificationNoticeVariants, notificationPermissionConsentKind, notificationPermissionStateOf, notificationProviderCarriesNotices, notificationReconfirmationDueBy, notificationReconfirmationListDays, notificationRegistryMismatch, notificationReservedKeyPrefix, notificationReservedKeyPrefixes, notificationSendFingerprint, notificationSuppressionReasons, notificationTemplateDataIssue, notificationTopicDefinitionIssues, notificationTopicNeedsNoAgreement, readNotificationTemplate, recordableNotificationPermissionStates, referenceNotificationProviders, referenceNotificationTargetProviders, renderNotificationAdvertisement, resolveNotificationAdvertisingSettings, resolveNotificationContent, routeNotificationReminder, toSeoulCalendarDate, } from './notifications-policy.js';
|
|
19
19
|
export const notificationErrorCodes = Object.freeze([
|
|
20
20
|
'NOTIFICATIONS_UNSUPPORTED',
|
|
21
21
|
'NOTIFICATIONS_CONFIGURATION_REQUIRED',
|
|
@@ -3459,12 +3459,46 @@ const assertNotificationDeploymentShape = (() => {
|
|
|
3459
3459
|
return input;
|
|
3460
3460
|
};
|
|
3461
3461
|
})();
|
|
3462
|
-
/**
|
|
3463
|
-
|
|
3462
|
+
/**
|
|
3463
|
+
* The fields of a deployment under the Korean rules that still hold a
|
|
3464
|
+
* template placeholder (`isNotificationPlaceholderText`): the advertising
|
|
3465
|
+
* sender's name and contact and the opt-out line, which every advertising
|
|
3466
|
+
* push carries there. Under `none`, or without `advertisingRules`, no push
|
|
3467
|
+
* carries them, so none is reported.
|
|
3468
|
+
*/
|
|
3469
|
+
export function notificationDeploymentPlaceholders(deployment) {
|
|
3470
|
+
if (deployment.advertisingRules !== 'kr') {
|
|
3471
|
+
return [];
|
|
3472
|
+
}
|
|
3473
|
+
const texts = [
|
|
3474
|
+
['advertisingSender.name', deployment.advertisingSender?.name],
|
|
3475
|
+
['advertisingSender.contact', deployment.advertisingSender?.contact],
|
|
3476
|
+
['advertisingOptOutLine', deployment.advertisingOptOutLine],
|
|
3477
|
+
];
|
|
3478
|
+
return texts
|
|
3479
|
+
.filter(([, value]) => value !== undefined && isNotificationPlaceholderText(value))
|
|
3480
|
+
.map(([field]) => field);
|
|
3481
|
+
}
|
|
3482
|
+
/**
|
|
3483
|
+
* Validates deployment settings: a `timeZone` that `Intl` knows, which quiet
|
|
3484
|
+
* hours read, and under the Korean rules an advertising sender and opt-out
|
|
3485
|
+
* line that are not template placeholders
|
|
3486
|
+
* (`notificationDeploymentPlaceholders`). A backend built from a refused
|
|
3487
|
+
* deployment does not start, so a starter's placeholder contact never
|
|
3488
|
+
* reaches an advertising push.
|
|
3489
|
+
*/
|
|
3490
|
+
export function assertNotificationDeployment(input, options = {}) {
|
|
3464
3491
|
const deployment = assertNotificationDeploymentShape(input);
|
|
3465
3492
|
if (deployment.timeZone !== undefined && !isValidNotificationTimeZone(deployment.timeZone)) {
|
|
3466
3493
|
throw new TypeError(`Unknown time zone in the deployment: ${deployment.timeZone}`);
|
|
3467
3494
|
}
|
|
3495
|
+
const placeholders = options.allowPlaceholders === true
|
|
3496
|
+
? []
|
|
3497
|
+
: notificationDeploymentPlaceholders(deployment);
|
|
3498
|
+
if (placeholders.length > 0) {
|
|
3499
|
+
throw new TypeError(`The deployment still has a placeholder in ${placeholders.join(', ')}: `
|
|
3500
|
+
+ 'replace it with the real value before the backend starts.');
|
|
3501
|
+
}
|
|
3468
3502
|
return deployment;
|
|
3469
3503
|
}
|
|
3470
3504
|
const assertNotificationTopicDefinitionShape = (() => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mpgd/platform",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.27.0",
|
|
4
4
|
"description": "Shared platform gateway, monetization, ads, leaderboard, identity, lifecycle, and storage contracts for mpgd games.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -73,6 +73,10 @@
|
|
|
73
73
|
"types": "./dist/notifications-conformance.d.ts",
|
|
74
74
|
"default": "./dist/notifications-conformance.js"
|
|
75
75
|
},
|
|
76
|
+
"./notifications-runtime": {
|
|
77
|
+
"types": "./dist/notifications-runtime.d.ts",
|
|
78
|
+
"default": "./dist/notifications-runtime.js"
|
|
79
|
+
},
|
|
76
80
|
"./routes": {
|
|
77
81
|
"types": "./dist/routes.d.ts",
|
|
78
82
|
"default": "./dist/routes.js"
|