@wildo-ai/saas-specifications 1.1.12 → 1.1.14

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.
Files changed (121) hide show
  1. package/dist/esm/_core/application-maturity/application-maturity-open-items.d.ts +48 -0
  2. package/dist/esm/_core/application-maturity/application-maturity-open-items.d.ts.map +1 -0
  3. package/dist/esm/_core/application-maturity/application-maturity-open-items.js +69 -0
  4. package/dist/esm/_core/application-maturity/application-maturity-open-items.js.map +1 -0
  5. package/dist/esm/_core/application-maturity/application-maturity-validation.d.ts +5 -0
  6. package/dist/esm/_core/application-maturity/application-maturity-validation.d.ts.map +1 -1
  7. package/dist/esm/_core/application-maturity/application-maturity-validation.js +12 -0
  8. package/dist/esm/_core/application-maturity/application-maturity-validation.js.map +1 -1
  9. package/dist/esm/_core/application-maturity/application-maturity.schemas.d.ts +41 -0
  10. package/dist/esm/_core/application-maturity/application-maturity.schemas.d.ts.map +1 -1
  11. package/dist/esm/_core/application-maturity/application-maturity.schemas.js +41 -0
  12. package/dist/esm/_core/application-maturity/application-maturity.schemas.js.map +1 -1
  13. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.d.ts.map +1 -1
  14. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js +28 -5
  15. package/dist/esm/_core/compliance-documents/computed-document-facts.schemas.js.map +1 -1
  16. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts +28 -3
  17. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.d.ts.map +1 -1
  18. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js +32 -2
  19. package/dist/esm/_core/compliance-documents/launch-blockers.schemas.js.map +1 -1
  20. package/dist/esm/_core/compliance-documents/processor-register.schemas.d.ts +4 -0
  21. package/dist/esm/_core/compliance-documents/processor-register.schemas.d.ts.map +1 -1
  22. package/dist/esm/_core/compliance-documents/processor-register.schemas.js +10 -0
  23. package/dist/esm/_core/compliance-documents/processor-register.schemas.js.map +1 -1
  24. package/dist/esm/_core/index.d.ts +2 -0
  25. package/dist/esm/_core/index.d.ts.map +1 -1
  26. package/dist/esm/_core/index.js +2 -0
  27. package/dist/esm/_core/index.js.map +1 -1
  28. package/dist/esm/_core/requirements/functional-requirement.schemas.d.ts +2 -0
  29. package/dist/esm/_core/requirements/functional-requirement.schemas.d.ts.map +1 -1
  30. package/dist/esm/_core/requirements/functional-requirement.schemas.js +12 -0
  31. package/dist/esm/_core/requirements/functional-requirement.schemas.js.map +1 -1
  32. package/dist/esm/_core/requirements/non-functional-requirement.schemas.d.ts +2 -0
  33. package/dist/esm/_core/requirements/non-functional-requirement.schemas.d.ts.map +1 -1
  34. package/dist/esm/_core/requirements/non-functional-requirement.schemas.js +12 -0
  35. package/dist/esm/_core/requirements/non-functional-requirement.schemas.js.map +1 -1
  36. package/dist/esm/_core/requirements/requirement-engine-substance.schemas.d.ts +33 -0
  37. package/dist/esm/_core/requirements/requirement-engine-substance.schemas.d.ts.map +1 -0
  38. package/dist/esm/_core/requirements/requirement-engine-substance.schemas.js +34 -0
  39. package/dist/esm/_core/requirements/requirement-engine-substance.schemas.js.map +1 -0
  40. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts +8 -0
  41. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.d.ts.map +1 -1
  42. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js +13 -1
  43. package/dist/esm/_core/requirements/requirements-snapshot-generation.schemas.js.map +1 -1
  44. package/dist/esm/_core/requirements/requirements-snapshot.schemas.d.ts +4 -0
  45. package/dist/esm/_core/requirements/requirements-snapshot.schemas.d.ts.map +1 -1
  46. package/dist/esm/application-creation.exports.d.ts +2 -0
  47. package/dist/esm/application-creation.exports.d.ts.map +1 -1
  48. package/dist/esm/application-creation.exports.js +2 -0
  49. package/dist/esm/application-creation.exports.js.map +1 -1
  50. package/dist/esm/assurance/assurance-open-compliance-coverage-pack.d.ts +7 -0
  51. package/dist/esm/assurance/assurance-open-compliance-coverage-pack.d.ts.map +1 -1
  52. package/dist/esm/assurance/assurance-open-compliance-coverage-pack.js +46 -25
  53. package/dist/esm/assurance/assurance-open-compliance-coverage-pack.js.map +1 -1
  54. package/dist/esm/assurance/assurance-source-requirement-inventory.definitions.d.ts.map +1 -1
  55. package/dist/esm/assurance/assurance-source-requirement-inventory.definitions.js +30 -3
  56. package/dist/esm/assurance/assurance-source-requirement-inventory.definitions.js.map +1 -1
  57. package/dist/esm/engine/applications/resources/applications.resource.specification.d.ts +1 -0
  58. package/dist/esm/engine/applications/resources/applications.resource.specification.d.ts.map +1 -1
  59. package/dist/esm/engine/applications/resources/applications.resource.specification.js +1 -1
  60. package/dist/esm/engine/applications/resources/applications.resource.specification.js.map +1 -1
  61. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.d.ts.map +1 -1
  62. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.js +2 -1
  63. package/dist/esm/engine/auth/resources/application-access-grants.resource.specification.js.map +1 -1
  64. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.d.ts.map +1 -1
  65. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.js +6 -2
  66. package/dist/esm/engine/compliance/resources/data-subject-requests.resource.specification.js.map +1 -1
  67. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.d.ts.map +1 -1
  68. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.js +6 -5
  69. package/dist/esm/engine/compliance/resources/siem-delivery-dlq.resource.specification.js.map +1 -1
  70. package/dist/esm/engine/engine-resource-specifications.registry.d.ts.map +1 -1
  71. package/dist/esm/engine/engine-resource-specifications.registry.js +4 -0
  72. package/dist/esm/engine/engine-resource-specifications.registry.js.map +1 -1
  73. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.d.ts +4 -0
  74. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.d.ts.map +1 -0
  75. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js +29 -0
  76. package/dist/esm/engine/frontend-components/data-display/approval-seal.frontend-component.specification.js.map +1 -0
  77. package/dist/esm/engine/frontend-components/data-display/formatters/display-field-file.frontend-component.specification.js +1 -1
  78. package/dist/esm/engine/frontend-components/data-display/formatters/display-field-file.frontend-component.specification.js.map +1 -1
  79. package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js +1 -1
  80. package/dist/esm/engine/frontend-components/flows-actors/low-level-ai-approval.frontend-component.specification.js.map +1 -1
  81. package/dist/esm/engine/frontend-components/high-level-views/high-level-views-chart-dashboard-layout-editor.frontend-component.specification.d.ts +4 -0
  82. package/dist/esm/engine/frontend-components/high-level-views/high-level-views-chart-dashboard-layout-editor.frontend-component.specification.d.ts.map +1 -0
  83. package/dist/esm/engine/frontend-components/high-level-views/high-level-views-chart-dashboard-layout-editor.frontend-component.specification.js +22 -0
  84. package/dist/esm/engine/frontend-components/high-level-views/high-level-views-chart-dashboard-layout-editor.frontend-component.specification.js.map +1 -0
  85. package/dist/esm/engine/frontend-components/index.d.ts +1 -0
  86. package/dist/esm/engine/frontend-components/index.d.ts.map +1 -1
  87. package/dist/esm/engine/frontend-components/index.js +5 -0
  88. package/dist/esm/engine/frontend-components/index.js.map +1 -1
  89. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.d.ts +9 -0
  90. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.d.ts.map +1 -0
  91. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.js +136 -0
  92. package/dist/esm/engine/infrastructure/resources/queue-messages.resource.specification.js.map +1 -0
  93. package/dist/esm/engine/notifications/resources/inbound-deliveries.resource.specification.d.ts +10 -0
  94. package/dist/esm/engine/notifications/resources/inbound-deliveries.resource.specification.d.ts.map +1 -1
  95. package/dist/esm/engine/notifications/resources/inbound-deliveries.resource.specification.js +10 -1
  96. package/dist/esm/engine/notifications/resources/inbound-deliveries.resource.specification.js.map +1 -1
  97. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.d.ts.map +1 -1
  98. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.js +4 -2
  99. package/dist/esm/engine/notifications/resources/inbound-email.resource.specification.js.map +1 -1
  100. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.d.ts.map +1 -1
  101. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js +6 -5
  102. package/dist/esm/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.js.map +1 -1
  103. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.d.ts.map +1 -1
  104. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.js +2 -1
  105. package/dist/esm/engine/organizations/resources/organization-custom-domains.resource.specification.js.map +1 -1
  106. package/dist/esm/engine/organizations/resources/organization-dashboard-layouts.resource.specification.d.ts +30 -0
  107. package/dist/esm/engine/organizations/resources/organization-dashboard-layouts.resource.specification.d.ts.map +1 -0
  108. package/dist/esm/engine/organizations/resources/organization-dashboard-layouts.resource.specification.js +131 -0
  109. package/dist/esm/engine/organizations/resources/organization-dashboard-layouts.resource.specification.js.map +1 -0
  110. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.d.ts.map +1 -1
  111. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js +10 -7
  112. package/dist/esm/engine/organizations/resources/organization-members.resource.specification.js.map +1 -1
  113. package/dist/esm/engine/organizations/resources/organizations.resource.specification.d.ts +1 -0
  114. package/dist/esm/engine/organizations/resources/organizations.resource.specification.d.ts.map +1 -1
  115. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js +7 -7
  116. package/dist/esm/engine/organizations/resources/organizations.resource.specification.js.map +1 -1
  117. package/dist/esm/engine/users/resources/inbound-contacts.resource.specification.d.ts +2 -2
  118. package/dist/esm/engine/users/resources/users.resource.specification.js +1 -1
  119. package/dist/esm/engine/users/resources/users.resource.specification.js.map +1 -1
  120. package/dist/tsconfig.build.tsbuildinfo +1 -1
  121. package/package.json +9 -9
