@wildo-ai/saas-models 1.1.2 → 1.1.3
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/esm/applications/applications-context.schemas.d.ts +14 -10
- package/dist/esm/applications/applications-context.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/applications/applications.shared.resources-config.schemas.js +4 -3
- package/dist/esm/applications/applications.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts +0 -4
- package/dist/esm/billing/billing-configuration.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-configuration.shared.schemas.js +59 -17
- package/dist/esm/billing/billing-configuration.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts +77 -21
- package/dist/esm/billing/billing-enums.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/billing-enums.shared.schemas.js +85 -23
- package/dist/esm/billing/billing-enums.shared.schemas.js.map +1 -1
- package/dist/esm/billing/billing-types.shared.schemas.d.ts +3 -3
- package/dist/esm/billing/price.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/price.shared.schemas.js +7 -1
- package/dist/esm/billing/price.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js +52 -11
- package/dist/esm/billing/product-behavior-policy.shared.schemas.js.map +1 -1
- package/dist/esm/billing/product-definition.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.resources-config.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts +2 -2
- package/dist/esm/billing/product.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/product.shared.schemas.js +7 -3
- package/dist/esm/billing/product.shared.schemas.js.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js +15 -1
- package/dist/esm/billing/subscription.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.d.ts +7 -3
- package/dist/esm/billing/usage-record.shared.schemas.d.ts.map +1 -1
- package/dist/esm/billing/usage-record.shared.schemas.js +22 -3
- package/dist/esm/billing/usage-record.shared.schemas.js.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts +69 -2
- package/dist/esm/companion/provider-discovery.shared.schemas.d.ts.map +1 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js +20 -1
- package/dist/esm/companion/provider-discovery.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts +85 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js +157 -0
- package/dist/esm/compliance/audit-trails/application-audit-logs.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts +23 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js +56 -0
- package/dist/esm/compliance/audit-trails/audit-trail-config.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts +480 -20
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js +547 -23
- package/dist/esm/compliance/audit-trails/auditable-events.shared.schema.js.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.d.ts.map +1 -1
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js +82 -3
- package/dist/esm/compliance/audit-trails/security-audit-event-envelope.shared.schema.js.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts +31 -30
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js +98 -3
- package/dist/esm/compliance/privacy/operating-jurisdictions.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts +17 -0
- package/dist/esm/compliance/privacy/privacy.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js +27 -4
- package/dist/esm/compliance/privacy/privacy.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts +82 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js +95 -29
- package/dist/esm/compliance/privacy/redaction.shared.schemas.js.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.d.ts.map +1 -1
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js +12 -5
- package/dist/esm/compliance/privacy/subject-export.shared.schemas.js.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts +21 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/analytics-value-moments.shared.schemas.js +20 -0
- package/dist/esm/config/analytics-value-moments.shared.schemas.js.map +1 -1
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts +7 -5
- package/dist/esm/config/app-configuration-shared.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts +8 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.d.ts.map +1 -1
- package/dist/esm/config/auth-config-resolution.shared.utils.js +29 -0
- package/dist/esm/config/auth-config-resolution.shared.utils.js.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts +95 -17
- package/dist/esm/config/entity-identity-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/config/entity-identity-config.shared.schemas.js +86 -8
- package/dist/esm/config/entity-identity-config.shared.schemas.js.map +1 -1
- package/dist/esm/config/frontend/chart-definition.shared.schemas.d.ts +12 -12
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.d.ts.map +1 -1
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js +28 -0
- package/dist/esm/errors/errors.custom-message-ref.shared.definitions.js.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts +45 -12
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-data/external-data-pipeline.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts +103 -58
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js +176 -15
- package/dist/esm/external-providers/engine-capabilities.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts +15 -3
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.d.ts.map +1 -1
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js +32 -5
- package/dist/esm/external-providers/engine-capability-resolution-mode.shared.js.map +1 -1
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts +83 -7
- package/dist/esm/external-providers/frontend-bootstrap.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts +59 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js +61 -0
- package/dist/esm/external-providers/frontend-capability-public-config.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts +97 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.d.ts.map +1 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js +41 -0
- package/dist/esm/external-providers/frontend-capability-runtime.shared.types.js.map +1 -0
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts +148 -2
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js +56 -1
- package/dist/esm/external-providers/frontend-provider-entry.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts +5 -28
- package/dist/esm/external-providers/provider-capability.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-capability.shared.schemas.js +4 -2
- package/dist/esm/external-providers/provider-capability.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts +18 -8
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js +9 -4
- package/dist/esm/external-providers/provider-compliance-profile.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts +338 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js +332 -0
- package/dist/esm/external-providers/provider-frontend-surface.shared.schemas.js.map +1 -0
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts +178 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js +181 -9
- package/dist/esm/external-providers/provider-metadata.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.d.ts.map +1 -1
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js +7 -5
- package/dist/esm/external-providers/provider-protocol.shared.schemas.js.map +1 -1
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts +40 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.d.ts.map +1 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js +80 -0
- package/dist/esm/external-providers/provider-tier-rule.shared.utils.js.map +1 -0
- package/dist/esm/features/core-feature-definitions.shared.d.ts.map +1 -1
- package/dist/esm/features/core-feature-definitions.shared.js +7 -1
- package/dist/esm/features/core-feature-definitions.shared.js.map +1 -1
- package/dist/esm/features/feature-builders.shared.d.ts +32 -0
- package/dist/esm/features/feature-builders.shared.d.ts.map +1 -1
- package/dist/esm/features/feature-builders.shared.js +32 -0
- package/dist/esm/features/feature-builders.shared.js.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts +14 -2
- package/dist/esm/files/file-upload-grant.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/file-upload-grant.shared.schemas.js +44 -5
- package/dist/esm/files/file-upload-grant.shared.schemas.js.map +1 -1
- package/dist/esm/files/files.shared.schemas.d.ts +15 -8
- package/dist/esm/files/files.shared.schemas.d.ts.map +1 -1
- package/dist/esm/files/files.shared.schemas.js +15 -8
- package/dist/esm/files/files.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/actors.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/actors.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts +54 -5
- package/dist/esm/flows-actors/agents.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/agents.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/apps-blueprint/apps-blueprint.shared.schemas.d.ts +6 -6
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/deliberation.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/deliberation.shared.schemas.js +0 -5
- package/dist/esm/flows-actors/deliberation.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts +14 -0
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js +40 -3
- package/dist/esm/flows-actors/flows-actors-execution.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts +19 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js +33 -0
- package/dist/esm/flows-actors/flows-actors.commons.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js +14 -9
- package/dist/esm/flows-actors/flows-actors.io.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows-actors.system.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/flows.shared.schemas.js +3 -2
- package/dist/esm/flows-actors/flows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts +128 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.d.ts.map +1 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js +142 -0
- package/dist/esm/flows-actors/mcp-servers.shared.schemas.js.map +1 -0
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts +0 -3
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js +1 -4
- package/dist/esm/flows-actors/meta-workflows/budget-authority.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts +0 -16
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js +1 -17
- package/dist/esm/flows-actors/meta-workflows/context-selection.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.d.ts +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js +3 -3
- package/dist/esm/flows-actors/meta-workflows/decisions.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts +2 -8
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.d.ts.map +1 -1
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js +4 -15
- package/dist/esm/flows-actors/meta-workflows/execution-binding-common.meta-workflows.shared.schemas.js.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.d.ts.map +1 -1
- package/dist/esm/guidance/guidance-state.shared.utils.js +1 -0
- package/dist/esm/guidance/guidance-state.shared.utils.js.map +1 -1
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts +8 -0
- package/dist/esm/guidance/progression-state.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts +46 -0
- package/dist/esm/guidance/progression-state.shared.schemas.d.ts.map +1 -1
- package/dist/esm/guidance/progression-state.shared.schemas.js +49 -0
- package/dist/esm/guidance/progression-state.shared.schemas.js.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts +320 -50
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.d.ts.map +1 -1
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js +137 -36
- package/dist/esm/http-api-binding/http-api-binding.shared.schemas.js.map +1 -1
- package/dist/esm/index.d.ts +9 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +9 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts +11 -2
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template-registry.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.d.ts.map +1 -1
- package/dist/esm/notifications/email/email-template.shared.enums.js +15 -0
- package/dist/esm/notifications/email/email-template.shared.enums.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js +19 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts +30 -0
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js +65 -1
- package/dist/esm/notifications/m2m/webhook-config.shared.schemas.js.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.core.definitions.js +6 -4
- package/dist/esm/notifications/notification-badges.core.definitions.js.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.d.ts +167 -5
- package/dist/esm/notifications/notification-badges.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notification-badges.schemas.js +191 -6
- package/dist/esm/notifications/notification-badges.schemas.js.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.d.ts +107 -0
- package/dist/esm/notifications/notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/notifications/notifications.shared.schemas.js +149 -1
- package/dist/esm/notifications/notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js +22 -1
- package/dist/esm/organizations/organization-notifications.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts +26 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-preferences.shared.schemas.js +25 -0
- package/dist/esm/organizations/organization-preferences.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts +25 -0
- package/dist/esm/organizations/organization-profile.shared.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organization-profile.shared.schemas.js +42 -17
- package/dist/esm/organizations/organization-profile.shared.schemas.js.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts +3 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.d.ts.map +1 -1
- package/dist/esm/organizations/organization-unit-narrowing.shared.js +9 -2
- package/dist/esm/organizations/organization-unit-narrowing.shared.js.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js +18 -3
- package/dist/esm/organizations/organizations.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/public-runtime/index.d.ts +49 -2
- package/dist/esm/public-runtime/index.d.ts.map +1 -1
- package/dist/esm/public-runtime/index.js +48 -1
- package/dist/esm/public-runtime/index.js.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js +6 -5
- package/dist/esm/queue/jobs.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.d.ts +16 -3
- package/dist/esm/queue/jobs.shared.schemas.d.ts.map +1 -1
- package/dist/esm/queue/jobs.shared.schemas.js +16 -3
- package/dist/esm/queue/jobs.shared.schemas.js.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts +137 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.d.ts.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js +1201 -0
- package/dist/esm/requests/manual-controllers-routes-documentation.js.map +1 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts +67 -0
- package/dist/esm/requests/manual-controllers-routes-urls.d.ts.map +1 -1
- package/dist/esm/requests/manual-controllers-routes-urls.js +78 -0
- package/dist/esm/requests/manual-controllers-routes-urls.js.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js +11 -1
- package/dist/esm/requests/rate-limits.shared.schemas.js.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.d.ts +27 -4
- package/dist/esm/requests/websocket.shared.schemas.d.ts.map +1 -1
- package/dist/esm/requests/websocket.shared.schemas.js +35 -0
- package/dist/esm/requests/websocket.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.d.ts +1 -0
- package/dist/esm/resources/resources-config.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.factory.js +105 -20
- package/dist/esm/resources/resources-config.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.d.ts +254 -72
- package/dist/esm/resources/resources-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources-config.shared.schemas.js.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources-registry.shared.core.definitions.js +97 -5
- package/dist/esm/resources/resources-registry.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.d.ts.map +1 -1
- package/dist/esm/resources/resources-relationships.shared.factory.js +15 -0
- package/dist/esm/resources/resources-relationships.shared.factory.js.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.d.ts +37 -0
- package/dist/esm/resources/resources.shared.core.definitions.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.core.definitions.js +51 -0
- package/dist/esm/resources/resources.shared.core.definitions.js.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.d.ts +11 -2
- package/dist/esm/resources/resources.shared.schemas.d.ts.map +1 -1
- package/dist/esm/resources/resources.shared.schemas.js +34 -3
- package/dist/esm/resources/resources.shared.schemas.js.map +1 -1
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts +51 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.d.ts.map +1 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js +53 -0
- package/dist/esm/resources/utils/field-value-disclosure.utils.js.map +1 -0
- package/dist/esm/resources/utils/resources-summary.utils.d.ts +16 -2
- package/dist/esm/resources/utils/resources-summary.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/resources-summary.utils.js +19 -5
- package/dist/esm/resources/utils/resources-summary.utils.js.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.d.ts.map +1 -1
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js +11 -0
- package/dist/esm/resources/utils/shared-persistence-collection.utils.js.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts +25 -0
- package/dist/esm/runtime/domain-module.shared.definitions.d.ts.map +1 -1
- package/dist/esm/runtime/domain-module.shared.definitions.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts +1 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js +38 -0
- package/dist/esm/security/api-keys/api-keys-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts +4 -11
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js +0 -1
- package/dist/esm/security/authentications/authentication.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts +84 -5
- package/dist/esm/security/authentications/authentication.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/authentication.shared.schemas.js +83 -3
- package/dist/esm/security/authentications/authentication.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts +1 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js +11 -0
- package/dist/esm/security/authentications/registration.shared.dto.schemas.js.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts +15 -0
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js +21 -4
- package/dist/esm/security/authentications/scim/scim-provisioning-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts +61 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js +208 -6
- package/dist/esm/security/authentications/sso/sso-config.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts +37 -27
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js +134 -12
- package/dist/esm/security/authentications/sso/sso-config.shared.schemas.js.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts +0 -6
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js +17 -8
- package/dist/esm/security/authentications/sso/sso-connection.shared.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js +27 -0
- package/dist/esm/security/authorizations/platform-access-grants.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts +52 -7
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js +45 -8
- package/dist/esm/security/authorizations/platform-access-grants.shared.schemas.js.map +1 -1
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js +198 -0
- package/dist/esm/security/connected-accounts/provider-credentials-organization.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts +31 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js +191 -0
- package/dist/esm/security/connected-accounts/provider-credentials-user.shared.resources-config.schemas.js.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts +250 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.d.ts.map +1 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js +486 -0
- package/dist/esm/security/connected-accounts/provider-credentials.shared.schemas.js.map +1 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-application.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts +4 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js +29 -0
- package/dist/esm/security/oauth-clients/oauth-clients-organization.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts +6 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js +31 -0
- package/dist/esm/security/oauth-clients/oauth-clients.shared.schemas.js.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts +13 -0
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.d.ts.map +1 -1
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js +24 -3
- package/dist/esm/security/oauth-clients/oauth-consent-grants.shared.schemas.js.map +1 -1
- package/dist/esm/users/user-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self-preferences.shared.resources-config.schemas.d.ts +4 -4
- package/dist/esm/users/user-self.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/user-self.shared.resources-config.schemas.js +33 -3
- package/dist/esm/users/user-self.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts +17 -1
- package/dist/esm/users/users.shared.resources-config.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.resources-config.schemas.js +136 -5
- package/dist/esm/users/users.shared.resources-config.schemas.js.map +1 -1
- package/dist/esm/users/users.shared.schemas.d.ts +43 -12
- package/dist/esm/users/users.shared.schemas.d.ts.map +1 -1
- package/dist/esm/users/users.shared.schemas.js +38 -7
- package/dist/esm/users/users.shared.schemas.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +4 -4
|
@@ -107,7 +107,27 @@ export const M2M_WEBHOOK_SCOPE_VARIANTS = [
|
|
|
107
107
|
export const WebhookEndpointSchema = z.object({
|
|
108
108
|
/** Stable per-endpoint identifier (ULID). Used as the `endpointId` FK on every delivery log row. */
|
|
109
109
|
id: z.string().min(1),
|
|
110
|
-
/**
|
|
110
|
+
/**
|
|
111
|
+
* Destination URL receiving POST deliveries.
|
|
112
|
+
*
|
|
113
|
+
* ## `http://` IS ACCEPTED, AND WHAT THAT COSTS YOU (#492, decided 2026-09-08)
|
|
114
|
+
*
|
|
115
|
+
* Every delivery carries a **signature JWT in the request**. That JWT is a credential: it is what
|
|
116
|
+
* proves to your endpoint that the delivery came from this application. Over plaintext it is
|
|
117
|
+
* readable by anyone on the network path between us and you, and replayable against your endpoint
|
|
118
|
+
* until it expires — so an observer of one delivery can forge the next one.
|
|
119
|
+
*
|
|
120
|
+
* **Use `https://`.** Plaintext is admitted because refusing it would break endpoints already
|
|
121
|
+
* configured under a framework that accepted them, not because it is safe. That is a commercial
|
|
122
|
+
* accommodation, deliberately taken, and it is not an assessment that `http://` is fine here.
|
|
123
|
+
*
|
|
124
|
+
* The sibling agent push-notification caller requires HTTPS unconditionally, and the same argument
|
|
125
|
+
* applies to this field; the two differ only in whether anyone has already authored against them.
|
|
126
|
+
*
|
|
127
|
+
* Note the URL is also SSRF-guarded at delivery time — a destination resolving to a private or
|
|
128
|
+
* link-local address is refused regardless of scheme, because a signed POST to an instance-metadata
|
|
129
|
+
* service is a read primitive rather than a delivery.
|
|
130
|
+
*/
|
|
111
131
|
url: z.url(),
|
|
112
132
|
/** Free-form admin label (visible in the management UI). */
|
|
113
133
|
description: z.string().max(500).default(''),
|
|
@@ -116,6 +136,50 @@ export const WebhookEndpointSchema = z.object({
|
|
|
116
136
|
createdAt: z.date().default(() => new Date()),
|
|
117
137
|
updatedAt: z.date().default(() => new Date()),
|
|
118
138
|
});
|
|
139
|
+
/**
|
|
140
|
+
* Whether a destination is reached over PLAINTEXT HTTP, so the signature JWT travels in the clear.
|
|
141
|
+
*
|
|
142
|
+
* ## One definition, because two would eventually disagree (#492)
|
|
143
|
+
*
|
|
144
|
+
* Plaintext is ADMITTED here — a deliberate commercial accommodation recorded on
|
|
145
|
+
* {@link WebhookEndpointSchema.url} — which is exactly why the condition needs a single named home
|
|
146
|
+
* rather than an inline `startsWith('http://')` at each surface that wants to say something about
|
|
147
|
+
* it. A refusal can live in one place because it stops the request; a TOLERATED condition is
|
|
148
|
+
* observed by several, and those several must agree.
|
|
149
|
+
*
|
|
150
|
+
* Read by the write path (which warns and audits) and by the endpoint probe (which reports it to
|
|
151
|
+
* the admin who pressed "test"). Both are listed here so the next reader can tell whether adding a
|
|
152
|
+
* third is joining a mechanism or starting a second one.
|
|
153
|
+
*
|
|
154
|
+
* Scheme comparison, not a `startsWith`: `WHATWG` lowercases the scheme during parsing, so
|
|
155
|
+
* `HTTP://example.test` and `http://example.test` are the same destination and a prefix test would
|
|
156
|
+
* disagree with the URL the delivery actually opens. An unparseable value answers `false` — it is
|
|
157
|
+
* not a plaintext destination, it is not a destination at all, and `z.url()` refuses it upstream.
|
|
158
|
+
*/
|
|
159
|
+
export function webhookEndpointTransportIsPlaintext(url) {
|
|
160
|
+
try {
|
|
161
|
+
return new URL(url).protocol === 'http:';
|
|
162
|
+
}
|
|
163
|
+
catch {
|
|
164
|
+
return false;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* The host of a webhook destination, for an audit row or a log line — never the full URL.
|
|
169
|
+
*
|
|
170
|
+
* Mirrors `AuditableEvent_Webhook_EndpointTestDispatchedEventDataSchema.destinationHost` and the
|
|
171
|
+
* reasoning recorded there: paths and query strings on customer endpoints routinely embed
|
|
172
|
+
* per-tenant tokens, and these rows are replicated to the organisation's SIEM and to the immutable
|
|
173
|
+
* store. The host answers "which of my endpoints" without carrying a credential into a log.
|
|
174
|
+
*/
|
|
175
|
+
export function webhookEndpointDestinationHost(url) {
|
|
176
|
+
try {
|
|
177
|
+
return new URL(url).host;
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
return 'unparseable';
|
|
181
|
+
}
|
|
182
|
+
}
|
|
119
183
|
// =============================================================================
|
|
120
184
|
// BASE CONFIG SCHEMA (polymorphism injects the scope FK at variant time)
|
|
121
185
|
// =============================================================================
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook-config.shared.schemas.js","sourceRoot":"","sources":["../../../../../src/notifications/m2m/webhook-config.shared.schemas.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * M2M Webhook Config Schema (Shared) — Polymorphic dual-scope\n *\n * Configures outbound webhook delivery for M2M notifications fired by\n * resource operations carrying a `WEBHOOK_ORGANIZATION` or\n * `WEBHOOK_APPLICATION` channel in their spec. Holds:\n * - a master `enabled` switch\n * - an array of admin-managed endpoints (URL + description + per-endpoint enabled flag)\n * - a derived `applicationPublicKeyPem` (READ-only, populated by a\n * postfix hook from `JwtPrivateKeys.APPLICATION_WEBHOOK` so external\n * consumers can verify our JWT-signed deliveries)\n *\n * Scope FK (`organizationId` / `applicationId`) is injected by the\n * polymorphism engine — NOT declared on the base schema.\n *\n * @see m2m-webhook-organization-delivery.md — Phase 2 / Step 3\n * @see security/authentications/siem/siem-export-config.shared.schemas.ts\n * for the dual-scope polymorphic precedent this mirrors.\n */\n\nimport { z } from 'zod';\nimport {\n CoreResourceType,\n coreResourceShared_FieldIdentifier,\n} from '../../resources/resources.shared.core.definitions';\nimport {\n declarePolymorphicSchemas,\n type PolymorphicVariantDefinition,\n} from '../../resources/utils/resource-polymorphism.schemas';\n\n// =============================================================================\n// ENDPOINT PROBE VOCABULARY\n// =============================================================================\n\n/**\n * Verdict of a single synthetic delivery fired by `webhookConfig.testEndpoint`.\n * A probe that cannot fail is worse than no probe, so every terminal state an\n * outbound attempt can reach is named here rather than collapsed into a boolean.\n *\n * The transport verdict and the HTTP status are deliberately SEPARATE axes:\n * `REJECTED` still carries a response status, because \"the endpoint answered 403\"\n * and \"the endpoint never answered\" are different problems with different fixes.\n *\n * Declared in this light schema module (not alongside the operation DTO) so the\n * audit-event vocabulary can name the same enum without pulling the resource-config\n * factory graph into `auditable-events.shared.schema.ts`.\n */\nexport enum WebhookEndpointProbeOutcome {\n /**\n * The endpoint answered with 2xx. This is the only outcome that evidences\n * consumer-side signature verification: the platform cannot observe the\n * consumer's verification step directly, so a 2xx from an endpoint that\n * verifies before responding is the available proof.\n */\n ACCEPTED = 'accepted',\n /** The endpoint answered, but not with 2xx. Reachable; it refused or errored. */\n REJECTED = 'rejected',\n /** No HTTP response at all — DNS/TLS/connection failure, or the attempt timed out. */\n UNREACHABLE = 'unreachable',\n /**\n * Nothing left the platform. The payload could not be signed, which is an\n * operator-side key/configuration fault, not a statement about the endpoint.\n * Reported distinctly so an admin never reads a local misconfiguration as a\n * broken customer endpoint.\n */\n NOT_SENT = 'not_sent',\n}\n\n// =============================================================================\n// SHARED VARIANT DEFINITIONS\n// =============================================================================\n\n/**\n * The 2 M2M webhook scope variants — shared by `WebhookConfig` and\n * `M2MWebhookDeliveryLog`. Centralised here so both polymorphic\n * declarations stay in lock-step.\n *\n * Notes:\n * - We deliberately define a domain-local constant (mirroring\n * `BILLING_SCOPE_VARIANTS` in the billing domain) instead of reusing\n * `AUTH_SCOPE_VARIANTS` from `authentications/`. The variant *shape*\n * is identical — `(ORGANIZATIONS, APPLICATION)` with `isPrimaryScope:\n * true` — but the auth constant is documented as \"shared across all\n * AUTH polymorphic resources\" and webhooks are notification resources,\n * not auth resources. Keeping a domain-local constant prevents the\n * semantic drift the framework-mindset rule warns about.\n * - Both variants are primary scopes: there is no \"child of an\n * organization unit\" or \"child of a user\" variant — webhooks are a\n * tenant-level concern, not an entity-attached one.\n */\nexport const M2M_WEBHOOK_SCOPE_VARIANTS: PolymorphicVariantDefinition[] = [\n {\n parentResourceType: CoreResourceType.ORGANIZATIONS,\n parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS],\n isPrimaryScope: true,\n },\n {\n parentResourceType: CoreResourceType.APPLICATION,\n parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION],\n isPrimaryScope: true,\n },\n];\n\n// =============================================================================\n// ENDPOINT SUB-SCHEMA\n// =============================================================================\n\n/**\n * A single admin-configured webhook destination.\n *\n * v1 deliberately keeps endpoint config minimal (URL + description +\n * enabled flag) — per user direction: \"as a first implementation, we\n * need just an url and a description, not more.\" Per-endpoint secrets\n * are NOT used: signing happens with a single per-application JWT\n * private key (`JwtPrivateKeys.APPLICATION_WEBHOOK`) and consumers\n * verify with the matching public key surfaced via the parent config's\n * derived `applicationPublicKeyPem` field.\n */\nexport const WebhookEndpointSchema = z.object({\n /** Stable per-endpoint identifier (ULID). Used as the `endpointId` FK on every delivery log row. */\n id: z.string().min(1),\n /** Destination URL receiving POST deliveries. */\n url: z.url(),\n /** Free-form admin label (visible in the management UI). */\n description: z.string().max(500).default(''),\n /** Per-endpoint master switch — disabled endpoints are skipped by the dispatcher. */\n enabled: z.boolean().default(true),\n createdAt: z.date().default(() => new Date()),\n updatedAt: z.date().default(() => new Date()),\n});\n\nexport type WebhookEndpoint = z.infer<typeof WebhookEndpointSchema>;\n\n// =============================================================================\n// BASE CONFIG SCHEMA (polymorphism injects the scope FK at variant time)\n// =============================================================================\n\nexport const WebhookConfigBaseSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n\n /** Master kill-switch — when `false`, the dispatcher short-circuits with no deliveries. */\n enabled: z.boolean().default(false).isSummaryField(),\n\n /** Admin-managed list of destinations. Empty array = no deliveries even when `enabled: true`. */\n endpoints: z.array(WebhookEndpointSchema).default([]),\n\n /**\n * Derived field — populated by `postfixCoreOperations[READ]` from\n * `appConfig.jwtConfig.config.publicKey[JwtPrivateKeys.APPLICATION_WEBHOOK]`.\n * Excluded from CREATE/UPDATE so clients cannot set it; the value is\n * regenerated on every read from the canonical app config so key\n * rotation is reflected immediately. Phase 3 wires the postfix hook\n * (Step 9 of the plan).\n */\n applicationPublicKeyPem: z.string().optional().excludeFromCreate().excludeFromUpdate(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\n\nexport type WebhookConfigBase = z.infer<typeof WebhookConfigBaseSchema>;\n\n// =============================================================================\n// POLYMORPHIC DECLARATION\n// =============================================================================\n\n/**\n * Yields two `CoreResourceType` variants:\n * - `organizationWebhookConfig` (FK: `organizationId`)\n * - `applicationWebhookConfig` (FK: `applicationId`)\n *\n * Both are singletons per scope (cardinality ONE) — wired in\n * `resources-registry.shared.core.definitions.ts` via\n * `createPolymorphicScopeRelationships(...)`.\n */\nexport const webhookConfigPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'webhookConfig',\n baseFieldIdentifier: 'webhookConfigId',\n baseEnumKey: 'WEBHOOK_CONFIG',\n baseSchema: WebhookConfigBaseSchema,\n variants: M2M_WEBHOOK_SCOPE_VARIANTS,\n});\n"]}
|
|
1
|
+
{"version":3,"file":"webhook-config.shared.schemas.js","sourceRoot":"","sources":["../../../../../src/notifications/m2m/webhook-config.shared.schemas.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * M2M Webhook Config Schema (Shared) — Polymorphic dual-scope\n *\n * Configures outbound webhook delivery for M2M notifications fired by\n * resource operations carrying a `WEBHOOK_ORGANIZATION` or\n * `WEBHOOK_APPLICATION` channel in their spec. Holds:\n * - a master `enabled` switch\n * - an array of admin-managed endpoints (URL + description + per-endpoint enabled flag)\n * - a derived `applicationPublicKeyPem` (READ-only, populated by a\n * postfix hook from `JwtPrivateKeys.APPLICATION_WEBHOOK` so external\n * consumers can verify our JWT-signed deliveries)\n *\n * Scope FK (`organizationId` / `applicationId`) is injected by the\n * polymorphism engine — NOT declared on the base schema.\n *\n * @see m2m-webhook-organization-delivery.md — Phase 2 / Step 3\n * @see security/authentications/siem/siem-export-config.shared.schemas.ts\n * for the dual-scope polymorphic precedent this mirrors.\n */\n\nimport { z } from 'zod';\nimport {\n CoreResourceType,\n coreResourceShared_FieldIdentifier,\n} from '../../resources/resources.shared.core.definitions';\nimport {\n declarePolymorphicSchemas,\n type PolymorphicVariantDefinition,\n} from '../../resources/utils/resource-polymorphism.schemas';\n\n// =============================================================================\n// ENDPOINT PROBE VOCABULARY\n// =============================================================================\n\n/**\n * Verdict of a single synthetic delivery fired by `webhookConfig.testEndpoint`.\n * A probe that cannot fail is worse than no probe, so every terminal state an\n * outbound attempt can reach is named here rather than collapsed into a boolean.\n *\n * The transport verdict and the HTTP status are deliberately SEPARATE axes:\n * `REJECTED` still carries a response status, because \"the endpoint answered 403\"\n * and \"the endpoint never answered\" are different problems with different fixes.\n *\n * Declared in this light schema module (not alongside the operation DTO) so the\n * audit-event vocabulary can name the same enum without pulling the resource-config\n * factory graph into `auditable-events.shared.schema.ts`.\n */\nexport enum WebhookEndpointProbeOutcome {\n /**\n * The endpoint answered with 2xx. This is the only outcome that evidences\n * consumer-side signature verification: the platform cannot observe the\n * consumer's verification step directly, so a 2xx from an endpoint that\n * verifies before responding is the available proof.\n */\n ACCEPTED = 'accepted',\n /** The endpoint answered, but not with 2xx. Reachable; it refused or errored. */\n REJECTED = 'rejected',\n /** No HTTP response at all — DNS/TLS/connection failure, or the attempt timed out. */\n UNREACHABLE = 'unreachable',\n /**\n * Nothing left the platform. The payload could not be signed, which is an\n * operator-side key/configuration fault, not a statement about the endpoint.\n * Reported distinctly so an admin never reads a local misconfiguration as a\n * broken customer endpoint.\n */\n NOT_SENT = 'not_sent',\n}\n\n// =============================================================================\n// SHARED VARIANT DEFINITIONS\n// =============================================================================\n\n/**\n * The 2 M2M webhook scope variants — shared by `WebhookConfig` and\n * `M2MWebhookDeliveryLog`. Centralised here so both polymorphic\n * declarations stay in lock-step.\n *\n * Notes:\n * - We deliberately define a domain-local constant (mirroring\n * `BILLING_SCOPE_VARIANTS` in the billing domain) instead of reusing\n * `AUTH_SCOPE_VARIANTS` from `authentications/`. The variant *shape*\n * is identical — `(ORGANIZATIONS, APPLICATION)` with `isPrimaryScope:\n * true` — but the auth constant is documented as \"shared across all\n * AUTH polymorphic resources\" and webhooks are notification resources,\n * not auth resources. Keeping a domain-local constant prevents the\n * semantic drift the framework-mindset rule warns about.\n * - Both variants are primary scopes: there is no \"child of an\n * organization unit\" or \"child of a user\" variant — webhooks are a\n * tenant-level concern, not an entity-attached one.\n */\nexport const M2M_WEBHOOK_SCOPE_VARIANTS: PolymorphicVariantDefinition[] = [\n {\n parentResourceType: CoreResourceType.ORGANIZATIONS,\n parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.ORGANIZATIONS],\n isPrimaryScope: true,\n },\n {\n parentResourceType: CoreResourceType.APPLICATION,\n parentFieldIdentifier: coreResourceShared_FieldIdentifier[CoreResourceType.APPLICATION],\n isPrimaryScope: true,\n },\n];\n\n// =============================================================================\n// ENDPOINT SUB-SCHEMA\n// =============================================================================\n\n/**\n * A single admin-configured webhook destination.\n *\n * v1 deliberately keeps endpoint config minimal (URL + description +\n * enabled flag) — per user direction: \"as a first implementation, we\n * need just an url and a description, not more.\" Per-endpoint secrets\n * are NOT used: signing happens with a single per-application JWT\n * private key (`JwtPrivateKeys.APPLICATION_WEBHOOK`) and consumers\n * verify with the matching public key surfaced via the parent config's\n * derived `applicationPublicKeyPem` field.\n */\nexport const WebhookEndpointSchema = z.object({\n /** Stable per-endpoint identifier (ULID). Used as the `endpointId` FK on every delivery log row. */\n id: z.string().min(1),\n /**\n * Destination URL receiving POST deliveries.\n *\n * ## `http://` IS ACCEPTED, AND WHAT THAT COSTS YOU (#492, decided 2026-09-08)\n *\n * Every delivery carries a **signature JWT in the request**. That JWT is a credential: it is what\n * proves to your endpoint that the delivery came from this application. Over plaintext it is\n * readable by anyone on the network path between us and you, and replayable against your endpoint\n * until it expires — so an observer of one delivery can forge the next one.\n *\n * **Use `https://`.** Plaintext is admitted because refusing it would break endpoints already\n * configured under a framework that accepted them, not because it is safe. That is a commercial\n * accommodation, deliberately taken, and it is not an assessment that `http://` is fine here.\n *\n * The sibling agent push-notification caller requires HTTPS unconditionally, and the same argument\n * applies to this field; the two differ only in whether anyone has already authored against them.\n *\n * Note the URL is also SSRF-guarded at delivery time — a destination resolving to a private or\n * link-local address is refused regardless of scheme, because a signed POST to an instance-metadata\n * service is a read primitive rather than a delivery.\n */\n url: z.url(),\n /** Free-form admin label (visible in the management UI). */\n description: z.string().max(500).default(''),\n /** Per-endpoint master switch — disabled endpoints are skipped by the dispatcher. */\n enabled: z.boolean().default(true),\n createdAt: z.date().default(() => new Date()),\n updatedAt: z.date().default(() => new Date()),\n});\n\nexport type WebhookEndpoint = z.infer<typeof WebhookEndpointSchema>;\n\n/**\n * Whether a destination is reached over PLAINTEXT HTTP, so the signature JWT travels in the clear.\n *\n * ## One definition, because two would eventually disagree (#492)\n *\n * Plaintext is ADMITTED here — a deliberate commercial accommodation recorded on\n * {@link WebhookEndpointSchema.url} — which is exactly why the condition needs a single named home\n * rather than an inline `startsWith('http://')` at each surface that wants to say something about\n * it. A refusal can live in one place because it stops the request; a TOLERATED condition is\n * observed by several, and those several must agree.\n *\n * Read by the write path (which warns and audits) and by the endpoint probe (which reports it to\n * the admin who pressed \"test\"). Both are listed here so the next reader can tell whether adding a\n * third is joining a mechanism or starting a second one.\n *\n * Scheme comparison, not a `startsWith`: `WHATWG` lowercases the scheme during parsing, so\n * `HTTP://example.test` and `http://example.test` are the same destination and a prefix test would\n * disagree with the URL the delivery actually opens. An unparseable value answers `false` — it is\n * not a plaintext destination, it is not a destination at all, and `z.url()` refuses it upstream.\n */\nexport function webhookEndpointTransportIsPlaintext(url: string): boolean {\n try {\n return new URL(url).protocol === 'http:';\n } catch {\n return false;\n }\n}\n\n/**\n * The host of a webhook destination, for an audit row or a log line — never the full URL.\n *\n * Mirrors `AuditableEvent_Webhook_EndpointTestDispatchedEventDataSchema.destinationHost` and the\n * reasoning recorded there: paths and query strings on customer endpoints routinely embed\n * per-tenant tokens, and these rows are replicated to the organisation's SIEM and to the immutable\n * store. The host answers \"which of my endpoints\" without carrying a credential into a log.\n */\nexport function webhookEndpointDestinationHost(url: string): string {\n try {\n return new URL(url).host;\n } catch {\n return 'unparseable';\n }\n}\n\n// =============================================================================\n// BASE CONFIG SCHEMA (polymorphism injects the scope FK at variant time)\n// =============================================================================\n\nexport const WebhookConfigBaseSchema = z.object({\n _id: z.string().min(1).isPrimaryKey().isSummaryField(),\n\n /** Master kill-switch — when `false`, the dispatcher short-circuits with no deliveries. */\n enabled: z.boolean().default(false).isSummaryField(),\n\n /** Admin-managed list of destinations. Empty array = no deliveries even when `enabled: true`. */\n endpoints: z.array(WebhookEndpointSchema).default([]),\n\n /**\n * Derived field — populated by `postfixCoreOperations[READ]` from\n * `appConfig.jwtConfig.config.publicKey[JwtPrivateKeys.APPLICATION_WEBHOOK]`.\n * Excluded from CREATE/UPDATE so clients cannot set it; the value is\n * regenerated on every read from the canonical app config so key\n * rotation is reflected immediately. Phase 3 wires the postfix hook\n * (Step 9 of the plan).\n */\n applicationPublicKeyPem: z.string().optional().excludeFromCreate().excludeFromUpdate(),\n\n createdAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n updatedAt: z.date().default(() => new Date()).excludeFromCreate().excludeFromUpdate(),\n});\n\nexport type WebhookConfigBase = z.infer<typeof WebhookConfigBaseSchema>;\n\n// =============================================================================\n// POLYMORPHIC DECLARATION\n// =============================================================================\n\n/**\n * Yields two `CoreResourceType` variants:\n * - `organizationWebhookConfig` (FK: `organizationId`)\n * - `applicationWebhookConfig` (FK: `applicationId`)\n *\n * Both are singletons per scope (cardinality ONE) — wired in\n * `resources-registry.shared.core.definitions.ts` via\n * `createPolymorphicScopeRelationships(...)`.\n */\nexport const webhookConfigPolymorphicDeclaration = declarePolymorphicSchemas({\n baseResourceType: 'webhookConfig',\n baseFieldIdentifier: 'webhookConfigId',\n baseEnumKey: 'WEBHOOK_CONFIG',\n baseSchema: WebhookConfigBaseSchema,\n variants: M2M_WEBHOOK_SCOPE_VARIANTS,\n});\n"]}
|
|
@@ -3,10 +3,12 @@ import { NotificationBadgeDefinition } from "./notification-badges.schemas";
|
|
|
3
3
|
* Canonical (framework-shipped) notification badge definitions.
|
|
4
4
|
*
|
|
5
5
|
* Intentionally empty: the two aspirational placeholders (`new messages` /
|
|
6
|
-
* `unpaid invoices`) were removed because nothing produced them
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* `unpaid invoices`) were removed because nothing produced them.
|
|
7
|
+
*
|
|
8
|
+
* This is a statement about FRAMEWORK-shipped definitions only. Badge surfacing itself works: a
|
|
9
|
+
* navigation item carries `notificationBadgeRef` and the sidebar renders the badge, and applications
|
|
10
|
+
* declare their own definitions. A framework definition returns here only once the framework also
|
|
11
|
+
* ships its producer, carrying a typed `source` (EVENT_COUNTER | DERIVED_QUERY) + `display`.
|
|
10
12
|
*/
|
|
11
13
|
export declare const coreNotificationBadgeDefinitions: NotificationBadgeDefinition[];
|
|
12
14
|
//# sourceMappingURL=notification-badges.core.definitions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-badges.core.definitions.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.core.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E
|
|
1
|
+
{"version":3,"file":"notification-badges.core.definitions.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.core.definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAE5E;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gCAAgC,EAAE,2BAA2B,EAAO,CAAC"}
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
* Canonical (framework-shipped) notification badge definitions.
|
|
3
3
|
*
|
|
4
4
|
* Intentionally empty: the two aspirational placeholders (`new messages` /
|
|
5
|
-
* `unpaid invoices`) were removed because nothing produced them
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
5
|
+
* `unpaid invoices`) were removed because nothing produced them.
|
|
6
|
+
*
|
|
7
|
+
* This is a statement about FRAMEWORK-shipped definitions only. Badge surfacing itself works: a
|
|
8
|
+
* navigation item carries `notificationBadgeRef` and the sidebar renders the badge, and applications
|
|
9
|
+
* declare their own definitions. A framework definition returns here only once the framework also
|
|
10
|
+
* ships its producer, carrying a typed `source` (EVENT_COUNTER | DERIVED_QUERY) + `display`.
|
|
9
11
|
*/
|
|
10
12
|
export const coreNotificationBadgeDefinitions = [];
|
|
11
13
|
//# sourceMappingURL=notification-badges.core.definitions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-badges.core.definitions.js","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.core.definitions.ts"],"names":[],"mappings":"AAEA
|
|
1
|
+
{"version":3,"file":"notification-badges.core.definitions.js","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.core.definitions.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,gCAAgC,GAAkC,EAAE,CAAC","sourcesContent":["import { NotificationBadgeDefinition } from \"./notification-badges.schemas\";\n\n/**\n * Canonical (framework-shipped) notification badge definitions.\n *\n * Intentionally empty: the two aspirational placeholders (`new messages` /\n * `unpaid invoices`) were removed because nothing produced them.\n *\n * This is a statement about FRAMEWORK-shipped definitions only. Badge surfacing itself works: a\n * navigation item carries `notificationBadgeRef` and the sidebar renders the badge, and applications\n * declare their own definitions. A framework definition returns here only once the framework also\n * ships its producer, carrying a typed `source` (EVENT_COUNTER | DERIVED_QUERY) + `display`.\n */\nexport const coreNotificationBadgeDefinitions: NotificationBadgeDefinition[] = [];\n"]}
|
|
@@ -1,14 +1,35 @@
|
|
|
1
1
|
import { z } from "zod";
|
|
2
2
|
import { IndicatorVariant } from '@wildo-ai/presets-components-models';
|
|
3
3
|
import { ResourcePrimaryScope } from "../resources/resources.shared.schemas";
|
|
4
|
+
/**
|
|
5
|
+
* The one character that separates the parts of a badge KEY and a badge REFERENCE.
|
|
6
|
+
*
|
|
7
|
+
* Both formats are positional, so the separator may not appear inside a part or the parse is
|
|
8
|
+
* ambiguous. `NotificationBadgeIdentifierSchema` refuses it in an identifier for exactly that
|
|
9
|
+
* reason, and `collectNotificationBadgeDeclarationViolations` re-states the refusal at boot,
|
|
10
|
+
* because a declaration object is authored in TypeScript and never `.parse()`d.
|
|
11
|
+
*/
|
|
12
|
+
export declare const NOTIFICATION_BADGE_KEY_SEPARATOR = ":";
|
|
13
|
+
/** Any string that does not contain {@link NOTIFICATION_BADGE_KEY_SEPARATOR}. */
|
|
14
|
+
export declare const NOTIFICATION_BADGE_IDENTIFIER_PATTERN: RegExp;
|
|
4
15
|
/**
|
|
5
16
|
* Notification badge identifier.
|
|
6
17
|
*
|
|
7
|
-
*
|
|
8
|
-
* (`new messages` / `unpaid invoices`) were removed because nothing
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
18
|
+
* The identifier is an open string because no canonical (core) identifier ships: the two
|
|
19
|
+
* aspirational placeholders (`new messages` / `unpaid invoices`) were removed because nothing
|
|
20
|
+
* produced them.
|
|
21
|
+
*
|
|
22
|
+
* The SURFACING is not missing. A navigation item declares `notificationBadgeRef` and the sidebar
|
|
23
|
+
* renders it, and an application declares its own badges, so the open string is what an application
|
|
24
|
+
* uses today. What is still absent is a FRAMEWORK-shipped identifier with a framework producer
|
|
25
|
+
* behind it; when one lands, core identifiers come back as a `CoreNotificationBadgeIdentifiers`
|
|
26
|
+
* enum unioned in here.
|
|
27
|
+
*
|
|
28
|
+
* Open, but not unconstrained: an identifier may not contain
|
|
29
|
+
* {@link NOTIFICATION_BADGE_KEY_SEPARATOR}, because it is the LAST part of a badge key and of a
|
|
30
|
+
* badge reference and both are positional. A definition object is authored in TypeScript and never
|
|
31
|
+
* `.parse()`d, so this constraint is also re-stated as a boot check — see
|
|
32
|
+
* {@link collectNotificationBadgeDeclarationViolations}.
|
|
12
33
|
*/
|
|
13
34
|
export declare const NotificationBadgeIdentifierSchema: z.ZodString;
|
|
14
35
|
/**
|
|
@@ -30,6 +51,22 @@ export declare const NotificationScopeSchema: z.ZodEnum<{
|
|
|
30
51
|
user_self: ResourcePrimaryScope.USER_SELF;
|
|
31
52
|
organizations: ResourcePrimaryScope.ORGANIZATIONS;
|
|
32
53
|
}>;
|
|
54
|
+
/**
|
|
55
|
+
* @wildo_source:part:start saas.models.notifications.badge-vocabularies facet:layer:shared facet:audience:app-developer
|
|
56
|
+
*
|
|
57
|
+
* The four vocabularies a badge definition picks from: how its count is CALCULATED, how it is
|
|
58
|
+
* PRESENTED, whether it draws attention, and — for a stored counter — what an operation does to it.
|
|
59
|
+
*
|
|
60
|
+
* ⚠️ **Choosing the source kind wrongly produces a number that DRIFTS.** Reach for `EVENT_COUNTER`
|
|
61
|
+
* only when the count is a fact the badge itself owns ("unread messages": arrive → increment, seen →
|
|
62
|
+
* reset). For any quantity derived from data an operation could change by another route — incomplete
|
|
63
|
+
* todos, unpaid invoices — use `DERIVED_QUERY`, which recomputes a live aggregate. A stored counter
|
|
64
|
+
* on a derived quantity is right on the day it is written and wrong thereafter.
|
|
65
|
+
*
|
|
66
|
+
* An `EVENT_COUNTER` badge additionally needs `notificationBadgeOperations` declared on the
|
|
67
|
+
* operations that move it; a `DERIVED_QUERY` badge needs none, because the recompute hangs off the
|
|
68
|
+
* source resource's own mutations.
|
|
69
|
+
*/
|
|
33
70
|
export declare enum NotificationBadgeOperation {
|
|
34
71
|
INCREMENT = "increment",
|
|
35
72
|
DECREMENT = "decrement",
|
|
@@ -71,6 +108,7 @@ export declare enum NotificationBadgePulse {
|
|
|
71
108
|
/** Persistent — pulse while the count is > 0. */
|
|
72
109
|
WHILE_ACTIVE = "while_active"
|
|
73
110
|
}
|
|
111
|
+
/** @wildo_source:part:end saas.models.notifications.badge-vocabularies */
|
|
74
112
|
/** EVENT_COUNTER source — no extra config; the stored counter is the truth. */
|
|
75
113
|
export declare const NotificationBadgeEventCounterSourceSchema: z.ZodObject<{
|
|
76
114
|
kind: z.ZodLiteral<NotificationBadgeSourceKind.EVENT_COUNTER>;
|
|
@@ -176,4 +214,128 @@ export type NotificationBadge = z.infer<typeof NotificationBadgeSchema>;
|
|
|
176
214
|
export type NotificationBadgeSource = z.infer<typeof NotificationBadgeSourceSchema>;
|
|
177
215
|
export type NotificationBadgeDerivedQuerySource = z.infer<typeof NotificationBadgeDerivedQuerySourceSchema>;
|
|
178
216
|
export type NotificationBadgeDisplay = z.infer<typeof NotificationBadgeDisplaySchema>;
|
|
217
|
+
/**
|
|
218
|
+
* A badge KEY: `<scope>:<identifier>` — the DEFINITION's identity, and the only thing that may be
|
|
219
|
+
* used to look a definition up.
|
|
220
|
+
*
|
|
221
|
+
* ## Why the identifier alone is not an identity
|
|
222
|
+
*
|
|
223
|
+
* A definition is `(scope, identifier)`. Nothing ever stopped two definitions declaring the same
|
|
224
|
+
* `identifier` at different scopes, and until this type existed every lookup matched on the
|
|
225
|
+
* identifier alone — so the second definition was unreachable and silently shared the first's
|
|
226
|
+
* count. The key makes both reachable and makes the collision that DOES matter (two definitions at
|
|
227
|
+
* one scope and identifier) something a boot check can refuse.
|
|
228
|
+
*
|
|
229
|
+
* ## Why `scopeId` is NOT in the key
|
|
230
|
+
*
|
|
231
|
+
* `scopeId` says WHOSE badge — a user id, an organization id. It is per-viewer instance data that a
|
|
232
|
+
* navigation declaration cannot possibly carry, and a browser session only ever receives pushes for
|
|
233
|
+
* its own scope ids (the backend routes USER badges to that user's socket and ORG badges to that
|
|
234
|
+
* organization's room). So the key is what a DECLARATION can name, and the reference below is what
|
|
235
|
+
* an INSTANCE is addressed by.
|
|
236
|
+
*/
|
|
237
|
+
export type NotificationBadgeKey = string;
|
|
238
|
+
/**
|
|
239
|
+
* A badge REFERENCE: `<scope>:<scopeId>:<identifier>` — one badge ROW, on the wire.
|
|
240
|
+
*
|
|
241
|
+
* Carried by `WS_BadgeUpdatePayload.badgeReference` because emission needs the scopeId to route.
|
|
242
|
+
* The browser reduces it to a {@link NotificationBadgeKey} on arrival via
|
|
243
|
+
* {@link notificationBadgeKeyFromReference}, which is what makes the store's key and the navigation
|
|
244
|
+
* item's lookup the same key rather than two conventions that agree by luck.
|
|
245
|
+
*/
|
|
246
|
+
export type NotificationBadgeReference = string;
|
|
247
|
+
/** Build the DEFINITION-identity key from its parts. */
|
|
248
|
+
export declare function buildNotificationBadgeKey(scope: NotificationScope, identifier: NotificationBadgeIdentifier): NotificationBadgeKey;
|
|
249
|
+
/**
|
|
250
|
+
* The key of a definition (or of anything else carrying a badge identity, such as a persisted row).
|
|
251
|
+
*
|
|
252
|
+
* Takes the identity fields rather than the whole definition so a `NotificationBadge` row and a
|
|
253
|
+
* `NotificationBadgeDefinition` resolve through the SAME function — a second copy for the row shape
|
|
254
|
+
* is how the two come to disagree.
|
|
255
|
+
*/
|
|
256
|
+
export declare function notificationBadgeIdentityKey(identity: Pick<NotificationBadgeDefinition, 'scope' | 'identifier'>): NotificationBadgeKey;
|
|
257
|
+
/**
|
|
258
|
+
* Parse a key, returning `null` when it is not a well-formed key at a SUPPORTED scope.
|
|
259
|
+
*
|
|
260
|
+
* The scope check is not cosmetic: the APPLICATION variant was dropped in the polymorphism refactor
|
|
261
|
+
* and no resource type backs it, so `application:foo` must fail here rather than reach a dispatch
|
|
262
|
+
* that has no repository for it.
|
|
263
|
+
*/
|
|
264
|
+
export declare function parseNotificationBadgeKey(key: string): {
|
|
265
|
+
scope: NotificationScope;
|
|
266
|
+
identifier: NotificationBadgeIdentifier;
|
|
267
|
+
} | null;
|
|
268
|
+
/** Build the INSTANCE address carried on the wire. */
|
|
269
|
+
export declare function buildNotificationBadgeReference(scope: NotificationScope, scopeId: string, identifier: NotificationBadgeIdentifier): NotificationBadgeReference;
|
|
270
|
+
/** Parse a wire reference, returning `null` for a malformed one or an unsupported scope. */
|
|
271
|
+
export declare function parseNotificationBadgeReference(reference: string): {
|
|
272
|
+
scope: NotificationScope;
|
|
273
|
+
scopeId: string;
|
|
274
|
+
identifier: NotificationBadgeIdentifier;
|
|
275
|
+
} | null;
|
|
276
|
+
/**
|
|
277
|
+
* Reduce a wire reference to the DEFINITION key it addresses — the one hop the browser badge store
|
|
278
|
+
* takes, so that what it keys on is what a navigation item resolves against.
|
|
279
|
+
*/
|
|
280
|
+
export declare function notificationBadgeKeyFromReference(reference: string): NotificationBadgeKey | null;
|
|
281
|
+
/** Whether a raw string names one of the two surviving badge scopes. */
|
|
282
|
+
export declare function isSupportedNotificationBadgeScope(scope: string): scope is NotificationScope;
|
|
283
|
+
/**
|
|
284
|
+
* Why a badge declaration is refused. A closed vocabulary with a named runtime source, so a
|
|
285
|
+
* diagnostic can be branched on and each member can carry its own explanation.
|
|
286
|
+
*/
|
|
287
|
+
export declare enum NotificationBadgeDeclarationViolationReason {
|
|
288
|
+
/**
|
|
289
|
+
* Two definitions declare the same `(scope, identifier)`. Every lookup resolves the FIRST, so
|
|
290
|
+
* the second is unreachable while silently sharing the first's count — the shape that made
|
|
291
|
+
* identifier-only lookup unsafe in the first place. Two definitions at DIFFERENT scopes are
|
|
292
|
+
* fine and are exactly what the key makes reachable.
|
|
293
|
+
*/
|
|
294
|
+
DUPLICATE_DEFINITION_KEY = "duplicate_definition_key",
|
|
295
|
+
/**
|
|
296
|
+
* An identifier contains the key separator, which would make its key and every reference built
|
|
297
|
+
* from it parse into the wrong parts. Refused rather than escaped: a positional format with an
|
|
298
|
+
* escaping rule is a format two implementations will eventually disagree about.
|
|
299
|
+
*/
|
|
300
|
+
IDENTIFIER_CONTAINS_KEY_SEPARATOR = "identifier_contains_key_separator",
|
|
301
|
+
/** An operation declares a `badgeRef` that names no registered definition. */
|
|
302
|
+
OPERATION_REF_UNRESOLVED = "operation_ref_unresolved"
|
|
303
|
+
}
|
|
304
|
+
/** One refused declaration, carrying enough to name the author's own file without re-deriving it. */
|
|
305
|
+
export interface NotificationBadgeDeclarationViolation {
|
|
306
|
+
reason: NotificationBadgeDeclarationViolationReason;
|
|
307
|
+
/** The badge key at issue — the definition's, or the unresolved `badgeRef` as authored. */
|
|
308
|
+
badgeKey: string;
|
|
309
|
+
/** Present when the violation belongs to a definition rather than to an operation declaration. */
|
|
310
|
+
identifier?: NotificationBadgeIdentifier;
|
|
311
|
+
/** Present when the violation belongs to an operation declaration. */
|
|
312
|
+
resourceType?: string;
|
|
313
|
+
/** Present when the violation belongs to an operation declaration. */
|
|
314
|
+
operationIdentifier?: string;
|
|
315
|
+
}
|
|
316
|
+
/** Where an operation declared a badge reference — one row per authored `notificationBadgeOperations` entry. */
|
|
317
|
+
export interface NotificationBadgeOperationDeclarationSite {
|
|
318
|
+
resourceType: string;
|
|
319
|
+
operationIdentifier: string;
|
|
320
|
+
badgeRef: string;
|
|
321
|
+
}
|
|
322
|
+
/**
|
|
323
|
+
* The whole declaration-coherence check, as a pure function over what an application declared.
|
|
324
|
+
*
|
|
325
|
+
* Pure and shared on purpose: the backend registry runs it as a fail-closed boot gate and the
|
|
326
|
+
* frontend launcher verifier reports it in development, and a second implementation is how the two
|
|
327
|
+
* come to disagree about what a valid declaration is.
|
|
328
|
+
*
|
|
329
|
+
* It answers the question `derive-before-you-ask.md` asks — who owes this, and what says so. The
|
|
330
|
+
* population is exactly the registered definitions plus every authored
|
|
331
|
+
* `notificationBadgeOperations` entry; nothing is inferred and nothing is sampled.
|
|
332
|
+
*/
|
|
333
|
+
export declare function collectNotificationBadgeDeclarationViolations(definitions: readonly NotificationBadgeDefinition[], operationSites?: readonly NotificationBadgeOperationDeclarationSite[]): NotificationBadgeDeclarationViolation[];
|
|
334
|
+
/**
|
|
335
|
+
* Index the registered definitions by key, so a dispatch resolves in one lookup rather than a scan.
|
|
336
|
+
*
|
|
337
|
+
* Built from the SAME key function the boot check uses, so a definition the boot check accepted is
|
|
338
|
+
* a definition this map can serve.
|
|
339
|
+
*/
|
|
340
|
+
export declare function buildNotificationBadgeDefinitionIndex(definitions: readonly NotificationBadgeDefinition[]): ReadonlyMap<NotificationBadgeKey, NotificationBadgeDefinition>;
|
|
179
341
|
//# sourceMappingURL=notification-badges.schemas.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notification-badges.schemas.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.schemas.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAKxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAG7E
|
|
1
|
+
{"version":3,"file":"notification-badges.schemas.d.ts","sourceRoot":"","sources":["../../../../src/notifications/notification-badges.schemas.ts"],"names":[],"mappings":"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"}
|
|
@@ -3,16 +3,42 @@ import { initZodDecorators } from '@wildo-ai/zod-decorators';
|
|
|
3
3
|
initZodDecorators(z);
|
|
4
4
|
import { IndicatorVariant } from '@wildo-ai/presets-components-models';
|
|
5
5
|
import { ResourcePrimaryScope } from "../resources/resources.shared.schemas.js";
|
|
6
|
+
/**
|
|
7
|
+
* The one character that separates the parts of a badge KEY and a badge REFERENCE.
|
|
8
|
+
*
|
|
9
|
+
* Both formats are positional, so the separator may not appear inside a part or the parse is
|
|
10
|
+
* ambiguous. `NotificationBadgeIdentifierSchema` refuses it in an identifier for exactly that
|
|
11
|
+
* reason, and `collectNotificationBadgeDeclarationViolations` re-states the refusal at boot,
|
|
12
|
+
* because a declaration object is authored in TypeScript and never `.parse()`d.
|
|
13
|
+
*/
|
|
14
|
+
export const NOTIFICATION_BADGE_KEY_SEPARATOR = ':';
|
|
15
|
+
/** Any string that does not contain {@link NOTIFICATION_BADGE_KEY_SEPARATOR}. */
|
|
16
|
+
export const NOTIFICATION_BADGE_IDENTIFIER_PATTERN = /^[^:]+$/;
|
|
6
17
|
/**
|
|
7
18
|
* Notification badge identifier.
|
|
8
19
|
*
|
|
9
|
-
*
|
|
10
|
-
* (`new messages` / `unpaid invoices`) were removed because nothing
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
20
|
+
* The identifier is an open string because no canonical (core) identifier ships: the two
|
|
21
|
+
* aspirational placeholders (`new messages` / `unpaid invoices`) were removed because nothing
|
|
22
|
+
* produced them.
|
|
23
|
+
*
|
|
24
|
+
* The SURFACING is not missing. A navigation item declares `notificationBadgeRef` and the sidebar
|
|
25
|
+
* renders it, and an application declares its own badges, so the open string is what an application
|
|
26
|
+
* uses today. What is still absent is a FRAMEWORK-shipped identifier with a framework producer
|
|
27
|
+
* behind it; when one lands, core identifiers come back as a `CoreNotificationBadgeIdentifiers`
|
|
28
|
+
* enum unioned in here.
|
|
29
|
+
*
|
|
30
|
+
* Open, but not unconstrained: an identifier may not contain
|
|
31
|
+
* {@link NOTIFICATION_BADGE_KEY_SEPARATOR}, because it is the LAST part of a badge key and of a
|
|
32
|
+
* badge reference and both are positional. A definition object is authored in TypeScript and never
|
|
33
|
+
* `.parse()`d, so this constraint is also re-stated as a boot check — see
|
|
34
|
+
* {@link collectNotificationBadgeDeclarationViolations}.
|
|
14
35
|
*/
|
|
15
|
-
export const NotificationBadgeIdentifierSchema = z
|
|
36
|
+
export const NotificationBadgeIdentifierSchema = z
|
|
37
|
+
.string()
|
|
38
|
+
.min(1, { error: 'Notification badge identifier is required' })
|
|
39
|
+
.regex(NOTIFICATION_BADGE_IDENTIFIER_PATTERN, {
|
|
40
|
+
error: `Notification badge identifier must not contain "${NOTIFICATION_BADGE_KEY_SEPARATOR}" — that character separates the parts of a badge key and reference`,
|
|
41
|
+
});
|
|
16
42
|
/**
|
|
17
43
|
* Notification badge scope. Tightened to USER_SELF | ORGANIZATIONS only.
|
|
18
44
|
*
|
|
@@ -32,6 +58,22 @@ export const NotificationScopeSchema = z.enum([
|
|
|
32
58
|
ResourcePrimaryScope.USER_SELF,
|
|
33
59
|
ResourcePrimaryScope.ORGANIZATIONS,
|
|
34
60
|
]);
|
|
61
|
+
/**
|
|
62
|
+
* @wildo_source:part:start saas.models.notifications.badge-vocabularies facet:layer:shared facet:audience:app-developer
|
|
63
|
+
*
|
|
64
|
+
* The four vocabularies a badge definition picks from: how its count is CALCULATED, how it is
|
|
65
|
+
* PRESENTED, whether it draws attention, and — for a stored counter — what an operation does to it.
|
|
66
|
+
*
|
|
67
|
+
* ⚠️ **Choosing the source kind wrongly produces a number that DRIFTS.** Reach for `EVENT_COUNTER`
|
|
68
|
+
* only when the count is a fact the badge itself owns ("unread messages": arrive → increment, seen →
|
|
69
|
+
* reset). For any quantity derived from data an operation could change by another route — incomplete
|
|
70
|
+
* todos, unpaid invoices — use `DERIVED_QUERY`, which recomputes a live aggregate. A stored counter
|
|
71
|
+
* on a derived quantity is right on the day it is written and wrong thereafter.
|
|
72
|
+
*
|
|
73
|
+
* An `EVENT_COUNTER` badge additionally needs `notificationBadgeOperations` declared on the
|
|
74
|
+
* operations that move it; a `DERIVED_QUERY` badge needs none, because the recompute hangs off the
|
|
75
|
+
* source resource's own mutations.
|
|
76
|
+
*/
|
|
35
77
|
export var NotificationBadgeOperation;
|
|
36
78
|
(function (NotificationBadgeOperation) {
|
|
37
79
|
NotificationBadgeOperation["INCREMENT"] = "increment";
|
|
@@ -77,6 +119,7 @@ export var NotificationBadgePulse;
|
|
|
77
119
|
/** Persistent — pulse while the count is > 0. */
|
|
78
120
|
NotificationBadgePulse["WHILE_ACTIVE"] = "while_active";
|
|
79
121
|
})(NotificationBadgePulse || (NotificationBadgePulse = {}));
|
|
122
|
+
/** @wildo_source:part:end saas.models.notifications.badge-vocabularies */
|
|
80
123
|
/** EVENT_COUNTER source — no extra config; the stored counter is the truth. */
|
|
81
124
|
export const NotificationBadgeEventCounterSourceSchema = z.object({
|
|
82
125
|
kind: z.literal(NotificationBadgeSourceKind.EVENT_COUNTER),
|
|
@@ -156,4 +199,146 @@ export const NotificationBadgeSchema = z.discriminatedUnion('scope', [
|
|
|
156
199
|
NotificationBadgeOrganizationSchema,
|
|
157
200
|
NotificationBadgeUserSelfSchema,
|
|
158
201
|
]);
|
|
202
|
+
/** Build the DEFINITION-identity key from its parts. */
|
|
203
|
+
export function buildNotificationBadgeKey(scope, identifier) {
|
|
204
|
+
return `${scope}${NOTIFICATION_BADGE_KEY_SEPARATOR}${identifier}`;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* The key of a definition (or of anything else carrying a badge identity, such as a persisted row).
|
|
208
|
+
*
|
|
209
|
+
* Takes the identity fields rather than the whole definition so a `NotificationBadge` row and a
|
|
210
|
+
* `NotificationBadgeDefinition` resolve through the SAME function — a second copy for the row shape
|
|
211
|
+
* is how the two come to disagree.
|
|
212
|
+
*/
|
|
213
|
+
export function notificationBadgeIdentityKey(identity) {
|
|
214
|
+
return buildNotificationBadgeKey(identity.scope, identity.identifier);
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Parse a key, returning `null` when it is not a well-formed key at a SUPPORTED scope.
|
|
218
|
+
*
|
|
219
|
+
* The scope check is not cosmetic: the APPLICATION variant was dropped in the polymorphism refactor
|
|
220
|
+
* and no resource type backs it, so `application:foo` must fail here rather than reach a dispatch
|
|
221
|
+
* that has no repository for it.
|
|
222
|
+
*/
|
|
223
|
+
export function parseNotificationBadgeKey(key) {
|
|
224
|
+
const parts = key.split(NOTIFICATION_BADGE_KEY_SEPARATOR);
|
|
225
|
+
if (parts.length !== 2)
|
|
226
|
+
return null;
|
|
227
|
+
const [scope, identifier] = parts;
|
|
228
|
+
if (!isSupportedNotificationBadgeScope(scope) || identifier.length === 0)
|
|
229
|
+
return null;
|
|
230
|
+
return { scope, identifier };
|
|
231
|
+
}
|
|
232
|
+
/** Build the INSTANCE address carried on the wire. */
|
|
233
|
+
export function buildNotificationBadgeReference(scope, scopeId, identifier) {
|
|
234
|
+
return `${scope}${NOTIFICATION_BADGE_KEY_SEPARATOR}${scopeId}${NOTIFICATION_BADGE_KEY_SEPARATOR}${identifier}`;
|
|
235
|
+
}
|
|
236
|
+
/** Parse a wire reference, returning `null` for a malformed one or an unsupported scope. */
|
|
237
|
+
export function parseNotificationBadgeReference(reference) {
|
|
238
|
+
const parts = reference.split(NOTIFICATION_BADGE_KEY_SEPARATOR);
|
|
239
|
+
if (parts.length !== 3)
|
|
240
|
+
return null;
|
|
241
|
+
const [scope, scopeId, identifier] = parts;
|
|
242
|
+
if (!isSupportedNotificationBadgeScope(scope) || scopeId.length === 0 || identifier.length === 0)
|
|
243
|
+
return null;
|
|
244
|
+
return { scope, scopeId, identifier };
|
|
245
|
+
}
|
|
246
|
+
/**
|
|
247
|
+
* Reduce a wire reference to the DEFINITION key it addresses — the one hop the browser badge store
|
|
248
|
+
* takes, so that what it keys on is what a navigation item resolves against.
|
|
249
|
+
*/
|
|
250
|
+
export function notificationBadgeKeyFromReference(reference) {
|
|
251
|
+
const parsed = parseNotificationBadgeReference(reference);
|
|
252
|
+
return parsed ? buildNotificationBadgeKey(parsed.scope, parsed.identifier) : null;
|
|
253
|
+
}
|
|
254
|
+
/** Whether a raw string names one of the two surviving badge scopes. */
|
|
255
|
+
export function isSupportedNotificationBadgeScope(scope) {
|
|
256
|
+
return scope === ResourcePrimaryScope.USER_SELF || scope === ResourcePrimaryScope.ORGANIZATIONS;
|
|
257
|
+
}
|
|
258
|
+
// ════════════════════════════════════════════════════════════════
|
|
259
|
+
// Declaration coherence — checked at CONFIGURATION time
|
|
260
|
+
// ════════════════════════════════════════════════════════════════
|
|
261
|
+
/**
|
|
262
|
+
* Why a badge declaration is refused. A closed vocabulary with a named runtime source, so a
|
|
263
|
+
* diagnostic can be branched on and each member can carry its own explanation.
|
|
264
|
+
*/
|
|
265
|
+
export var NotificationBadgeDeclarationViolationReason;
|
|
266
|
+
(function (NotificationBadgeDeclarationViolationReason) {
|
|
267
|
+
/**
|
|
268
|
+
* Two definitions declare the same `(scope, identifier)`. Every lookup resolves the FIRST, so
|
|
269
|
+
* the second is unreachable while silently sharing the first's count — the shape that made
|
|
270
|
+
* identifier-only lookup unsafe in the first place. Two definitions at DIFFERENT scopes are
|
|
271
|
+
* fine and are exactly what the key makes reachable.
|
|
272
|
+
*/
|
|
273
|
+
NotificationBadgeDeclarationViolationReason["DUPLICATE_DEFINITION_KEY"] = "duplicate_definition_key";
|
|
274
|
+
/**
|
|
275
|
+
* An identifier contains the key separator, which would make its key and every reference built
|
|
276
|
+
* from it parse into the wrong parts. Refused rather than escaped: a positional format with an
|
|
277
|
+
* escaping rule is a format two implementations will eventually disagree about.
|
|
278
|
+
*/
|
|
279
|
+
NotificationBadgeDeclarationViolationReason["IDENTIFIER_CONTAINS_KEY_SEPARATOR"] = "identifier_contains_key_separator";
|
|
280
|
+
/** An operation declares a `badgeRef` that names no registered definition. */
|
|
281
|
+
NotificationBadgeDeclarationViolationReason["OPERATION_REF_UNRESOLVED"] = "operation_ref_unresolved";
|
|
282
|
+
})(NotificationBadgeDeclarationViolationReason || (NotificationBadgeDeclarationViolationReason = {}));
|
|
283
|
+
/**
|
|
284
|
+
* The whole declaration-coherence check, as a pure function over what an application declared.
|
|
285
|
+
*
|
|
286
|
+
* Pure and shared on purpose: the backend registry runs it as a fail-closed boot gate and the
|
|
287
|
+
* frontend launcher verifier reports it in development, and a second implementation is how the two
|
|
288
|
+
* come to disagree about what a valid declaration is.
|
|
289
|
+
*
|
|
290
|
+
* It answers the question `derive-before-you-ask.md` asks — who owes this, and what says so. The
|
|
291
|
+
* population is exactly the registered definitions plus every authored
|
|
292
|
+
* `notificationBadgeOperations` entry; nothing is inferred and nothing is sampled.
|
|
293
|
+
*/
|
|
294
|
+
export function collectNotificationBadgeDeclarationViolations(definitions, operationSites = []) {
|
|
295
|
+
const violations = [];
|
|
296
|
+
const seenKeys = new Set();
|
|
297
|
+
for (const definition of definitions) {
|
|
298
|
+
if (!NOTIFICATION_BADGE_IDENTIFIER_PATTERN.test(definition.identifier)) {
|
|
299
|
+
violations.push({
|
|
300
|
+
reason: NotificationBadgeDeclarationViolationReason.IDENTIFIER_CONTAINS_KEY_SEPARATOR,
|
|
301
|
+
badgeKey: notificationBadgeIdentityKey(definition),
|
|
302
|
+
identifier: definition.identifier,
|
|
303
|
+
});
|
|
304
|
+
// Still recorded below, so a malformed identifier declared twice is reported as both.
|
|
305
|
+
}
|
|
306
|
+
const key = notificationBadgeIdentityKey(definition);
|
|
307
|
+
if (seenKeys.has(key)) {
|
|
308
|
+
violations.push({
|
|
309
|
+
reason: NotificationBadgeDeclarationViolationReason.DUPLICATE_DEFINITION_KEY,
|
|
310
|
+
badgeKey: key,
|
|
311
|
+
identifier: definition.identifier,
|
|
312
|
+
});
|
|
313
|
+
continue;
|
|
314
|
+
}
|
|
315
|
+
seenKeys.add(key);
|
|
316
|
+
}
|
|
317
|
+
for (const site of operationSites) {
|
|
318
|
+
if (!seenKeys.has(site.badgeRef)) {
|
|
319
|
+
violations.push({
|
|
320
|
+
reason: NotificationBadgeDeclarationViolationReason.OPERATION_REF_UNRESOLVED,
|
|
321
|
+
badgeKey: site.badgeRef,
|
|
322
|
+
resourceType: site.resourceType,
|
|
323
|
+
operationIdentifier: site.operationIdentifier,
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return violations;
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Index the registered definitions by key, so a dispatch resolves in one lookup rather than a scan.
|
|
331
|
+
*
|
|
332
|
+
* Built from the SAME key function the boot check uses, so a definition the boot check accepted is
|
|
333
|
+
* a definition this map can serve.
|
|
334
|
+
*/
|
|
335
|
+
export function buildNotificationBadgeDefinitionIndex(definitions) {
|
|
336
|
+
const index = new Map();
|
|
337
|
+
for (const definition of definitions) {
|
|
338
|
+
const key = notificationBadgeIdentityKey(definition);
|
|
339
|
+
if (!index.has(key))
|
|
340
|
+
index.set(key, definition);
|
|
341
|
+
}
|
|
342
|
+
return index;
|
|
343
|
+
}
|
|
159
344
|
//# sourceMappingURL=notification-badges.schemas.js.map
|