@@ -1 +1 @@
1
- {"version":3,"file":"m2m-webhook-delivery-log.resource.specification.js","sourceRoot":"","sources":["../../../../../src/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,yCAAyC,GAC1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAoC,MAAM,6BAA6B,CAAC;AAC9H,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAU3E,MAAM,kCAAkC,GAA6D;IACnG,CAAC,gBAAgB,CAAC,qCAAqC,CAAC,EAAE,oBAAoB,CAAC,aAAa;IAC5F,CAAC,gBAAgB,CAAC,oCAAoC,CAAC,EAAE,oBAAoB,CAAC,WAAW;CAC1F,CAAC;AAgBF,SAAS,uCAAuC,CAC9C,YAAwC,EACxC,UAA4C;IAE5C,MAAM,mBAAmB,GAAG,YAAY,KAAK,gBAAgB,CAAC,qCAAqC,CAAC;IACpG,MAAM,aAAa,GAAG,mBAAmB;QACvC,CAAC,CAAC,EAAE,cAAc,EAAE,gBAAgB,EAAE;QACtC,CAAC,CAAC,EAAE,aAAa,EAAE,gBAAgB,EAAE,CAAC;IACxC,MAAM,OAAO,GAAG,mBAAmB;QACjC,CAAC,CAAC,0BAA0B,CAAC,oBAAoB;QACjD,CAAC,CAAC,0BAA0B,CAAC,mBAAmB,CAAC;IACnD,MAAM,gBAAgB,GAAG;QACvB,GAAG,EAAE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AChH,SAAS,EAAE,mGAAmG;gBAC9G,UAAU,EAAE,uBAAuB,CAAC,OAAO;gBAC3C,gBAAgB,EAAE;oBAChB,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,qHAAqH,EAAE;iBACxK;gBACD,cAAc,EAAE;oBACd,EAAE,IAAI,EAAE,sBAAsB,CAAC,eAAe,EAAE,IAAI,EAAE,yGAAyG,EAAE;oBACjK,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,+FAA+F,EAAE;iBACtJ;gBACD,UAAU,EAAE,KAAK;gBACjB,QAAQ,EAAE,CAAC;wBACT,KAAK,EAAE,oDAAoD;wBAC3D,OAAO,EAAE,EAAE,aAAa,EAAE,EAAE,EAAE;wBAC9B,QAAQ,EAAE;4BACR,WAAW,EAAE,EAAE;4BACf,OAAO,EAAE,qEAAqE;yBAC/E;wBACD,SAAS,EAAE,sBAAsB,CAAC,MAAM;qBACzC,CAAC;aACH;SACF;QACD,mBAAmB,EAAE;YACnB,sQAAsQ;YACtQ,gJAAgJ;YAChJ,qKAAqK;SACtK;KACF,CAAC,EACF,EAAE,oBAAoB,EAAE,kCAAkC,CAAC,YAAY,CAAC,EAAE,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sDAAsD,GAAG,uCAAuC,CAC3G,gBAAgB,CAAC,qCAAqC,EACtD,uCAAuC,CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,qDAAqD,GAAG,uCAAuC,CAC1G,gBAAgB,CAAC,oCAAoC,EACrD,sCAAsC,CACvC,CAAC","sourcesContent":["/**\n * Resources: `organizationM2mWebhookDeliveryLog` + `applicationM2mWebhookDeliveryLog` — Wildo SaaS engine specification (backend-only).\n *\n * Polymorphic ORG + APP pair sharing `M2MWebhookDeliveryLogBaseSchema` and `m2mWebhookDeliveryLogPolymorphicFactories`.\n *\n * Inputs:\n * - Base schema: `M2MWebhookDeliveryLogBaseSchema` (`m2m-webhook-delivery-log.shared.schemas.ts`)\n * - Polymorphic factories: `m2mWebhookDeliveryLogPolymorphicFactories` (`m2m-webhook-delivery-log.shared.resources-config.schemas.ts`)\n * - Custom operations: `M2MWebhookDeliveryLog_Operations` (`retry`, `purgeOld`)\n * - UI presets: `webhooksMainPresets` / `webhooksAdminPresets`\n * (engine/presets-components/src/config/resources/webhooks.resource-presets.tsx) —\n * a section-less layout surfaced in the org Settings Hub `webhooks` section\n * (Delivery log sub-tab), dashboard-style via generic collection capabilities:\n * status quick-filter tab strip (`collectionDisplayConfig.quickFilterField`)\n * + day-bucket date headings (`temporalGroupField: 'createdAt'`) on LIST,\n * EMBEDDED READ (row click → companion drawer): the resource · operation as the\n * title and the status badge on the facts line under it, then one flat list of facts with empty\n * rows hidden, and the opaque `payload` last, unlabelled, as pretty JSON.\n * Cards show the status, URL, labelled attempt count and failure reason.\n * `retry` / `purgeOld` actions.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport {\n CodeDeclarationKind,\n CodeSymbolKind,\n FieldSemanticImportance,\n} from '@wildo-ai/zod-decorators';\nimport {\n CoreM2MNotificationChannel,\n CoreResourceOperation as Op,\n CoreResourceType,\n M2MWebhookDeliveryLog_Operations,\n M2MWebhookDeliveryLogBaseSchema,\n M2MWebhookDeliveryLogStatus,\n M2MWebhookEventType,\n ResourcePrimaryScope,\n m2mWebhookDeliveryLogPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification, type ResourceSpecificationConfig } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype M2mDeliveryLogResourceType =\n | CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG\n | CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG;\n\ntype M2mDeliveryLogResourceTypeMember =\n | 'ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG'\n | 'APPLICATION_M2M_WEBHOOK_DELIVERY_LOG';\n\nconst m2mDeliveryLogResourcePrimaryScope: Record<M2mDeliveryLogResourceType, ResourcePrimaryScope> = {\n [CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG]: ResourcePrimaryScope.APPLICATION,\n};\n\ntype M2mDeliveryFactoryCfg = ReturnType<\n (typeof m2mWebhookDeliveryLogPolymorphicFactories)[CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG]\n>;\ntype M2mDeliveryCustomOp = NonNullable<M2mDeliveryFactoryCfg['customOperation']>;\ntype M2mDeliveryCoreOp =\n | Op.READ\n | Op.LIST\n | Op.SEARCH\n | Op.CREATE\n | Op.UPDATE\n | Op.DELETE\n | Op.DELETE_MANY;\ntype M2mDeliveryMain = typeof M2MWebhookDeliveryLogBaseSchema;\n\nfunction buildM2mWebhookDeliveryLogSpecification(\n resourceType: M2mDeliveryLogResourceType,\n memberName: M2mDeliveryLogResourceTypeMember,\n): ResourceSpecificationConfig<M2mDeliveryCustomOp, M2mDeliveryCoreOp, M2mDeliveryMain> {\n const isOrganizationScope = resourceType === CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG;\n const scopeIdentity = isOrganizationScope\n ? { organizationId: 'org_01JEXAMPLE' }\n : { applicationId: 'app_01JEXAMPLE' };\n const channel = isOrganizationScope\n ? CoreM2MNotificationChannel.WEBHOOK_ORGANIZATION\n : CoreM2MNotificationChannel.WEBHOOK_APPLICATION;\n const deliveryIdentity = {\n _id: 'delivery_01JEXAMPLE',\n endpointId: 'orders-primary',\n channel,\n resourceIdentifier: 'orders',\n operationIdentifier: 'create',\n httpUrl: 'https://partners.example.com/webhooks/orders',\n payloadHash: '31da863f127a6c22b91b5cc85081c382b02039a9c8c4b30db2cc3172de31d2d8',\n payload: { event: 'order.created', orderId: 'order_01JEXAMPLE' },\n signatureJti: 'webhook-signature-01JEXAMPLE',\n createdAt: '2026-08-18T09:30:00.000Z',\n updatedAt: '2026-08-18T09:32:12.000Z',\n ...scopeIdentity,\n } as const;\n const failedDeliveryExample = {\n ...deliveryIdentity,\n status: M2MWebhookDeliveryLogStatus.FAILED,\n attemptCount: 5,\n lastAttemptAt: '2026-08-18T09:32:12.000Z',\n responseStatus: 503,\n responseBodyTruncated: 'Service temporarily unavailable',\n failureReason: 'The receiver returned HTTP 503 after the final retry.',\n failedAt: '2026-08-18T09:32:12.000Z',\n } as const;\n const retriedDeliveryExample = {\n ...deliveryIdentity,\n status: M2MWebhookDeliveryLogStatus.PENDING,\n attemptCount: 0,\n nextAttemptAt: '2026-08-18T09:35:00.000Z',\n } as const;\n const deliveryPageExample = {\n data: [failedDeliveryExample],\n pagination: { page: 1, limit: 20, total: 1, totalPages: 1 },\n } as const;\n\n return resourceSpecification<M2mDeliveryCustomOp, M2mDeliveryCoreOp, M2mDeliveryMain>(\n m2mWebhookDeliveryLogPolymorphicFactories[resourceType],\n M2MWebhookDeliveryLogBaseSchema,\n ({ schemaShape }) => ({\n purpose: 'Persist one record per outbound endpoint delivery (queue entry, attempt count, latest HTTP evidence, and signing metadata) for org- or app-scoped admin review and retry.',\n businessRole: 'The user-visible event log and the worker’s durable queue for asynchronous webhook delivery — one row per (scope × target endpoint × fire).',\n lifecycleRole: 'Rows move PENDING → IN_FLIGHT → DELIVERED, or PENDING/IN_FLIGHT → FAILED, with `attemptCount` and `nextAttemptAt` governing back-off; RETRY and PURGE_OLD custom ops re-queue or clean history.',\n audience: LabelAudience.DEVELOPER,\n subDomain: EngineResourceSubDomain.NOTIFICATIONS,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLogBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'm2mWebhookDeliveryLogPolymorphicFactories',\n symbolKind: CodeSymbolKind.FACTORY,\n },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceType',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n memberName,\n },\n operationVocabulary: {\n coreEnum: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceOperation',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n customEnum: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLog_Operations',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n },\n notes: [\n 'The polymorphism engine injects `organizationId` (ORG variant) or `applicationId` (APP variant) on the document — those FKs are not on the base Zod object.',\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({\n meaning: 'Unique id for a single delivery log record and lease token anchor for the worker.',\n importance: FieldSemanticImportance.PRIMARY,\n semanticRole: 'identifier',\n }),\n endpointId: schemaShape.endpointId.stringSpec({\n meaning: 'Stable FK to `webhookConfig.endpoints[].id` at enqueue time so historical records survive endpoint renames/URL changes.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n channel: schemaShape.channel.enumSpec({\n meaning: 'Which M2M channel the originating operation fired (must be compatible with the resource’s primary scope in the dispatcher).',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreM2MNotificationChannel',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n values: {\n [CoreM2MNotificationChannel.WEBHOOK_ORGANIZATION]: { meaning: 'Org-scoped outbound webhook (requires an org id in the execution context).' },\n [CoreM2MNotificationChannel.WEBHOOK_APPLICATION]: { meaning: 'App-scoped outbound webhook (resolves the app id from `appConfigService`).' },\n },\n }),\n eventType: schemaShape.eventType.enumSpec({\n meaning: 'What the delivery reports, sent as its event header so a receiver can route before parsing the body. A row written before events existed reported a completed operation, so that is its value.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookEventType',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n values: {\n [M2MWebhookEventType.OPERATION_COMPLETED]: { meaning: 'The operation succeeded: inline, or as a background run.' },\n [M2MWebhookEventType.OPERATION_FAILED]: { meaning: 'A background run of the operation failed.' },\n },\n }),\n jobId: schemaShape.jobId.stringSpec({\n meaning: 'The background job the delivery reports on: present for every `operation.failed`, and for an `operation.completed` produced by a background run. Absent for an inline call, which has no job.',\n semanticRole: 'code',\n }),\n resourceIdentifier: schemaShape.resourceIdentifier.stringSpec({\n meaning: 'Originating `CoreResourceType` string (or app resource key) that produced the M2M payload.',\n semanticRole: 'code',\n }),\n operationIdentifier: schemaShape.operationIdentifier.stringSpec({\n meaning: 'Operation or custom-op identifier that the serializer used when building the POST body (used for support correlation).',\n semanticRole: 'code',\n }),\n variantKey: schemaShape.variantKey.stringSpec({\n meaning: 'Optional default vs named operation variant, when the originating op exposed multiple API variants.',\n }),\n httpUrl: schemaShape.httpUrl.stringSpec({\n meaning: 'Snapshot of the destination URL captured when this delivery was queued (duplicated from the config so URL edits do not rewrite history).',\n importance: FieldSemanticImportance.PRIMARY,\n semanticRole: 'uri',\n }),\n payloadHash: schemaShape.payloadHash.stringSpec({\n meaning: 'SHA-256 of the JSON body, mirrored into the signed JWT and used to detect replays or tampering.',\n semanticRole: 'code',\n }),\n status: schemaShape.status.enumSpec({\n meaning: 'Current queue/delivery state for the worker and admin filters.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLogStatus',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.CONST_OBJECT,\n },\n values: {\n [M2MWebhookDeliveryLogStatus.PENDING]: { meaning: 'Record is either waiting in the queue or has been re-queued for another attempt after a transient failure.' },\n [M2MWebhookDeliveryLogStatus.IN_FLIGHT]: { meaning: 'A worker currently holds a lease and is trying to send the HTTP request.' },\n [M2MWebhookDeliveryLogStatus.DELIVERED]: { meaning: 'The consumer returned a 2xx acknowledgement; terminal delivery success. This does not establish whether the consumer verified the signature or completed downstream processing.' },\n [M2MWebhookDeliveryLogStatus.FAILED]: { meaning: 'Terminal failure: exhausted attempt budget or a non-retryable 4xx class error.' },\n },\n }),\n attemptCount: schemaShape.attemptCount.numberSpec({\n meaning: 'Number of send attempts (including successes that still increment the counter, per worker policy).',\n unit: 'count',\n }),\n lastAttemptAt: schemaShape.lastAttemptAt.dateSpec({\n meaning: 'When the most recent send attempt started or finished, depending on writer semantics.',\n temporalRole: 'occurred',\n }),\n nextAttemptAt: schemaShape.nextAttemptAt.dateSpec({\n meaning: 'When a PENDING delivery becomes eligible for retry; indexed with status for worker polling. Terminal rows can retain an earlier value, which does not schedule another attempt.',\n temporalRole: 'scheduled',\n }),\n responseStatus: schemaShape.responseStatus.numberSpec({\n meaning: 'Last observed HTTP status code (present even for successes for observability).',\n }),\n responseBodyTruncated: schemaShape.responseBodyTruncated.stringSpec({\n meaning: 'First 4 KB of the HTTP response (when captured) to help debug remote listener failures.',\n }),\n failureReason: schemaShape.failureReason.stringSpec({\n meaning: 'Human-readable last error string when `status=failed` (worker-set).',\n }),\n signatureJti: schemaShape.signatureJti.stringSpec({\n meaning: 'Stable delivery identity carried in the JWT `jti` claim inside `x-wildo-webhook-signature`. The receiver uses it to deduplicate retries; it is not a signing-key identifier.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n deliveredAt: schemaShape.deliveredAt.dateSpec({\n meaning: 'Timestamp when a terminal `delivered` state was recorded.',\n temporalRole: 'occurred',\n }),\n failedAt: schemaShape.failedAt.dateSpec({\n meaning: 'Timestamp when a terminal `failed` state was recorded.',\n temporalRole: 'occurred',\n }),\n createdAt: schemaShape.createdAt.dateSpec({\n meaning: 'When the record was enqueued (immutable upper bound for retention policies).',\n temporalRole: 'creation',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n updatedAt: schemaShape.updatedAt.dateSpec({\n meaning: 'When status / attempt counters / timestamps last changed for this id.',\n temporalRole: 'modified',\n }),\n },\n // `payload` is `z.unknown()`, which carries no spec decorators, so its meaning is declared\n // through the escape hatch rather than dropped.\n additionalFieldSpecs: [\n {\n fieldName: 'payload',\n specDecorator: 'objectSpec',\n params: {\n meaning: 'The exact JSON body that was sent, as text: the originating operation’s result as its API response returns it, without internal versioning metadata. `payloadHash` is the SHA-256 of this text.',\n whyItMatters: 'It carries whatever the resource row carried, routinely personal data, so treat it as sensitive.',\n },\n },\n ],\n operations: {\n [Op.READ]: {\n /*\n * `payload` is stored opaquely and is deliberately not broken into documented fields.\n * That is a storage decision the reader of this sentence does not need; what they DO\n * need is that it comes back whole and carries whatever the event carried.\n */\n purpose: 'Inspect one delivery attempt using the fields documented above (status, URL snapshot, hashes, HTTP evidence, correlation ids). The stored `payload` is returned whole rather than broken into documented fields — treat it as sensitive; see `businessConstraints`.',\n outcome: 'Operators can see whether a business event was delivered and, if not, the precise failure class.',\n whenToUse: 'Use when triaging a customer ticket referencing a `deliveryLogId` or `signatureJti`.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The delivery log record for the supplied id was found and its status, URL snapshot, HTTP evidence, and signing metadata are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id in this scope (never enqueued, or already removed by `purgeOld`).' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role; because `payload` may embed serialized customer data, reads are gated to roles that already see that data (see `businessConstraints`).' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect a failed order webhook delivery',\n response: failedDeliveryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: { examples: [] },\n summary: { examples: [] },\n },\n },\n [Op.LIST]: {\n purpose: 'Browse recent delivery attempts in chronological order, filtered by the repository’s search defaults.',\n outcome: 'Admins can scan for spikes in `failed` rows or revalidation after URL rotation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of delivery log records in this scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to browse the delivery log (rows may carry serialized customer payloads).' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse recent delivery attempts',\n request: { page: 1, limit: 20, sort: 'createdAt:desc' },\n response: deliveryPageExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: { examples: [] },\n summary: { examples: [] },\n },\n },\n [Op.SEARCH]: {\n purpose: 'Filter log rows on status, `endpointId`, channel, date windows, and operation identifiers to isolate incidents.',\n outcome: 'Security and ops can produce CSV-grade subsets without an external data warehouse in small deployments.',\n whenToUse: 'Use in admin dashboards; heavy analytics may still go to a warehouse — this is the operational “small query” path.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of delivery log records matching the status / endpoint / channel / date-window / operation filters.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to search the delivery log.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Find failures for one endpoint',\n request: {\n q: 'orders',\n status: M2MWebhookDeliveryLogStatus.FAILED,\n channel,\n endpointId: 'orders-primary',\n page: 1,\n limit: 20,\n sort: 'createdAt:desc',\n },\n response: deliveryPageExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [Op.CREATE]: {\n purpose: 'Enqueue a new delivery row when a resource operation with an M2M channel fires.',\n outcome: 'The worker pool can find ready rows via the `(status, nextAttemptAt)` index.',\n whenToUse: 'Repository-only: invoked by the dispatcher, never by a human HTTP client.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A `pending` delivery record was enqueued and is now discoverable by the worker pool. Internal/service write path — the dispatcher fires this, never a human HTTP client.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The enqueue payload fails schema validation (e.g. missing `endpointId`, `httpUrl`, or `channel`).' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-dispatcher caller attempts to enqueue a delivery row directly.' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Drive the delivery lifecycle status transitions (PENDING → IN_FLIGHT → DELIVERED/FAILED) with `attemptCount` / `nextAttemptAt` / terminal-timestamp writes.',\n outcome: 'The worker can advance a row through its lifecycle so the `(status, nextAttemptAt)` index stays accurate for polling and back-off.',\n whenToUse: 'Repository-only: invoked by the dispatcher/worker (`markInFlight` / `markDelivered` / `markFailedAttempt` / `markFinallyFailed`), never by a human HTTP client — admins act via the `RETRY` custom operation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The delivery record’s status / attempt counters / timestamps were updated. Internal/service write path — the worker fires this, never a human HTTP client.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to update.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-dispatcher caller attempts to mutate a delivery row directly; UI flows must use the `RETRY` custom operation.' },\n ],\n idempotent: false,\n },\n [Op.DELETE]: {\n purpose: 'Reserved for `purgeOld` and internal cleanup — no public single-row delete to keep the audit trail honest.',\n outcome: 'Old rows are removed in bulk, not opportunistically per UI click, matching the high-risk gating in the config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'An internal/maintenance single-record delete completed; the body carries its `id`. Intentionally not a public per-click operation — routine cleanup goes through `purgeOld`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to delete.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an operator authorized for exceptional single-row maintenance deletes; UI flows must use `purgeOld` instead.' },\n ],\n idempotent: true,\n },\n [Op.DELETE_MANY]: {\n purpose: 'The bulk delete behind `purgeOld`, and the retention-class sweep\\'s door through its route-less INTERNAL_CALL variant: `purgeOld` removes terminal rows older than the requested window, and the sweep removes any row untouched for the `OPERATIONAL_LOGS` period.',\n outcome: 'Retention purges scale with one bulk delete instead of N per-row deletes. `purgeOld` never touches a non-terminal row; the sweep reaches one only when no attempt has moved it for a whole period, which means the drain has abandoned it.',\n whenToUse: 'Never a public HTTP surface. Admins purge via the `purgeOld` custom operation, which owns request validation and the purge summary response.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The matched terminal records were bulk-deleted; the body carries `deletedIds` and `deletedCount`, and the `purgeOld` wrapper reports the count in its own summary response.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-system caller attempts the repository-only bulk delete directly; UI/API flows must use `purgeOld`.' },\n ],\n idempotent: true,\n },\n [M2MWebhookDeliveryLog_Operations.RETRY]: {\n operationId: M2MWebhookDeliveryLog_Operations.RETRY,\n purpose: 'Re-queue a `failed` row (reset to pending / zero attempts per worker contract) for manual replay.',\n outcome: 'Operators can attempt redelivery after fixing the downstream listener without re-sending the originating business event.',\n whenToUse: 'Use after a partner confirms their endpoint or certificate is healthy again.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The `failed` record was reset to `pending` with attempt counters cleared, and the worker pool will re-attempt delivery; the re-queued record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to retry.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to trigger a manual redelivery, or the scope does not hold the webhook-delivery entitlement (`FEATURE_NOT_AVAILABLE`): a redelivery uses the capability (#3162).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Only a `failed` row can be sent again; this one is still `pending` or `in_flight`, or already `delivered`.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Retry after the receiver recovers',\n request: {},\n response: retriedDeliveryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [M2MWebhookDeliveryLog_Operations.PURGE_OLD]: {\n operationId: M2MWebhookDeliveryLog_Operations.PURGE_OLD,\n purpose: 'Bulk-delete rows older than `N` days (delivered or failed) to bound storage in busy tenants.',\n outcome: 'Tenants can comply with a data-retention policy without asking an operator to remove records by hand.',\n whenToUse: 'Use in scheduled admin jobs (or manual compliance runs) with explicit `olderThanDays` guardrails.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'Records older than the supplied `olderThanDays` window were bulk-deleted and a count of purged records is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `olderThanDays` guardrail is missing, non-numeric, or below the configured minimum retention floor.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to run a bulk retention purge.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Purge terminal delivery history older than 30 days',\n request: { olderThanDays: 30 },\n response: {\n purgedCount: 47,\n message: 'Purged 47 delivered/failed webhook deliveries older than 30 day(s).',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'The `payload` field stores `z.unknown()` JSON at rest (full operation serialization per plan). It is intentionally not expanded into `fields.*` here because the shape is the arbitrary API response; treat any READ that surfaces `payload` as PII/secret handling.',\n 'Do not use `Op.DELETE` for routine UI — prefer `purgeOld` to maintain structured audit logs; single-row delete is for exceptional maintenance.',\n 'Because payloads may embed serialized API responses, treat READ/LIST as sensitive: scope RBAC to org-admin or app-super-admin roles that already see customer data.',\n ],\n }),\n { resourcePrimaryScope: m2mDeliveryLogResourcePrimaryScope[resourceType] },\n );\n}\n\nexport const organizationM2mWebhookDeliveryLogResourceSpecification = buildM2mWebhookDeliveryLogSpecification(\n CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,\n 'ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG',\n);\n\nexport const applicationM2mWebhookDeliveryLogResourceSpecification = buildM2mWebhookDeliveryLogSpecification(\n CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,\n 'APPLICATION_M2M_WEBHOOK_DELIVERY_LOG',\n);\n"]}
1
+ {"version":3,"file":"m2m-webhook-delivery-log.resource.specification.js","sourceRoot":"","sources":["../../../../../src/engine/notifications/resources/m2m-webhook-delivery-log.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EACL,mBAAmB,EACnB,cAAc,EACd,uBAAuB,GACxB,MAAM,0BAA0B,CAAC;AAClC,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,IAAI,EAAE,EAC3B,gBAAgB,EAChB,gCAAgC,EAChC,+BAA+B,EAC/B,2BAA2B,EAC3B,mBAAmB,EACnB,oBAAoB,EACpB,yCAAyC,GAC1C,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAoC,MAAM,6BAA6B,CAAC;AAC9H,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAU3E,MAAM,kCAAkC,GAA6D;IACnG,CAAC,gBAAgB,CAAC,qCAAqC,CAAC,EAAE,oBAAoB,CAAC,aAAa;IAC5F,CAAC,gBAAgB,CAAC,oCAAoC,CAAC,EAAE,oBA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AAC,EACF,EAAE,oBAAoB,EAAE,kCAAkC,CAAC,YAAY,CAAC,EAAE,CAC3E,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,sDAAsD,GAAG,uCAAuC,CAC3G,gBAAgB,CAAC,qCAAqC,EACtD,uCAAuC,CACxC,CAAC;AAEF,MAAM,CAAC,MAAM,qDAAqD,GAAG,uCAAuC,CAC1G,gBAAgB,CAAC,oCAAoC,EACrD,sCAAsC,CACvC,CAAC","sourcesContent":["/**\n * Resources: `organizationM2mWebhookDeliveryLog` + `applicationM2mWebhookDeliveryLog` — Wildo SaaS engine specification (backend-only).\n *\n * Polymorphic ORG + APP pair sharing `M2MWebhookDeliveryLogBaseSchema` and `m2mWebhookDeliveryLogPolymorphicFactories`.\n *\n * Inputs:\n * - Base schema: `M2MWebhookDeliveryLogBaseSchema` (`m2m-webhook-delivery-log.shared.schemas.ts`)\n * - Polymorphic factories: `m2mWebhookDeliveryLogPolymorphicFactories` (`m2m-webhook-delivery-log.shared.resources-config.schemas.ts`)\n * - Custom operations: `M2MWebhookDeliveryLog_Operations` (`retry`, `purgeOld`)\n * - UI presets: `webhooksMainPresets` / `webhooksAdminPresets`\n * (engine/presets-components/src/config/resources/webhooks.resource-presets.tsx) —\n * a section-less layout surfaced in the org Settings Hub `webhooks` section\n * (Delivery log sub-tab), dashboard-style via generic collection capabilities:\n * status quick-filter tab strip (`collectionDisplayConfig.quickFilterField`)\n * + day-bucket date headings (`temporalGroupField: 'createdAt'`) on LIST,\n * EMBEDDED READ (row click → companion drawer): the resource · operation as the\n * title and the status badge on the facts line under it, then one flat list of facts with empty\n * rows hidden, and the opaque `payload` last, unlabelled, as pretty JSON.\n * Cards show the status, URL, labelled attempt count and failure reason.\n * `retry` / `purgeOld` actions.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport {\n CodeDeclarationKind,\n CodeSymbolKind,\n FieldSemanticImportance,\n} from '@wildo-ai/zod-decorators';\nimport {\n CoreM2MNotificationChannel,\n CoreResourceOperation as Op,\n CoreResourceType,\n M2MWebhookDeliveryLog_Operations,\n M2MWebhookDeliveryLogBaseSchema,\n M2MWebhookDeliveryLogStatus,\n M2MWebhookEventType,\n ResourcePrimaryScope,\n m2mWebhookDeliveryLogPolymorphicFactories,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification, type ResourceSpecificationConfig } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\ntype M2mDeliveryLogResourceType =\n | CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG\n | CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG;\n\ntype M2mDeliveryLogResourceTypeMember =\n | 'ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG'\n | 'APPLICATION_M2M_WEBHOOK_DELIVERY_LOG';\n\nconst m2mDeliveryLogResourcePrimaryScope: Record<M2mDeliveryLogResourceType, ResourcePrimaryScope> = {\n [CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG]: ResourcePrimaryScope.ORGANIZATIONS,\n [CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG]: ResourcePrimaryScope.APPLICATION,\n};\n\ntype M2mDeliveryFactoryCfg = ReturnType<\n (typeof m2mWebhookDeliveryLogPolymorphicFactories)[CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG]\n>;\ntype M2mDeliveryCustomOp = NonNullable<M2mDeliveryFactoryCfg['customOperation']>;\ntype M2mDeliveryCoreOp =\n | Op.READ\n | Op.LIST\n | Op.SEARCH\n | Op.CREATE\n | Op.UPDATE\n | Op.DELETE\n | Op.DELETE_MANY;\ntype M2mDeliveryMain = typeof M2MWebhookDeliveryLogBaseSchema;\n\nfunction buildM2mWebhookDeliveryLogSpecification(\n resourceType: M2mDeliveryLogResourceType,\n memberName: M2mDeliveryLogResourceTypeMember,\n): ResourceSpecificationConfig<M2mDeliveryCustomOp, M2mDeliveryCoreOp, M2mDeliveryMain> {\n const isOrganizationScope = resourceType === CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG;\n const scopeIdentity = isOrganizationScope\n ? { organizationId: 'org_01JEXAMPLE' }\n : { applicationId: 'app_01JEXAMPLE' };\n const channel = isOrganizationScope\n ? CoreM2MNotificationChannel.WEBHOOK_ORGANIZATION\n : CoreM2MNotificationChannel.WEBHOOK_APPLICATION;\n const deliveryIdentity = {\n _id: 'delivery_01JEXAMPLE',\n endpointId: 'orders-primary',\n channel,\n resourceIdentifier: 'orders',\n operationIdentifier: 'create',\n httpUrl: 'https://partners.example.com/webhooks/orders',\n payloadHash: '31da863f127a6c22b91b5cc85081c382b02039a9c8c4b30db2cc3172de31d2d8',\n payload: { event: 'order.created', orderId: 'order_01JEXAMPLE' },\n signatureJti: 'webhook-signature-01JEXAMPLE',\n createdAt: '2026-08-18T09:30:00.000Z',\n updatedAt: '2026-08-18T09:32:12.000Z',\n ...scopeIdentity,\n } as const;\n const failedDeliveryExample = {\n ...deliveryIdentity,\n status: M2MWebhookDeliveryLogStatus.FAILED,\n attemptCount: 5,\n lastAttemptAt: '2026-08-18T09:32:12.000Z',\n responseStatus: 503,\n responseBodyTruncated: 'Service temporarily unavailable',\n failureReason: 'The receiver returned HTTP 503 after the final retry.',\n failedAt: '2026-08-18T09:32:12.000Z',\n } as const;\n const retriedDeliveryExample = {\n ...deliveryIdentity,\n status: M2MWebhookDeliveryLogStatus.PENDING,\n attemptCount: 0,\n nextAttemptAt: '2026-08-18T09:35:00.000Z',\n } as const;\n const deliveryPageExample = {\n data: [failedDeliveryExample],\n pagination: { page: 1, limit: 20, total: 1, totalPages: 1 },\n } as const;\n\n return resourceSpecification<M2mDeliveryCustomOp, M2mDeliveryCoreOp, M2mDeliveryMain>(\n m2mWebhookDeliveryLogPolymorphicFactories[resourceType],\n M2MWebhookDeliveryLogBaseSchema,\n ({ schemaShape }) => ({\n purpose: 'Persist one record per outbound endpoint delivery (queue entry, attempt count, latest HTTP evidence, and signing metadata) for org- or app-scoped admin review and retry.',\n businessRole: 'The user-visible event log and the worker’s durable queue for asynchronous webhook delivery — one row per (scope × target endpoint × fire).',\n lifecycleRole: 'Rows move PENDING → IN_FLIGHT → DELIVERED, or PENDING/IN_FLIGHT → FAILED, with `attemptCount` and `nextAttemptAt` governing back-off; RETRY and PURGE_OLD custom ops re-queue or clean history.',\n audience: LabelAudience.DEVELOPER,\n subDomain: EngineResourceSubDomain.NOTIFICATIONS,\n codeHandling: {\n mainSchema: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLogBaseSchema',\n symbolKind: CodeSymbolKind.SCHEMA,\n declarationKind: CodeDeclarationKind.ZOD_SCHEMA,\n },\n resourceFactoryCollectionEntry: {\n collectionSymbol: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'm2mWebhookDeliveryLogPolymorphicFactories',\n symbolKind: CodeSymbolKind.FACTORY,\n },\n identifierField: 'collectionKey',\n identifierValue: resourceType,\n },\n resourceType: {\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceType',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n memberName,\n },\n operationVocabulary: {\n coreEnum: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreResourceOperation',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n customEnum: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLog_Operations',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n },\n notes: [\n 'The polymorphism engine injects `organizationId` (ORG variant) or `applicationId` (APP variant) on the document — those FKs are not on the base Zod object.',\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({\n meaning: 'Unique id for a single delivery log record and lease token anchor for the worker.',\n importance: FieldSemanticImportance.PRIMARY,\n semanticRole: 'identifier',\n }),\n endpointId: schemaShape.endpointId.stringSpec({\n meaning: 'Stable FK to `webhookConfig.endpoints[].id` at enqueue time so historical records survive endpoint renames/URL changes.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n channel: schemaShape.channel.enumSpec({\n meaning: 'Which M2M channel the originating operation fired (must be compatible with the resource’s primary scope in the dispatcher).',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'CoreM2MNotificationChannel',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n values: {\n [CoreM2MNotificationChannel.WEBHOOK_ORGANIZATION]: { meaning: 'Org-scoped outbound webhook (requires an org id in the execution context).' },\n [CoreM2MNotificationChannel.WEBHOOK_APPLICATION]: { meaning: 'App-scoped outbound webhook (resolves the app id from `appConfigService`).' },\n },\n }),\n eventType: schemaShape.eventType.enumSpec({\n meaning: 'What the delivery reports, sent as its event header so a receiver can route before parsing the body. A row written before events existed reported a completed operation, so that is its value.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookEventType',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n },\n values: {\n [M2MWebhookEventType.OPERATION_COMPLETED]: { meaning: 'The operation succeeded: inline, or as a background run.' },\n [M2MWebhookEventType.OPERATION_FAILED]: { meaning: 'A background run of the operation failed.' },\n },\n }),\n jobId: schemaShape.jobId.stringSpec({\n meaning: 'The background job the delivery reports on: present for every `operation.failed`, and for an `operation.completed` produced by a background run. Absent for an inline call, which has no job.',\n semanticRole: 'code',\n }),\n resourceIdentifier: schemaShape.resourceIdentifier.stringSpec({\n meaning: 'Originating `CoreResourceType` string (or app resource key) that produced the M2M payload.',\n semanticRole: 'code',\n }),\n operationIdentifier: schemaShape.operationIdentifier.stringSpec({\n meaning: 'Operation or custom-op identifier that the serializer used when building the POST body (used for support correlation).',\n semanticRole: 'code',\n }),\n variantKey: schemaShape.variantKey.stringSpec({\n meaning: 'Optional default vs named operation variant, when the originating op exposed multiple API variants.',\n }),\n httpUrl: schemaShape.httpUrl.stringSpec({\n meaning: 'Snapshot of the destination URL captured when this delivery was queued (duplicated from the config so URL edits do not rewrite history).',\n importance: FieldSemanticImportance.PRIMARY,\n semanticRole: 'uri',\n }),\n payloadHash: schemaShape.payloadHash.stringSpec({\n meaning: 'SHA-256 of the JSON body, mirrored into the signed JWT and used to detect replays or tampering.',\n semanticRole: 'code',\n }),\n status: schemaShape.status.enumSpec({\n meaning: 'Current queue/delivery state for the worker and admin filters.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: {\n packageName: '@wildo-ai/saas-models',\n exportName: 'M2MWebhookDeliveryLogStatus',\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.CONST_OBJECT,\n },\n values: {\n [M2MWebhookDeliveryLogStatus.PENDING]: { meaning: 'Record is either waiting in the queue or has been re-queued for another attempt after a transient failure.' },\n [M2MWebhookDeliveryLogStatus.IN_FLIGHT]: { meaning: 'A worker currently holds a lease and is trying to send the HTTP request.' },\n [M2MWebhookDeliveryLogStatus.DELIVERED]: { meaning: 'The consumer returned a 2xx acknowledgement; terminal delivery success. This does not establish whether the consumer verified the signature or completed downstream processing.' },\n [M2MWebhookDeliveryLogStatus.FAILED]: { meaning: 'Terminal failure: exhausted attempt budget or a non-retryable 4xx class error.' },\n },\n }),\n attemptCount: schemaShape.attemptCount.numberSpec({\n meaning: 'Number of send attempts (including successes that still increment the counter, per worker policy).',\n unit: 'count',\n }),\n lastAttemptAt: schemaShape.lastAttemptAt.dateSpec({\n meaning: 'When the most recent send attempt started or finished, depending on writer semantics.',\n temporalRole: 'occurred',\n }),\n nextAttemptAt: schemaShape.nextAttemptAt.dateSpec({\n meaning: 'When a PENDING delivery becomes eligible for retry; indexed with status for worker polling. Terminal rows can retain an earlier value, which does not schedule another attempt.',\n temporalRole: 'scheduled',\n }),\n responseStatus: schemaShape.responseStatus.numberSpec({\n meaning: 'Last observed HTTP status code (present even for successes for observability).',\n }),\n responseBodyTruncated: schemaShape.responseBodyTruncated.stringSpec({\n meaning: 'First 4 KB of the HTTP response (when captured) to help debug remote listener failures.',\n }),\n failureReason: schemaShape.failureReason.stringSpec({\n meaning: 'Human-readable last error string when `status=failed` (worker-set).',\n }),\n signatureJti: schemaShape.signatureJti.stringSpec({\n meaning: 'Stable delivery identity carried in the JWT `jti` claim inside `x-wildo-webhook-signature`. The receiver uses it to deduplicate retries; it is not a signing-key identifier.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n deliveredAt: schemaShape.deliveredAt.dateSpec({\n meaning: 'Timestamp when a terminal `delivered` state was recorded.',\n temporalRole: 'occurred',\n }),\n failedAt: schemaShape.failedAt.dateSpec({\n meaning: 'Timestamp when a terminal `failed` state was recorded.',\n temporalRole: 'occurred',\n }),\n createdAt: schemaShape.createdAt.dateSpec({\n meaning: 'When the record was enqueued (immutable upper bound for retention policies).',\n temporalRole: 'creation',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n updatedAt: schemaShape.updatedAt.dateSpec({\n meaning: 'When status / attempt counters / timestamps last changed for this id.',\n temporalRole: 'modified',\n }),\n },\n // `payload` is `z.unknown()`, which carries no spec decorators, so its meaning is declared\n // through the escape hatch rather than dropped.\n additionalFieldSpecs: [\n {\n fieldName: 'payload',\n specDecorator: 'objectSpec',\n params: {\n meaning: 'The exact JSON body that was sent, as text: the originating operation’s result as its API response returns it, without internal versioning metadata. `payloadHash` is the SHA-256 of this text.',\n whyItMatters: 'It carries whatever the resource row carried, routinely personal data, so treat it as sensitive.',\n },\n },\n ],\n operations: {\n [Op.READ]: {\n /*\n * `payload` is stored opaquely and is deliberately not broken into documented fields.\n * That is a storage decision the reader of this sentence does not need; what they DO\n * need is that it comes back whole and carries whatever the event carried.\n */\n purpose: 'Inspect one delivery attempt using the fields documented above (status, URL snapshot, hashes, HTTP evidence, correlation ids). The stored `payload` is returned whole rather than broken into documented fields — treat it as sensitive; see `businessConstraints`.',\n outcome: 'Operators can see whether a business event was delivered and, if not, the precise failure class.',\n whenToUse: 'Use when triaging a customer ticket referencing a `deliveryLogId` or `signatureJti`.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The delivery log record for the supplied id was found and its status, URL snapshot, HTTP evidence, and signing metadata are returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id in this scope (never enqueued, or already removed by `purgeOld`).' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role; because `payload` may embed serialized customer data, reads are gated to roles that already see that data (see `businessConstraints`).' },\n ],\n idempotent: true,\n examples: [{\n title: 'Inspect a failed order webhook delivery',\n response: failedDeliveryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: { examples: [] },\n summary: { examples: [] },\n },\n },\n [Op.LIST]: {\n purpose: 'Browse recent delivery attempts in chronological order, filtered by the repository’s search defaults.',\n outcome: 'Admins can scan for spikes in `failed` rows or revalidation after URL rotation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) chronological page of delivery log records in this scope.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to browse the delivery log (rows may carry serialized customer payloads).' },\n ],\n idempotent: true,\n examples: [{\n title: 'Browse recent delivery attempts',\n request: { page: 1, limit: 20, sort: 'createdAt:desc' },\n response: deliveryPageExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n variants: {\n context: { examples: [] },\n summary: { examples: [] },\n },\n },\n [Op.SEARCH]: {\n purpose: 'Filter log rows on status, `endpointId`, channel, date windows, and operation identifiers to isolate incidents.',\n outcome: 'Security and ops can produce CSV-grade subsets without an external data warehouse in small deployments.',\n whenToUse: 'Use in admin dashboards; heavy analytics may still go to a warehouse — this is the operational “small query” path.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'A (possibly empty) page of delivery log records matching the status / endpoint / channel / date-window / operation filters.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to search the delivery log.' },\n ],\n idempotent: true,\n examples: [{\n title: 'Find failures for one endpoint',\n request: {\n q: 'orders',\n status: M2MWebhookDeliveryLogStatus.FAILED,\n channel,\n endpointId: 'orders-primary',\n page: 1,\n limit: 20,\n sort: 'createdAt:desc',\n },\n response: deliveryPageExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [Op.CREATE]: {\n purpose: 'Enqueue a new delivery row when a resource operation with an M2M channel fires.',\n outcome: 'The worker pool can find ready rows via the `(status, nextAttemptAt)` index.',\n whenToUse: 'Repository-only: invoked by the dispatcher, never by a human HTTP client.',\n responseStatuses: [\n { code: HttpResponseStatusCode.CREATED_201, meaning: 'A `pending` delivery record was enqueued and is now discoverable by the worker pool. Internal/service write path — the dispatcher fires this, never a human HTTP client.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The enqueue payload fails schema validation (e.g. missing `endpointId`, `httpUrl`, or `channel`).' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-dispatcher caller attempts to enqueue a delivery row directly.' },\n ],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Drive the delivery lifecycle status transitions (PENDING → IN_FLIGHT → DELIVERED/FAILED) with `attemptCount` / `nextAttemptAt` / terminal-timestamp writes.',\n outcome: 'The worker can advance a row through its lifecycle so the `(status, nextAttemptAt)` index stays accurate for polling and back-off.',\n whenToUse: 'Repository-only: invoked by the dispatcher/worker (`markInFlight` / `markDelivered` / `markFailedAttempt` / `markFinallyFailed`), never by a human HTTP client — admins act via the `RETRY` custom operation.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The delivery record’s status / attempt counters / timestamps were updated. Internal/service write path — the worker fires this, never a human HTTP client.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to update.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-dispatcher caller attempts to mutate a delivery row directly; UI flows must use the `RETRY` custom operation.' },\n ],\n idempotent: false,\n },\n [Op.DELETE]: {\n purpose: 'Reserved for `purgeOld` and internal cleanup — no public single-row delete to keep the audit trail honest.',\n outcome: 'Old rows are removed in bulk, not opportunistically per UI click, matching the high-risk gating in the config.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'An internal/maintenance single-record delete completed; the body carries its `id`. Intentionally not a public per-click operation — routine cleanup goes through `purgeOld`.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to delete.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an operator authorized for exceptional single-row maintenance deletes; UI flows must use `purgeOld` instead.' },\n ],\n idempotent: true,\n },\n [Op.DELETE_MANY]: {\n purpose: 'The bulk delete behind `purgeOld` and the retention-class sweep, through its route-less INTERNAL_CALL variant: `purgeOld` removes terminal rows older than the requested window a page of at most 100 rows at a time (#2297), and the sweep removes any row untouched for the `OPERATIONAL_LOGS` period.',\n outcome: 'Retention purges remove rows a page at a time, each page its own transaction with its own audit row, kept through a crash. `purgeOld` never touches a non-terminal row; the sweep reaches one only when no attempt has moved it for a whole period, which means the drain has abandoned it.',\n whenToUse: 'Never a public HTTP surface. Admins purge via the `purgeOld` custom operation, which owns request validation and the purge summary response.',\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The matched terminal records were bulk-deleted; the body carries `deletedIds` and `deletedCount`, and the `purgeOld` wrapper reports the count in its own summary response.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'A non-system caller attempts the repository-only bulk delete directly; UI/API flows must use `purgeOld`.' },\n ],\n idempotent: true,\n },\n [M2MWebhookDeliveryLog_Operations.RETRY]: {\n operationId: M2MWebhookDeliveryLog_Operations.RETRY,\n purpose: 'Re-queue a `failed` row (reset to pending / zero attempts per worker contract) for manual replay.',\n outcome: 'Operators can attempt redelivery after fixing the downstream listener without re-sending the originating business event.',\n whenToUse: 'Use after a partner confirms their endpoint or certificate is healthy again.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'The `failed` record was reset to `pending` with attempt counters cleared, and the worker pool will re-attempt delivery; the re-queued record is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No delivery log row exists for the supplied id to retry.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to trigger a manual redelivery, or the scope does not hold the webhook-delivery entitlement (`FEATURE_NOT_AVAILABLE`): a redelivery uses the capability (#3162).' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'Only a `failed` row can be sent again; this one is still `pending` or `in_flight`, or already `delivered`.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Retry after the receiver recovers',\n request: {},\n response: retriedDeliveryExample,\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [M2MWebhookDeliveryLog_Operations.PURGE_OLD]: {\n operationId: M2MWebhookDeliveryLog_Operations.PURGE_OLD,\n purpose: 'Remove rows older than `N` days (delivered or failed) to bound storage in busy tenants, except a row an active legal hold keeps.',\n outcome: 'Tenants can comply with a data-retention policy without asking an operator to remove records by hand. The rows are removed a page of at most 100 at a time, each page its own transaction with its own audit row (#2297), so a crash never loses the record of a removal; when a page fails, the pages before it stay removed and recorded, and running the purge again removes the rest.',\n whenToUse: 'Use in scheduled admin jobs (or manual compliance runs) with explicit `olderThanDays` guardrails.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [\n { code: HttpResponseStatusCode.OK_200, meaning: 'Records older than the supplied `olderThanDays` window were removed, except those an active legal hold keeps (the message counts them), and a count of purged records is returned.' },\n ],\n errorScenarios: [\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The `olderThanDays` guardrail is missing, non-numeric, or below the configured minimum retention floor.' },\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller lacks the org-admin / app-super-admin role required to run a bulk retention purge.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'A legal hold was placed on a row between the purge reading its page and removing it (`legal_hold_active`): that page is refused whole, the pages before it stay removed and recorded, and running the purge again keeps the held row and removes the rest.' },\n ],\n idempotent: false,\n examples: [{\n title: 'Purge terminal delivery history older than 30 days',\n request: { olderThanDays: 30 },\n response: {\n purgedCount: 47,\n message: 'Purged 47 delivered/failed webhook deliveries older than 30 day(s).',\n },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'The `payload` field stores `z.unknown()` JSON at rest (full operation serialization per plan). It is intentionally not expanded into `fields.*` here because the shape is the arbitrary API response; treat any READ that surfaces `payload` as PII/secret handling.',\n 'Do not use `Op.DELETE` for routine UI — prefer `purgeOld` to maintain structured audit logs; single-row delete is for exceptional maintenance.',\n 'Because payloads may embed serialized API responses, treat READ/LIST as sensitive: scope RBAC to org-admin or app-super-admin roles that already see customer data.',\n ],\n }),\n { resourcePrimaryScope: m2mDeliveryLogResourcePrimaryScope[resourceType] },\n );\n}\n\nexport const organizationM2mWebhookDeliveryLogResourceSpecification = buildM2mWebhookDeliveryLogSpecification(\n CoreResourceType.ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG,\n 'ORGANIZATION_M2M_WEBHOOK_DELIVERY_LOG',\n);\n\nexport const applicationM2mWebhookDeliveryLogResourceSpecification = buildM2mWebhookDeliveryLogSpecification(\n CoreResourceType.APPLICATION_M2M_WEBHOOK_DELIVERY_LOG,\n 'APPLICATION_M2M_WEBHOOK_DELIVERY_LOG',\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"organization-custom-domains.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-custom-domains.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,8BAA8B,EAC9B,oCAAoC,EAGrC,MAAM,uBAAuB,CAAC;AAuC/B,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;iCAmJ1D,CAAC"}
1
+ {"version":3,"file":"organization-custom-domains.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-custom-domains.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EACL,qBAAqB,IAAI,EAAE,EAE3B,8BAA8B,EAC9B,oCAAoC,EAGrC,MAAM,uBAAuB,CAAC;AAuC/B,eAAO,MAAM,8CAA8C;;;;;;;;;;;;;iCAoJ1D,CAAC"}
@@ -162,7 +162,8 @@ export const organizationCustomDomainsResourceSpecification = resourceSpecificat
162
162
  importance: FieldSemanticImportance.PRIMARY,
163
163
  responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Ownership is proven; the updated domain is returned.' }],
164
164
  errorScenarios: [
165
- { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization, the organization\'s plan does not include custom branding, or the domain is already VERIFIED (the operation is disabled for it).' },
165
+ { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization, or the organization\'s plan does not include custom branding.' },
166
+ { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is already VERIFIED (the operation is disabled for it).' },
166
167
  { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' },
167
168
  { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The TXT record was not found at `_wildo-verification.{domain}`.' },
168
169
  { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is reserved by the application, another organization has already proven it owns the domain, or the claim changed while it was being verified.' },
@@ -1 +1 @@
1
- {"version":3,"file":"organization-custom-domains.resource.specification.js","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-custom-domains.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,qBAAqB,IAAI,EAAE,EAC3B,8BAA8B,EAC9B,8BAA8B,EAC9B,oCAAoC,EACpC,oBAAoB,EACpB,oEAAoE,GACrE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AACjE,MAAM,wBAAwB,GAAG,0BAA0B,CAAC;AAE5D,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,uBAAuB;IACpC,UAAU;IACV,UAAU,EAAE,cAAc,CAAC,IAAI;IAC/B,eAAe,EAAE,mBAAmB,CAAC,eAAe;CACrD,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,CAAI,IAAkB,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,EAAE,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CA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AC7C,OAAO,EAAE,0GAA0G;YACnH,SAAS,EAAE,wFAAwF;YACnG,gBAAgB,EAAE,CAAC,EAAE,IAAI,EAAE,sBAAsB,CAAC,MAAM,EAAE,OAAO,EAAE,yBAAyB,EAAE,CAAC;YAC/F,cAAc,EAAE,CAAC,eAAe,EAAE,EAAE,IAAI,EAAE,sBAAsB,CAAC,aAAa,EAAE,IAAI,EAAE,oDAAoD,EAAE,CAAC;YAC7I,UAAU,EAAE,KAAK;YACjB,QAAQ,EAAE,CAAC;oBACT,KAAK,EAAE,0BAA0B;oBACjC,OAAO,EAAE,EAAE,cAAc,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE;oBAC1G,QAAQ,EAAE,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,EAAE,yBAAyB,EAAE;oBACrG,SAAS,EAAE,sBAAsB,CAAC,MAAM;iBACzC,CAAC;SACH;KACF;IACD,mBAAmB,EAAE;QACnB,qKAAqK;QACrK,gJAAgJ;QAChJ,wFAAwF;KACzF;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAC7D,CAAC","sourcesContent":["/**\n * Resource: `organizationCustomDomains` — Wildo SaaS engine specification for an organization's own domain for the\n * application (#2974).\n *\n * Inputs:\n * - Schema: `OrganizationCustomDomainSchema` (`organizations/organization-custom-domains.shared.schemas.ts`)\n * - Factory: `organizationCustomDomainsResourceConfiguration_InitializationFactory`\n * (`organizations/organization-custom-domains.shared.resources-config.schemas.ts`)\n * - Custom operations: `OrganizationCustomDomains_Operations` (`claim`, `verify_ownership`, `remove`), all\n * OVERRIDE_ALL in `organization-custom-domains.custom-impl.backend.service.ts` (saas-backend-lib), driving\n * `OrganizationCustomDomainsBackendService`.\n * - Readers: the backend's custom-domain host resolver (CORS and return-URL admission of the organization's origin).\n * - Writers: the verbs, the `custom-domain-recheck` batch (suspends a domain whose ownership record disappeared),\n * and the organization deletion's cascade.\n *\n * Scope: the ORGANIZATIONS → ORGANIZATION_CUSTOM_DOMAINS relationship carries `isPrimaryScope: true`.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n OrganizationCustomDomainSchema,\n OrganizationCustomDomainStatus,\n OrganizationCustomDomains_Operations,\n ResourcePrimaryScope,\n organizationCustomDomainsResourceConfiguration_InitializationFactory,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\nconst EXAMPLE_ORGANIZATION_ID = 'org_01J4P8F1M2N3Q4R5S6T7FIRM01';\nconst EXAMPLE_CUSTOM_DOMAIN_ID = '66f6a1c2e3d4b5a697884001';\n\nconst enumDeclaration = (exportName: string) => ({\n packageName: '@wildo-ai/saas-models',\n exportName,\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n});\n\nconst page = <T>(data: readonly T[]) => ({ data, pagination: { page: 1, limit: 20, total: data.length, totalPages: data.length === 0 ? 0 : 1 } });\n\nconst ADMIN_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization.' };\nconst ENTITLEMENT_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The organization\\'s plan does not include custom branding (`CUSTOM_BRANDING`).' };\n\nconst pendingDomainExample = {\n _id: EXAMPLE_CUSTOM_DOMAIN_ID,\n organizationId: EXAMPLE_ORGANIZATION_ID,\n domain: 'app.client-firm.example',\n ownershipChallenge: { txtName: '_wildo-verification.app.client-firm.example', nonceHash: 'a3f1c9e2b4d6f8a0c2e4f6a8b0d2f4a6c8e0a2c4e6a8c0e2a4c6e8a0c2e4a6c8' },\n status: OrganizationCustomDomainStatus.OWNERSHIP_PENDING,\n ownershipVerifiedAt: null,\n lastVerifiedAt: null,\n createdAt: '2026-11-10T08:00:00.000Z',\n updatedAt: '2026-11-10T08:00:00.000Z',\n};\n\nconst verifiedDomainExample = {\n ...pendingDomainExample,\n status: OrganizationCustomDomainStatus.VERIFIED,\n ownershipVerifiedAt: '2026-11-10T08:20:00.000Z',\n lastVerifiedAt: '2026-11-10T08:20:00.000Z',\n updatedAt: '2026-11-10T08:20:00.000Z',\n};\n\nexport const organizationCustomDomainsResourceSpecification = resourceSpecification(\n organizationCustomDomainsResourceConfiguration_InitializationFactory,\n OrganizationCustomDomainSchema,\n ({ schemaShape }) => ({\n purpose: 'Let an organization have the application answer on a domain of its own, once it has proven it controls that domain\\'s DNS.',\n businessRole: 'What lets an organization\\'s members use the application on `app.client-firm.com` instead of the application\\'s shared host. Ownership is proven per organization before the host answers for anyone: the first organization to prove it holds the domain against every other.',\n lifecycleRole: '`claim` records OWNERSHIP_PENDING and returns the DNS TXT challenge once; `verify_ownership` resolves it and, for the first organization to prove it, makes the domain VERIFIED; the scheduled re-check suspends a verified domain whose ownership record disappeared, and `verify_ownership` brings it back. `remove`, and the deletion of the organization, delete the row and the domain stops being served.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.ORGANIZATIONS,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'OrganizationCustomDomainSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'organizationCustomDomainsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: enumDeclaration('CoreResourceType'), memberName: 'ORGANIZATION_CUSTOM_DOMAINS' },\n operationVocabulary: { coreEnum: enumDeclaration('CoreResourceOperation'), customEnum: enumDeclaration('OrganizationCustomDomains_Operations') },\n notes: [\n 'The three verbs are the whole write surface, each OVERRIDE_ALL and each audited under its own event. CREATE and UPDATE are REPOSITORY_ONLY and DELETE / DELETE_MANY are INTERNAL_CALL: a row that could be written directly could claim VERIFIED without proving anything.',\n 'Only the SHA-256 of the ownership challenge value is stored. The value (`wildo-app-domain-verification=<nonce>`, published at `_wildo-verification.{domain}`) is answered once by `claim`; claiming again while pending mints a fresh one and invalidates the old.',\n 'A VERIFIED domain is served only while the organization holds `CUSTOM_BRANDING`. The host resolver asks the entitlement on every resolution, so losing the plan stops the domain being served without writing anything, and regaining it serves the domain again.',\n 'Refusals never name the organization that holds a domain: telling one tenant which tenant holds it would disclose a customer\\'s configuration.',\n '`retain_only` and FORBIDDEN from a subject export: a domain names an organization\\'s infrastructure, not a person.',\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Identifier of one organization\\'s claim on one domain, derived from the organization and the domain.', semanticRole: 'identifier', importance: FieldSemanticImportance.PRIMARY }),\n organizationId: schemaShape.organizationId.foreignKeySpec({ meaning: 'The organization that claimed the domain.', whyItMatters: 'Once proven, the domain answers for this organization only.', importance: FieldSemanticImportance.PRIMARY }),\n domain: schemaShape.domain.stringSpec({ meaning: 'The lower-case DNS hostname, e.g. `app.client-firm.com`.', whyItMatters: 'Not unique: several organizations may hold pending claims on one domain. The application\\'s own hosts and their subdomains cannot be claimed.', importance: FieldSemanticImportance.PRIMARY }),\n ownershipChallenge: schemaShape.ownershipChallenge.objectSpec({ meaning: 'The DNS TXT ownership challenge: the name to publish it on, and the SHA-256 of the value.', whyItMatters: 'The organization proves control of the domain by publishing the value; the re-check keeps asking for it, and its disappearance suspends the domain.' }),\n status: schemaShape.status.enumSpec({\n meaning: 'Where the domain stands. Only a verified domain is served.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: enumDeclaration('OrganizationCustomDomainStatus'),\n values: {\n [OrganizationCustomDomainStatus.OWNERSHIP_PENDING]: { meaning: 'Claimed; the TXT challenge is not answered yet. Blocks nobody: several organizations may be here at once.' },\n [OrganizationCustomDomainStatus.VERIFIED]: { meaning: 'Ownership proven. The domain is served for the organization while it holds custom branding.' },\n [OrganizationCustomDomainStatus.SUSPENDED]: { meaning: 'Was verified; the ownership record disappeared. Not served until ownership is proven again.' },\n },\n }),\n ownershipVerifiedAt: schemaShape.ownershipVerifiedAt.dateSpec({ meaning: 'When the organization proved it owns the domain.', whyItMatters: 'From then on the domain is refused to every other organization.', temporalRole: 'occurred' }),\n lastVerifiedAt: schemaShape.lastVerifiedAt.dateSpec({ meaning: 'When the ownership record was last found published.', temporalRole: 'occurred' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the domain was claimed.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'When the claim last changed.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Read one of your organization\\'s custom domains, with its status and where to publish the ownership record.',\n outcome: 'The domain claim.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The domain is returned.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' }],\n idempotent: true,\n examples: [{ title: 'Read a claimed domain', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID }, response: pendingDomainExample, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.LIST]: {\n purpose: 'List the organization\\'s custom domains, filtered by `status` and sorted by `createdAt`.',\n outcome: 'A page of domain claims.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'A possibly empty page of domains.' }],\n errorScenarios: [ADMIN_FORBIDDEN],\n idempotent: true,\n examples: [{ title: 'List verified domains', request: { organizationId: EXAMPLE_ORGANIZATION_ID, status: OrganizationCustomDomainStatus.VERIFIED }, response: page([verifiedDomainExample]), forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.CREATE]: {\n purpose: 'Store a claim. Written only by `claim`.',\n outcome: 'The claim exists OWNERSHIP_PENDING.',\n whenToUse: 'Repository-only: never an HTTP surface — organizations act through `claim`.',\n responseStatuses: [{ code: HttpResponseStatusCode.CREATED_201, meaning: 'The claim was stored. Internal write path.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.CONFLICT_409, when: 'The organization already holds a claim on this domain.' }],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Move a claim through its lifecycle. Written only by the verbs and the re-check, through guarded mutations.',\n outcome: 'The claim reflects the latest ownership check.',\n whenToUse: 'Repository-only: never an HTTP surface.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The claim was updated. Internal write path.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No claim with this id exists.' }],\n idempotent: false,\n },\n [Op.DELETE]: {\n purpose: 'Internal, route-less delete (HIGH risk): the tenant cascade\\'s door when the organization is deleted.',\n outcome: 'The claim leaves with its organization, and the domain stops being served.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Internal delete completed.' }],\n idempotent: true,\n },\n [Op.DELETE_MANY]: {\n purpose: 'Bulk twin of DELETE (internal, route-less).',\n outcome: 'An organization\\'s claims leave together.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Internal delete completed.' }],\n idempotent: true,\n },\n [OrganizationCustomDomains_Operations.CLAIM]: {\n operationId: OrganizationCustomDomains_Operations.CLAIM,\n purpose: 'Claim a domain for the application and receive the DNS TXT record that proves ownership.',\n outcome: 'The claim is OWNERSHIP_PENDING and the answer carries `txtName` (`_wildo-verification.{domain}`) and `txtValue` (`wildo-app-domain-verification=<nonce>`), shown this once. Nothing is served yet. Claiming again while pending mints a fresh value and invalidates the old one.',\n whenToUse: 'The organization wants its members to use the application on a domain it controls.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The claim and its one-time TXT record value are returned.' }],\n errorScenarios: [\n ADMIN_FORBIDDEN,\n ENTITLEMENT_FORBIDDEN,\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The domain is not a DNS hostname with at least two labels, or ends in a numeric label.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is one of the application\\'s own hosts or under its domain, another organization has already proven it owns the domain, or this organization already proved it (remove the domain to claim it again).' },\n ],\n idempotent: false,\n examples: [{\n title: 'Claim a subdomain of the organization\\'s own domain',\n request: { organizationId: EXAMPLE_ORGANIZATION_ID, domain: 'app.client-firm.example' },\n response: { organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID, domain: 'app.client-firm.example', status: OrganizationCustomDomainStatus.OWNERSHIP_PENDING, txtName: '_wildo-verification.app.client-firm.example', txtValue: 'wildo-app-domain-verification=Qm9vc3RlZC1ub25jZS12YWx1ZS0x' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [OrganizationCustomDomains_Operations.VERIFY_OWNERSHIP]: {\n operationId: OrganizationCustomDomains_Operations.VERIFY_OWNERSHIP,\n purpose: 'Prove ownership: resolve the published TXT record. The first organization to prove it holds the domain.',\n outcome: 'The domain is VERIFIED with `ownershipVerifiedAt`. From then on it is refused to every other organization, and it is served for this one while it holds custom branding. A SUSPENDED domain comes back the same way.',\n whenToUse: 'After publishing the TXT record `claim` returned and letting DNS propagate, or after publishing it again for a suspended domain.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Ownership is proven; the updated domain is returned.' }],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization, the organization\\'s plan does not include custom branding, or the domain is already VERIFIED (the operation is disabled for it).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The TXT record was not found at `_wildo-verification.{domain}`.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is reserved by the application, another organization has already proven it owns the domain, or the claim changed while it was being verified.' },\n ],\n idempotent: false,\n examples: [{ title: 'Prove ownership of a claimed domain', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID }, response: verifiedDomainExample, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [OrganizationCustomDomains_Operations.REMOVE]: {\n operationId: OrganizationCustomDomains_Operations.REMOVE,\n purpose: 'Remove a domain: delete the claim.',\n outcome: 'The domain stops being served for the organization at once. Never needs the custom-branding entitlement.',\n whenToUse: 'The organization no longer uses the domain, or wants to claim it again from the start.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The domain was removed.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' }],\n idempotent: false,\n examples: [{\n title: 'Remove a verified domain',\n request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID },\n response: { organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID, domain: 'app.client-firm.example' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'A host answers for an organization only once THIS organization proved control of its DNS; the first organization to prove it wins, and pending claims block nobody.',\n 'Only a VERIFIED domain of an organization holding custom branding is served; a verified domain whose ownership record disappears is SUSPENDED.',\n 'The application\\'s own hosts, and every name under its domain, are nobody\\'s to claim.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS },\n);\n"]}
1
+ {"version":3,"file":"organization-custom-domains.resource.specification.js","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-custom-domains.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,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AAE,KAAK;YACjB,QAAQ,EAAE,CAAC;oBACT,KAAK,EAAE,0BAA0B;oBACjC,OAAO,EAAE,EAAE,cAAc,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,wBAAwB,EAAE;oBAC1G,QAAQ,EAAE,EAAE,0BAA0B,EAAE,wBAAwB,EAAE,MAAM,EAAE,yBAAyB,EAAE;oBACrG,SAAS,EAAE,sBAAsB,CAAC,MAAM;iBACzC,CAAC;SACH;KACF;IACD,mBAAmB,EAAE;QACnB,qKAAqK;QACrK,gJAAgJ;QAChJ,wFAAwF;KACzF;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAC7D,CAAC","sourcesContent":["/**\n * Resource: `organizationCustomDomains` — Wildo SaaS engine specification for an organization's own domain for the\n * application (#2974).\n *\n * Inputs:\n * - Schema: `OrganizationCustomDomainSchema` (`organizations/organization-custom-domains.shared.schemas.ts`)\n * - Factory: `organizationCustomDomainsResourceConfiguration_InitializationFactory`\n * (`organizations/organization-custom-domains.shared.resources-config.schemas.ts`)\n * - Custom operations: `OrganizationCustomDomains_Operations` (`claim`, `verify_ownership`, `remove`), all\n * OVERRIDE_ALL in `organization-custom-domains.custom-impl.backend.service.ts` (saas-backend-lib), driving\n * `OrganizationCustomDomainsBackendService`.\n * - Readers: the backend's custom-domain host resolver (CORS and return-URL admission of the organization's origin).\n * - Writers: the verbs, the `custom-domain-recheck` batch (suspends a domain whose ownership record disappeared),\n * and the organization deletion's cascade.\n *\n * Scope: the ORGANIZATIONS → ORGANIZATION_CUSTOM_DOMAINS relationship carries `isPrimaryScope: true`.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n CoreResourceOperation as Op,\n OrganizationCustomDomainSchema,\n OrganizationCustomDomainStatus,\n OrganizationCustomDomains_Operations,\n ResourcePrimaryScope,\n organizationCustomDomainsResourceConfiguration_InitializationFactory,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\nconst EXAMPLE_ORGANIZATION_ID = 'org_01J4P8F1M2N3Q4R5S6T7FIRM01';\nconst EXAMPLE_CUSTOM_DOMAIN_ID = '66f6a1c2e3d4b5a697884001';\n\nconst enumDeclaration = (exportName: string) => ({\n packageName: '@wildo-ai/saas-models',\n exportName,\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n});\n\nconst page = <T>(data: readonly T[]) => ({ data, pagination: { page: 1, limit: 20, total: data.length, totalPages: data.length === 0 ? 0 : 1 } });\n\nconst ADMIN_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization.' };\nconst ENTITLEMENT_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The organization\\'s plan does not include custom branding (`CUSTOM_BRANDING`).' };\n\nconst pendingDomainExample = {\n _id: EXAMPLE_CUSTOM_DOMAIN_ID,\n organizationId: EXAMPLE_ORGANIZATION_ID,\n domain: 'app.client-firm.example',\n ownershipChallenge: { txtName: '_wildo-verification.app.client-firm.example', nonceHash: 'a3f1c9e2b4d6f8a0c2e4f6a8b0d2f4a6c8e0a2c4e6a8c0e2a4c6e8a0c2e4a6c8' },\n status: OrganizationCustomDomainStatus.OWNERSHIP_PENDING,\n ownershipVerifiedAt: null,\n lastVerifiedAt: null,\n createdAt: '2026-11-10T08:00:00.000Z',\n updatedAt: '2026-11-10T08:00:00.000Z',\n};\n\nconst verifiedDomainExample = {\n ...pendingDomainExample,\n status: OrganizationCustomDomainStatus.VERIFIED,\n ownershipVerifiedAt: '2026-11-10T08:20:00.000Z',\n lastVerifiedAt: '2026-11-10T08:20:00.000Z',\n updatedAt: '2026-11-10T08:20:00.000Z',\n};\n\nexport const organizationCustomDomainsResourceSpecification = resourceSpecification(\n organizationCustomDomainsResourceConfiguration_InitializationFactory,\n OrganizationCustomDomainSchema,\n ({ schemaShape }) => ({\n purpose: 'Let an organization have the application answer on a domain of its own, once it has proven it controls that domain\\'s DNS.',\n businessRole: 'What lets an organization\\'s members use the application on `app.client-firm.com` instead of the application\\'s shared host. Ownership is proven per organization before the host answers for anyone: the first organization to prove it holds the domain against every other.',\n lifecycleRole: '`claim` records OWNERSHIP_PENDING and returns the DNS TXT challenge once; `verify_ownership` resolves it and, for the first organization to prove it, makes the domain VERIFIED; the scheduled re-check suspends a verified domain whose ownership record disappeared, and `verify_ownership` brings it back. `remove`, and the deletion of the organization, delete the row and the domain stops being served.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.ORGANIZATIONS,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'OrganizationCustomDomainSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'organizationCustomDomainsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: enumDeclaration('CoreResourceType'), memberName: 'ORGANIZATION_CUSTOM_DOMAINS' },\n operationVocabulary: { coreEnum: enumDeclaration('CoreResourceOperation'), customEnum: enumDeclaration('OrganizationCustomDomains_Operations') },\n notes: [\n 'The three verbs are the whole write surface, each OVERRIDE_ALL and each audited under its own event. CREATE and UPDATE are REPOSITORY_ONLY and DELETE / DELETE_MANY are INTERNAL_CALL: a row that could be written directly could claim VERIFIED without proving anything.',\n 'Only the SHA-256 of the ownership challenge value is stored. The value (`wildo-app-domain-verification=<nonce>`, published at `_wildo-verification.{domain}`) is answered once by `claim`; claiming again while pending mints a fresh one and invalidates the old.',\n 'A VERIFIED domain is served only while the organization holds `CUSTOM_BRANDING`. The host resolver asks the entitlement on every resolution, so losing the plan stops the domain being served without writing anything, and regaining it serves the domain again.',\n 'Refusals never name the organization that holds a domain: telling one tenant which tenant holds it would disclose a customer\\'s configuration.',\n '`retain_only` and FORBIDDEN from a subject export: a domain names an organization\\'s infrastructure, not a person.',\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Identifier of one organization\\'s claim on one domain, derived from the organization and the domain.', semanticRole: 'identifier', importance: FieldSemanticImportance.PRIMARY }),\n organizationId: schemaShape.organizationId.foreignKeySpec({ meaning: 'The organization that claimed the domain.', whyItMatters: 'Once proven, the domain answers for this organization only.', importance: FieldSemanticImportance.PRIMARY }),\n domain: schemaShape.domain.stringSpec({ meaning: 'The lower-case DNS hostname, e.g. `app.client-firm.com`.', whyItMatters: 'Not unique: several organizations may hold pending claims on one domain. The application\\'s own hosts and their subdomains cannot be claimed.', importance: FieldSemanticImportance.PRIMARY }),\n ownershipChallenge: schemaShape.ownershipChallenge.objectSpec({ meaning: 'The DNS TXT ownership challenge: the name to publish it on, and the SHA-256 of the value.', whyItMatters: 'The organization proves control of the domain by publishing the value; the re-check keeps asking for it, and its disappearance suspends the domain.' }),\n status: schemaShape.status.enumSpec({\n meaning: 'Where the domain stands. Only a verified domain is served.',\n importance: FieldSemanticImportance.PRIMARY,\n enumDeclaration: enumDeclaration('OrganizationCustomDomainStatus'),\n values: {\n [OrganizationCustomDomainStatus.OWNERSHIP_PENDING]: { meaning: 'Claimed; the TXT challenge is not answered yet. Blocks nobody: several organizations may be here at once.' },\n [OrganizationCustomDomainStatus.VERIFIED]: { meaning: 'Ownership proven. The domain is served for the organization while it holds custom branding.' },\n [OrganizationCustomDomainStatus.SUSPENDED]: { meaning: 'Was verified; the ownership record disappeared. Not served until ownership is proven again.' },\n },\n }),\n ownershipVerifiedAt: schemaShape.ownershipVerifiedAt.dateSpec({ meaning: 'When the organization proved it owns the domain.', whyItMatters: 'From then on the domain is refused to every other organization.', temporalRole: 'occurred' }),\n lastVerifiedAt: schemaShape.lastVerifiedAt.dateSpec({ meaning: 'When the ownership record was last found published.', temporalRole: 'occurred' }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the domain was claimed.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'When the claim last changed.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Read one of your organization\\'s custom domains, with its status and where to publish the ownership record.',\n outcome: 'The domain claim.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The domain is returned.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' }],\n idempotent: true,\n examples: [{ title: 'Read a claimed domain', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID }, response: pendingDomainExample, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.LIST]: {\n purpose: 'List the organization\\'s custom domains, filtered by `status` and sorted by `createdAt`.',\n outcome: 'A page of domain claims.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'A possibly empty page of domains.' }],\n errorScenarios: [ADMIN_FORBIDDEN],\n idempotent: true,\n examples: [{ title: 'List verified domains', request: { organizationId: EXAMPLE_ORGANIZATION_ID, status: OrganizationCustomDomainStatus.VERIFIED }, response: page([verifiedDomainExample]), forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.CREATE]: {\n purpose: 'Store a claim. Written only by `claim`.',\n outcome: 'The claim exists OWNERSHIP_PENDING.',\n whenToUse: 'Repository-only: never an HTTP surface — organizations act through `claim`.',\n responseStatuses: [{ code: HttpResponseStatusCode.CREATED_201, meaning: 'The claim was stored. Internal write path.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.CONFLICT_409, when: 'The organization already holds a claim on this domain.' }],\n idempotent: false,\n },\n [Op.UPDATE]: {\n purpose: 'Move a claim through its lifecycle. Written only by the verbs and the re-check, through guarded mutations.',\n outcome: 'The claim reflects the latest ownership check.',\n whenToUse: 'Repository-only: never an HTTP surface.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The claim was updated. Internal write path.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No claim with this id exists.' }],\n idempotent: false,\n },\n [Op.DELETE]: {\n purpose: 'Internal, route-less delete (HIGH risk): the tenant cascade\\'s door when the organization is deleted.',\n outcome: 'The claim leaves with its organization, and the domain stops being served.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Internal delete completed.' }],\n idempotent: true,\n },\n [Op.DELETE_MANY]: {\n purpose: 'Bulk twin of DELETE (internal, route-less).',\n outcome: 'An organization\\'s claims leave together.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Internal delete completed.' }],\n idempotent: true,\n },\n [OrganizationCustomDomains_Operations.CLAIM]: {\n operationId: OrganizationCustomDomains_Operations.CLAIM,\n purpose: 'Claim a domain for the application and receive the DNS TXT record that proves ownership.',\n outcome: 'The claim is OWNERSHIP_PENDING and the answer carries `txtName` (`_wildo-verification.{domain}`) and `txtValue` (`wildo-app-domain-verification=<nonce>`), shown this once. Nothing is served yet. Claiming again while pending mints a fresh value and invalidates the old one.',\n whenToUse: 'The organization wants its members to use the application on a domain it controls.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The claim and its one-time TXT record value are returned.' }],\n errorScenarios: [\n ADMIN_FORBIDDEN,\n ENTITLEMENT_FORBIDDEN,\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The domain is not a DNS hostname with at least two labels, or ends in a numeric label.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is one of the application\\'s own hosts or under its domain, another organization has already proven it owns the domain, or this organization already proved it (remove the domain to claim it again).' },\n ],\n idempotent: false,\n examples: [{\n title: 'Claim a subdomain of the organization\\'s own domain',\n request: { organizationId: EXAMPLE_ORGANIZATION_ID, domain: 'app.client-firm.example' },\n response: { organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID, domain: 'app.client-firm.example', status: OrganizationCustomDomainStatus.OWNERSHIP_PENDING, txtName: '_wildo-verification.app.client-firm.example', txtValue: 'wildo-app-domain-verification=Qm9vc3RlZC1ub25jZS12YWx1ZS0x' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n [OrganizationCustomDomains_Operations.VERIFY_OWNERSHIP]: {\n operationId: OrganizationCustomDomains_Operations.VERIFY_OWNERSHIP,\n purpose: 'Prove ownership: resolve the published TXT record. The first organization to prove it holds the domain.',\n outcome: 'The domain is VERIFIED with `ownershipVerifiedAt`. From then on it is refused to every other organization, and it is served for this one while it holds custom branding. A SUSPENDED domain comes back the same way.',\n whenToUse: 'After publishing the TXT record `claim` returned and letting DNS propagate, or after publishing it again for a suspended domain.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'Ownership is proven; the updated domain is returned.' }],\n errorScenarios: [\n { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization, or the organization\\'s plan does not include custom branding.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is already VERIFIED (the operation is disabled for it).' },\n { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' },\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'The TXT record was not found at `_wildo-verification.{domain}`.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The domain is reserved by the application, another organization has already proven it owns the domain, or the claim changed while it was being verified.' },\n ],\n idempotent: false,\n examples: [{ title: 'Prove ownership of a claimed domain', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID }, response: verifiedDomainExample, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [OrganizationCustomDomains_Operations.REMOVE]: {\n operationId: OrganizationCustomDomains_Operations.REMOVE,\n purpose: 'Remove a domain: delete the claim.',\n outcome: 'The domain stops being served for the organization at once. Never needs the custom-branding entitlement.',\n whenToUse: 'The organization no longer uses the domain, or wants to claim it again from the start.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The domain was removed.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No domain with this id exists in the organization.' }],\n idempotent: false,\n examples: [{\n title: 'Remove a verified domain',\n request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID },\n response: { organizationCustomDomainId: EXAMPLE_CUSTOM_DOMAIN_ID, domain: 'app.client-firm.example' },\n forStatus: HttpResponseStatusCode.OK_200,\n }],\n },\n },\n businessConstraints: [\n 'A host answers for an organization only once THIS organization proved control of its DNS; the first organization to prove it wins, and pending claims block nobody.',\n 'Only a VERIFIED domain of an organization holding custom branding is served; a verified domain whose ownership record disappears is SUSPENDED.',\n 'The application\\'s own hosts, and every name under its domain, are nobody\\'s to claim.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS },\n);\n"]}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Resource: `organizationDashboardLayouts` — Wildo SaaS engine specification for how one organization arranges one of
3
+ * the application's chart dashboards (#2299).
4
+ *
5
+ * Inputs:
6
+ * - Schema: `OrganizationDashboardLayoutSchema` (`organizations/organization-dashboard-layouts.shared.schemas.ts`)
7
+ * - Factory: `organizationDashboardLayoutsResourceConfiguration_InitializationFactory`
8
+ * (`organizations/organization-dashboard-layouts.shared.resources-config.schemas.ts`)
9
+ * - Readers: `ChartDashboard` (`@wildo-ai/saas-frontend-lib`) given a `layoutRef`, through `useChartDashboardLayout`.
10
+ * - Writers: the dashboard's layout editor (`ChartDashboardLayoutEditor`), through the generic CREATE / UPDATE / DELETE,
11
+ * and the organization deletion's cascade.
12
+ *
13
+ * Scope: the ORGANIZATIONS → ORGANIZATION_DASHBOARD_LAYOUTS relationship carries `isPrimaryScope: true`.
14
+ */
15
+ import { ChartDashboardTileRows, ChartDashboardTileSpan, CoreResourceOperation as Op } from '@wildo-ai/saas-models';
16
+ export declare const organizationDashboardLayoutsResourceSpecification: import("../../../_core").ResourceSpecificationConfig<undefined, Op.READ | Op.UPDATE | Op.DELETE | Op.CREATE | Op.LIST, import("zod").ZodObject<{
17
+ _id: import("zod").ZodString;
18
+ organizationId: import("zod").ZodString;
19
+ dashboardRef: import("zod").ZodString;
20
+ tiles: import("zod").ZodArray<import("zod").ZodObject<{
21
+ resourceType: import("zod").ZodString;
22
+ chartViewRef: import("zod").ZodString;
23
+ span: import("zod").ZodEnum<typeof ChartDashboardTileSpan>;
24
+ rows: import("zod").ZodEnum<typeof ChartDashboardTileRows>;
25
+ hidden: import("zod").ZodBoolean;
26
+ }, import("zod/v4/core").$strip>>;
27
+ createdAt: import("zod").ZodDefault<import("zod").ZodDate>;
28
+ updatedAt: import("zod").ZodDefault<import("zod").ZodDate>;
29
+ }, import("zod/v4/core").$strip>>;
30
+ //# sourceMappingURL=organization-dashboard-layouts.resource.specification.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-dashboard-layouts.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-dashboard-layouts.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAIH,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,IAAI,EAAE,EAI5B,MAAM,uBAAuB,CAAC;AAiC/B,eAAO,MAAM,iDAAiD;;;;;;;;;;;;;iCA4F7D,CAAC"}
@@ -0,0 +1,131 @@
1
+ /**
2
+ * Resource: `organizationDashboardLayouts` — Wildo SaaS engine specification for how one organization arranges one of
3
+ * the application's chart dashboards (#2299).
4
+ *
5
+ * Inputs:
6
+ * - Schema: `OrganizationDashboardLayoutSchema` (`organizations/organization-dashboard-layouts.shared.schemas.ts`)
7
+ * - Factory: `organizationDashboardLayoutsResourceConfiguration_InitializationFactory`
8
+ * (`organizations/organization-dashboard-layouts.shared.resources-config.schemas.ts`)
9
+ * - Readers: `ChartDashboard` (`@wildo-ai/saas-frontend-lib`) given a `layoutRef`, through `useChartDashboardLayout`.
10
+ * - Writers: the dashboard's layout editor (`ChartDashboardLayoutEditor`), through the generic CREATE / UPDATE / DELETE,
11
+ * and the organization deletion's cascade.
12
+ *
13
+ * Scope: the ORGANIZATIONS → ORGANIZATION_DASHBOARD_LAYOUTS relationship carries `isPrimaryScope: true`.
14
+ */
15
+ import { LabelAudience } from '@wildo-ai/presets-components-models';
16
+ import { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';
17
+ import { ChartDashboardTileRows, ChartDashboardTileSpan, CoreResourceOperation as Op, OrganizationDashboardLayoutSchema, ResourcePrimaryScope, organizationDashboardLayoutsResourceConfiguration_InitializationFactory, } from '@wildo-ai/saas-models';
18
+ import { HttpResponseStatusCode, resourceSpecification } from '../../../_core/index.js';
19
+ import { EngineResourceSubDomain } from '../../engine-resource-sub-domain.js';
20
+ const EXAMPLE_ORGANIZATION_ID = 'org_01J4P8F1M2N3Q4R5S6T7FIRM01';
21
+ const EXAMPLE_LAYOUT_ID = '66f6a1c2e3d4b5a697885001';
22
+ const enumDeclaration = (exportName) => ({
23
+ packageName: '@wildo-ai/saas-models',
24
+ exportName,
25
+ symbolKind: CodeSymbolKind.ENUM,
26
+ declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,
27
+ });
28
+ const page = (data) => ({ data, pagination: { page: 1, limit: 20, total: data.length, totalPages: data.length === 0 ? 0 : 1 } });
29
+ const ADMIN_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization.' };
30
+ const layoutTilesExample = [
31
+ { resourceType: 'cases', chartViewRef: 'cases-by-status', span: ChartDashboardTileSpan.ONE, rows: ChartDashboardTileRows.ONE, hidden: false },
32
+ { resourceType: 'invoices', chartViewRef: 'revenue-by-month', span: ChartDashboardTileSpan.TWO, rows: ChartDashboardTileRows.TWO, hidden: false },
33
+ { resourceType: 'slaBreaches', chartViewRef: 'breaches-by-team', span: ChartDashboardTileSpan.ONE, rows: ChartDashboardTileRows.ONE, hidden: true },
34
+ ];
35
+ const layoutExample = {
36
+ _id: EXAMPLE_LAYOUT_ID,
37
+ organizationId: EXAMPLE_ORGANIZATION_ID,
38
+ dashboardRef: 'operations-dashboard',
39
+ tiles: layoutTilesExample,
40
+ createdAt: '2026-11-12T09:00:00.000Z',
41
+ updatedAt: '2026-11-12T09:00:00.000Z',
42
+ };
43
+ export const organizationDashboardLayoutsResourceSpecification = resourceSpecification(organizationDashboardLayoutsResourceConfiguration_InitializationFactory, OrganizationDashboardLayoutSchema, ({ schemaShape }) => ({
44
+ purpose: 'Let an organization arrange one of the application\'s chart dashboards for its members: the order of the tiles, the size of each, and which are hidden.',
45
+ businessRole: 'The application declares what a dashboard holds; an organization decides what it sees first. A manager who reads revenue before anything else puts it first for the whole organization, without the application being changed.',
46
+ lifecycleRole: 'No row means the dashboard as the application declares it. The first save CREATES the row, later saves UPDATE it, and a reset DELETES it; the organization\'s deletion removes it.',
47
+ audience: LabelAudience.ADMIN,
48
+ subDomain: EngineResourceSubDomain.ORGANIZATIONS,
49
+ codeHandling: {
50
+ mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'OrganizationDashboardLayoutSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },
51
+ resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'organizationDashboardLayoutsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },
52
+ resourceType: { enumDeclaration: enumDeclaration('CoreResourceType'), memberName: 'ORGANIZATION_DASHBOARD_LAYOUTS' },
53
+ operationVocabulary: { coreEnum: enumDeclaration('CoreResourceOperation') },
54
+ notes: [
55
+ 'The layout only ARRANGES the tiles the dashboard declares: an entry naming a tile the dashboard does not declare is ignored, and a tile declared after the layout was saved is shown after the stored ones. A layout cannot add a chart.',
56
+ 'It never widens access: the dashboard still hides a tile whose chart the viewer\'s roles would be refused, whatever the layout says.',
57
+ 'Every write is MEDIUM and declared audited (`auditBelowRiskFloor`): `RESOURCE_OPERATION_PERFORMED` carries the tiles before and after, since `tiles` is audit evidence.',
58
+ 'One row per organization and dashboard (`dashboardRef` unique within the organization, on both stores); a second CREATE for the same dashboard answers 409.',
59
+ 'The organization\'s own state, never a relationship\'s record: every door admits a representing organization only through a lent capability. FORBIDDEN from a subject export: a layout names charts and sizes, never a person.',
60
+ ],
61
+ },
62
+ fields: {
63
+ _id: schemaShape._id.stringSpec({ meaning: 'Identifier of one organization\'s layout of one dashboard.', semanticRole: 'identifier', importance: FieldSemanticImportance.PRIMARY }),
64
+ organizationId: schemaShape.organizationId.foreignKeySpec({ meaning: 'The organization whose members see the dashboard arranged this way.', whyItMatters: 'Each organization arranges its dashboards for itself; another organization never sees this arrangement.', importance: FieldSemanticImportance.PRIMARY }),
65
+ dashboardRef: schemaShape.dashboardRef.stringSpec({ meaning: 'The dashboard this layout arranges: the `layoutRef` the application gives `ChartDashboard`, e.g. `home-analytics`.', whyItMatters: 'Unique within the organization: one layout per dashboard. Never changed after creation.', importance: FieldSemanticImportance.PRIMARY }),
66
+ tiles: schemaShape.tiles.arraySpec({
67
+ meaning: 'The dashboard\'s tiles in the order shown, each with its width (`ChartDashboardTileSpan`), its height in rows (`ChartDashboardTileRows`) and whether the organization hides it.',
68
+ elementMeaning: 'One declared tile: the resource whose chart views declare the chart, the chart view\'s ref, its size, and `hidden`.',
69
+ whyItMatters: 'A tile appears at most once. Recorded before and after each change in the audit trail.',
70
+ importance: FieldSemanticImportance.PRIMARY,
71
+ }),
72
+ createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the organization first arranged the dashboard.', temporalRole: 'creation' }),
73
+ updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'When the arrangement last changed.', temporalRole: 'modified' }),
74
+ },
75
+ operations: {
76
+ [Op.READ]: {
77
+ purpose: 'Read one of the organization\'s dashboard layouts.',
78
+ outcome: 'The layout.',
79
+ responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout is returned.' }],
80
+ errorScenarios: [{ code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not a member of the organization.' }, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],
81
+ idempotent: true,
82
+ examples: [{ title: 'Read a layout', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationDashboardLayoutId: EXAMPLE_LAYOUT_ID }, response: layoutExample, forStatus: HttpResponseStatusCode.OK_200 }],
83
+ },
84
+ [Op.LIST]: {
85
+ purpose: 'List the organization\'s dashboard layouts, filtered by `dashboardRef`: what a dashboard reads to know how the organization arranged it.',
86
+ outcome: 'A page holding the dashboard\'s layout, or none when the organization keeps the declared one.',
87
+ whenToUse: 'Every member opening a dashboard that has a `layoutRef`.',
88
+ responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'A possibly empty page of layouts.' }],
89
+ errorScenarios: [{ code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not a member of the organization.' }],
90
+ idempotent: true,
91
+ examples: [{ title: 'Read the layout of one dashboard', request: { organizationId: EXAMPLE_ORGANIZATION_ID, dashboardRef: 'operations-dashboard' }, response: page([layoutExample]), forStatus: HttpResponseStatusCode.OK_200 }],
92
+ },
93
+ [Op.CREATE]: {
94
+ purpose: 'Arrange a dashboard for the organization for the first time.',
95
+ outcome: 'Every member sees the dashboard in this order, at these sizes, without the hidden tiles. Audited.',
96
+ whenToUse: 'An administrator saves the layout editor of a dashboard the organization has not arranged yet.',
97
+ importance: FieldSemanticImportance.PRIMARY,
98
+ responseStatuses: [{ code: HttpResponseStatusCode.CREATED_201, meaning: 'The layout was stored.' }],
99
+ errorScenarios: [
100
+ ADMIN_FORBIDDEN,
101
+ { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A tile appears twice, a size is not one of the vocabulary\'s, or the layout holds more than 60 tiles.' },
102
+ { code: HttpResponseStatusCode.CONFLICT_409, when: 'The organization already has a layout for this dashboard (update it instead).' },
103
+ ],
104
+ idempotent: false,
105
+ examples: [{ title: 'Put revenue first and hide SLA breaches', request: { organizationId: EXAMPLE_ORGANIZATION_ID, dashboardRef: 'operations-dashboard', tiles: layoutTilesExample }, response: layoutExample, forStatus: HttpResponseStatusCode.CREATED_201 }],
106
+ },
107
+ [Op.UPDATE]: {
108
+ purpose: 'Change the organization\'s arrangement of a dashboard.',
109
+ outcome: 'Every member sees the new arrangement. Audited, with the tiles before and after.',
110
+ whenToUse: 'An administrator saves the layout editor of a dashboard the organization already arranged.',
111
+ responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout was updated.' }],
112
+ errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A tile appears twice, or a size is not one of the vocabulary\'s.' }, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],
113
+ idempotent: true,
114
+ examples: [{ title: 'Show SLA breaches again', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationDashboardLayoutId: EXAMPLE_LAYOUT_ID, tiles: layoutTilesExample.map((tile) => ({ ...tile, hidden: false })) }, response: { ...layoutExample, tiles: layoutTilesExample.map((tile) => ({ ...tile, hidden: false })) }, forStatus: HttpResponseStatusCode.OK_200 }],
115
+ },
116
+ [Op.DELETE]: {
117
+ purpose: 'Reset a dashboard to the layout the application declares. Also the tenant cascade\'s door when the organization is deleted.',
118
+ outcome: 'The organization\'s arrangement is gone; every member sees the declared layout. Audited.',
119
+ whenToUse: 'An administrator resets the dashboard in its layout editor.',
120
+ responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout was deleted.' }],
121
+ errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],
122
+ idempotent: true,
123
+ },
124
+ },
125
+ businessConstraints: [
126
+ 'A layout arranges only the tiles a dashboard declares; it never adds a chart.',
127
+ 'A layout never shows a chart to a member who may not read it.',
128
+ 'Only the organization\'s administrators change a layout, and every change is audited.',
129
+ ],
130
+ }), { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS });
131
+ //# sourceMappingURL=organization-dashboard-layouts.resource.specification.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"organization-dashboard-layouts.resource.specification.js","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-dashboard-layouts.resource.specification.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAC;AACpE,OAAO,EAAE,mBAAmB,EAAE,cAAc,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AACxG,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,qBAAqB,IAAI,EAAE,EAC3B,iCAAiC,EACjC,oBAAoB,EACpB,uEAAuE,GACxE,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC;AAC5F,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAE3E,MAAM,uBAAuB,GAAG,gCAAgC,CAAC;AACjE,MAAM,iBAAiB,GAAG,0BAA0B,CAAC;AAErD,MAAM,eAAe,GAAG,CAAC,UAAkB,EAAE,EAAE,CAAC,CAAC;IAC/C,WAAW,EAAE,uBAAuB;IACpC,UAAU;IACV,UAAU,EAAE,cAAc,CAAC,IAAI;IAC/B,eAAe,EAAE,mBAAmB,CAAC,eAAe;CACrD,CAAC,CAAC;AAEH,MAAM,IAAI,GAAG,CAAI,IAAkB,EAAE,EAAE,CAAC,CAAC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E,+DAA+D;QAC/D,uFAAuF;KACxF;CACF,CAAC,EACF,EAAE,oBAAoB,EAAE,oBAAoB,CAAC,aAAa,EAAE,CAC7D,CAAC","sourcesContent":["/**\n * Resource: `organizationDashboardLayouts` — Wildo SaaS engine specification for how one organization arranges one of\n * the application's chart dashboards (#2299).\n *\n * Inputs:\n * - Schema: `OrganizationDashboardLayoutSchema` (`organizations/organization-dashboard-layouts.shared.schemas.ts`)\n * - Factory: `organizationDashboardLayoutsResourceConfiguration_InitializationFactory`\n * (`organizations/organization-dashboard-layouts.shared.resources-config.schemas.ts`)\n * - Readers: `ChartDashboard` (`@wildo-ai/saas-frontend-lib`) given a `layoutRef`, through `useChartDashboardLayout`.\n * - Writers: the dashboard's layout editor (`ChartDashboardLayoutEditor`), through the generic CREATE / UPDATE / DELETE,\n * and the organization deletion's cascade.\n *\n * Scope: the ORGANIZATIONS → ORGANIZATION_DASHBOARD_LAYOUTS relationship carries `isPrimaryScope: true`.\n */\n\nimport { LabelAudience } from '@wildo-ai/presets-components-models';\nimport { CodeDeclarationKind, CodeSymbolKind, FieldSemanticImportance } from '@wildo-ai/zod-decorators';\nimport {\n ChartDashboardTileRows,\n ChartDashboardTileSpan,\n CoreResourceOperation as Op,\n OrganizationDashboardLayoutSchema,\n ResourcePrimaryScope,\n organizationDashboardLayoutsResourceConfiguration_InitializationFactory,\n} from '@wildo-ai/saas-models';\nimport { HttpResponseStatusCode, resourceSpecification } from '~wildo-specifications/_core';\nimport { EngineResourceSubDomain } from '../../engine-resource-sub-domain';\n\nconst EXAMPLE_ORGANIZATION_ID = 'org_01J4P8F1M2N3Q4R5S6T7FIRM01';\nconst EXAMPLE_LAYOUT_ID = '66f6a1c2e3d4b5a697885001';\n\nconst enumDeclaration = (exportName: string) => ({\n packageName: '@wildo-ai/saas-models',\n exportName,\n symbolKind: CodeSymbolKind.ENUM,\n declarationKind: CodeDeclarationKind.TYPESCRIPT_ENUM,\n});\n\nconst page = <T>(data: readonly T[]) => ({ data, pagination: { page: 1, limit: 20, total: data.length, totalPages: data.length === 0 ? 0 : 1 } });\n\nconst ADMIN_FORBIDDEN = { code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not an administrator of the organization.' };\n\nconst layoutTilesExample = [\n { resourceType: 'cases', chartViewRef: 'cases-by-status', span: ChartDashboardTileSpan.ONE, rows: ChartDashboardTileRows.ONE, hidden: false },\n { resourceType: 'invoices', chartViewRef: 'revenue-by-month', span: ChartDashboardTileSpan.TWO, rows: ChartDashboardTileRows.TWO, hidden: false },\n { resourceType: 'slaBreaches', chartViewRef: 'breaches-by-team', span: ChartDashboardTileSpan.ONE, rows: ChartDashboardTileRows.ONE, hidden: true },\n];\n\nconst layoutExample = {\n _id: EXAMPLE_LAYOUT_ID,\n organizationId: EXAMPLE_ORGANIZATION_ID,\n dashboardRef: 'operations-dashboard',\n tiles: layoutTilesExample,\n createdAt: '2026-11-12T09:00:00.000Z',\n updatedAt: '2026-11-12T09:00:00.000Z',\n};\n\nexport const organizationDashboardLayoutsResourceSpecification = resourceSpecification(\n organizationDashboardLayoutsResourceConfiguration_InitializationFactory,\n OrganizationDashboardLayoutSchema,\n ({ schemaShape }) => ({\n purpose: 'Let an organization arrange one of the application\\'s chart dashboards for its members: the order of the tiles, the size of each, and which are hidden.',\n businessRole: 'The application declares what a dashboard holds; an organization decides what it sees first. A manager who reads revenue before anything else puts it first for the whole organization, without the application being changed.',\n lifecycleRole: 'No row means the dashboard as the application declares it. The first save CREATES the row, later saves UPDATE it, and a reset DELETES it; the organization\\'s deletion removes it.',\n audience: LabelAudience.ADMIN,\n subDomain: EngineResourceSubDomain.ORGANIZATIONS,\n codeHandling: {\n mainSchema: { packageName: '@wildo-ai/saas-models', exportName: 'OrganizationDashboardLayoutSchema', symbolKind: CodeSymbolKind.SCHEMA, declarationKind: CodeDeclarationKind.ZOD_SCHEMA },\n resourceFactory: { packageName: '@wildo-ai/saas-models', exportName: 'organizationDashboardLayoutsResourceConfiguration_InitializationFactory', symbolKind: CodeSymbolKind.FACTORY, declarationKind: CodeDeclarationKind.FUNCTION },\n resourceType: { enumDeclaration: enumDeclaration('CoreResourceType'), memberName: 'ORGANIZATION_DASHBOARD_LAYOUTS' },\n operationVocabulary: { coreEnum: enumDeclaration('CoreResourceOperation') },\n notes: [\n 'The layout only ARRANGES the tiles the dashboard declares: an entry naming a tile the dashboard does not declare is ignored, and a tile declared after the layout was saved is shown after the stored ones. A layout cannot add a chart.',\n 'It never widens access: the dashboard still hides a tile whose chart the viewer\\'s roles would be refused, whatever the layout says.',\n 'Every write is MEDIUM and declared audited (`auditBelowRiskFloor`): `RESOURCE_OPERATION_PERFORMED` carries the tiles before and after, since `tiles` is audit evidence.',\n 'One row per organization and dashboard (`dashboardRef` unique within the organization, on both stores); a second CREATE for the same dashboard answers 409.',\n 'The organization\\'s own state, never a relationship\\'s record: every door admits a representing organization only through a lent capability. FORBIDDEN from a subject export: a layout names charts and sizes, never a person.',\n ],\n },\n fields: {\n _id: schemaShape._id.stringSpec({ meaning: 'Identifier of one organization\\'s layout of one dashboard.', semanticRole: 'identifier', importance: FieldSemanticImportance.PRIMARY }),\n organizationId: schemaShape.organizationId.foreignKeySpec({ meaning: 'The organization whose members see the dashboard arranged this way.', whyItMatters: 'Each organization arranges its dashboards for itself; another organization never sees this arrangement.', importance: FieldSemanticImportance.PRIMARY }),\n dashboardRef: schemaShape.dashboardRef.stringSpec({ meaning: 'The dashboard this layout arranges: the `layoutRef` the application gives `ChartDashboard`, e.g. `home-analytics`.', whyItMatters: 'Unique within the organization: one layout per dashboard. Never changed after creation.', importance: FieldSemanticImportance.PRIMARY }),\n tiles: schemaShape.tiles.arraySpec({\n meaning: 'The dashboard\\'s tiles in the order shown, each with its width (`ChartDashboardTileSpan`), its height in rows (`ChartDashboardTileRows`) and whether the organization hides it.',\n elementMeaning: 'One declared tile: the resource whose chart views declare the chart, the chart view\\'s ref, its size, and `hidden`.',\n whyItMatters: 'A tile appears at most once. Recorded before and after each change in the audit trail.',\n importance: FieldSemanticImportance.PRIMARY,\n }),\n createdAt: schemaShape.createdAt.dateSpec({ meaning: 'When the organization first arranged the dashboard.', temporalRole: 'creation' }),\n updatedAt: schemaShape.updatedAt.dateSpec({ meaning: 'When the arrangement last changed.', temporalRole: 'modified' }),\n },\n operations: {\n [Op.READ]: {\n purpose: 'Read one of the organization\\'s dashboard layouts.',\n outcome: 'The layout.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout is returned.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not a member of the organization.' }, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],\n idempotent: true,\n examples: [{ title: 'Read a layout', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationDashboardLayoutId: EXAMPLE_LAYOUT_ID }, response: layoutExample, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.LIST]: {\n purpose: 'List the organization\\'s dashboard layouts, filtered by `dashboardRef`: what a dashboard reads to know how the organization arranged it.',\n outcome: 'A page holding the dashboard\\'s layout, or none when the organization keeps the declared one.',\n whenToUse: 'Every member opening a dashboard that has a `layoutRef`.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'A possibly empty page of layouts.' }],\n errorScenarios: [{ code: HttpResponseStatusCode.FORBIDDEN_403, when: 'The caller is not a member of the organization.' }],\n idempotent: true,\n examples: [{ title: 'Read the layout of one dashboard', request: { organizationId: EXAMPLE_ORGANIZATION_ID, dashboardRef: 'operations-dashboard' }, response: page([layoutExample]), forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.CREATE]: {\n purpose: 'Arrange a dashboard for the organization for the first time.',\n outcome: 'Every member sees the dashboard in this order, at these sizes, without the hidden tiles. Audited.',\n whenToUse: 'An administrator saves the layout editor of a dashboard the organization has not arranged yet.',\n importance: FieldSemanticImportance.PRIMARY,\n responseStatuses: [{ code: HttpResponseStatusCode.CREATED_201, meaning: 'The layout was stored.' }],\n errorScenarios: [\n ADMIN_FORBIDDEN,\n { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A tile appears twice, a size is not one of the vocabulary\\'s, or the layout holds more than 60 tiles.' },\n { code: HttpResponseStatusCode.CONFLICT_409, when: 'The organization already has a layout for this dashboard (update it instead).' },\n ],\n idempotent: false,\n examples: [{ title: 'Put revenue first and hide SLA breaches', request: { organizationId: EXAMPLE_ORGANIZATION_ID, dashboardRef: 'operations-dashboard', tiles: layoutTilesExample }, response: layoutExample, forStatus: HttpResponseStatusCode.CREATED_201 }],\n },\n [Op.UPDATE]: {\n purpose: 'Change the organization\\'s arrangement of a dashboard.',\n outcome: 'Every member sees the new arrangement. Audited, with the tiles before and after.',\n whenToUse: 'An administrator saves the layout editor of a dashboard the organization already arranged.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout was updated.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.BAD_REQUEST_400, when: 'A tile appears twice, or a size is not one of the vocabulary\\'s.' }, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],\n idempotent: true,\n examples: [{ title: 'Show SLA breaches again', request: { organizationId: EXAMPLE_ORGANIZATION_ID, organizationDashboardLayoutId: EXAMPLE_LAYOUT_ID, tiles: layoutTilesExample.map((tile) => ({ ...tile, hidden: false })) }, response: { ...layoutExample, tiles: layoutTilesExample.map((tile) => ({ ...tile, hidden: false })) }, forStatus: HttpResponseStatusCode.OK_200 }],\n },\n [Op.DELETE]: {\n purpose: 'Reset a dashboard to the layout the application declares. Also the tenant cascade\\'s door when the organization is deleted.',\n outcome: 'The organization\\'s arrangement is gone; every member sees the declared layout. Audited.',\n whenToUse: 'An administrator resets the dashboard in its layout editor.',\n responseStatuses: [{ code: HttpResponseStatusCode.OK_200, meaning: 'The layout was deleted.' }],\n errorScenarios: [ADMIN_FORBIDDEN, { code: HttpResponseStatusCode.NOT_FOUND_404, when: 'No layout with this id exists in the organization.' }],\n idempotent: true,\n },\n },\n businessConstraints: [\n 'A layout arranges only the tiles a dashboard declares; it never adds a chart.',\n 'A layout never shows a chart to a member who may not read it.',\n 'Only the organization\\'s administrators change a layout, and every change is audited.',\n ],\n }),\n { resourcePrimaryScope: ResourcePrimaryScope.ORGANIZATIONS },\n);\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"organization-members.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-members.resource.specification.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,cAAc,EACd,qBAAqB,IAAI,EAAE,EAK3B,wBAAwB,EACxB,8BAA8B,EAG/B,MAAM,uBAAuB,CAAC;AA2D/B,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;iCA+hBpD,CAAC"}
1
+ {"version":3,"file":"organization-members.resource.specification.d.ts","sourceRoot":"","sources":["../../../../../src/engine/organizations/resources/organization-members.resource.specification.ts"],"names":[],"mappings":"AAWA,OAAO,EAEL,cAAc,EACd,qBAAqB,IAAI,EAAE,EAK3B,wBAAwB,EACxB,8BAA8B,EAG/B,MAAM,uBAAuB,CAAC;AA2D/B,eAAO,MAAM,wCAAwC;;;;;;;;;;;;;;;;;;iCAkiBpD,CAAC"}