@open-mercato/core 0.8.1-develop.7228.1.b7ea09d2d3 → 0.8.1-develop.7237.1.635faf2c7a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +2 -2
- package/dist/generated/entities/availability_policy/index.js +41 -0
- package/dist/generated/entities/availability_policy/index.js.map +7 -0
- package/dist/generated/entities.ids.generated.js +4 -0
- package/dist/generated/entities.ids.generated.js.map +2 -2
- package/dist/generated/entity-fields-registry.js +21 -0
- package/dist/generated/entity-fields-registry.js.map +2 -2
- package/dist/modules/attachments/data/entities.js +3 -3
- package/dist/modules/attachments/data/entities.js.map +2 -2
- package/dist/modules/availability/acl.js +16 -0
- package/dist/modules/availability/acl.js.map +7 -0
- package/dist/modules/availability/api/check/route.js +95 -0
- package/dist/modules/availability/api/check/route.js.map +7 -0
- package/dist/modules/availability/api/openapi.js +27 -0
- package/dist/modules/availability/api/openapi.js.map +7 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js +58 -0
- package/dist/modules/availability/api/policies/resolve-preview/route.js.map +7 -0
- package/dist/modules/availability/api/policies/route.js +188 -0
- package/dist/modules/availability/api/policies/route.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.js +185 -0
- package/dist/modules/availability/backend/availability/check/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/check/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js +79 -0
- package/dist/modules/availability/backend/availability/policies/ResolutionPreviewPanel.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js +53 -0
- package/dist/modules/availability/backend/availability/policies/ScopeFields.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js +152 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/[id]/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js +94 -0
- package/dist/modules/availability/backend/availability/policies/create/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js +12 -0
- package/dist/modules/availability/backend/availability/policies/create/page.meta.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js +75 -0
- package/dist/modules/availability/backend/availability/policies/formGroups.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.js +176 -0
- package/dist/modules/availability/backend/availability/policies/page.js.map +7 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js +16 -0
- package/dist/modules/availability/backend/availability/policies/page.meta.js.map +7 -0
- package/dist/modules/availability/commands/policies.js +312 -0
- package/dist/modules/availability/commands/policies.js.map +7 -0
- package/dist/modules/availability/commands/scope.js +19 -0
- package/dist/modules/availability/commands/scope.js.map +7 -0
- package/dist/modules/availability/data/entities.js +95 -0
- package/dist/modules/availability/data/entities.js.map +7 -0
- package/dist/modules/availability/data/validators.js +53 -0
- package/dist/modules/availability/data/validators.js.map +7 -0
- package/dist/modules/availability/di.js +41 -0
- package/dist/modules/availability/di.js.map +7 -0
- package/dist/modules/availability/events.js +18 -0
- package/dist/modules/availability/events.js.map +7 -0
- package/dist/modules/availability/index.js +15 -0
- package/dist/modules/availability/index.js.map +7 -0
- package/dist/modules/availability/lib/policyResolution.js +155 -0
- package/dist/modules/availability/lib/policyResolution.js.map +7 -0
- package/dist/modules/availability/lib/tryResolve.js +11 -0
- package/dist/modules/availability/lib/tryResolve.js.map +7 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js +16 -0
- package/dist/modules/availability/migrations/Migration20260922095844_availability.js.map +7 -0
- package/dist/modules/availability/setup.js +12 -0
- package/dist/modules/availability/setup.js.map +7 -0
- package/dist/modules/entities/cli.js +33 -12
- package/dist/modules/entities/cli.js.map +2 -2
- package/dist/modules/inbox_ops/api/settings/route.js +7 -32
- package/dist/modules/inbox_ops/api/settings/route.js.map +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js +2 -2
- package/dist/modules/inbox_ops/backend/inbox-ops/settings/page.js.map +2 -2
- package/dist/modules/inbox_ops/components/proposals/ActionCard.js +1 -1
- package/dist/modules/inbox_ops/components/proposals/ActionCard.js.map +2 -2
- package/dist/modules/inbox_ops/lib/ensure-settings.js +47 -0
- package/dist/modules/inbox_ops/lib/ensure-settings.js.map +7 -0
- package/dist/modules/inbox_ops/lib/executionEngine.js.map +1 -1
- package/dist/modules/inbox_ops/lib/executionHelpers.js +0 -23
- package/dist/modules/inbox_ops/lib/executionHelpers.js.map +2 -2
- package/dist/modules/inbox_ops/lib/payloadEnrichment.js +0 -3
- package/dist/modules/inbox_ops/lib/payloadEnrichment.js.map +2 -2
- package/dist/modules/inbox_ops/setup.js +2 -21
- package/dist/modules/inbox_ops/setup.js.map +2 -2
- package/dist/modules/inbox_ops/subscribers/extractionWorker.js.map +1 -1
- package/dist/modules/sales/data/entities.js +3 -1
- package/dist/modules/sales/data/entities.js.map +2 -2
- package/dist/modules/sales/inbox-actions.js +0 -12
- package/dist/modules/sales/inbox-actions.js.map +2 -2
- package/dist/modules/sales/migrations/Migration20260916120000_sales_payment_allocation_order_idx.js +20 -0
- package/dist/modules/sales/migrations/Migration20260916120000_sales_payment_allocation_order_idx.js.map +7 -0
- package/dist/modules/wms/di.js +3 -0
- package/dist/modules/wms/di.js.map +2 -2
- package/dist/modules/wms/lib/availabilityCache.js +85 -0
- package/dist/modules/wms/lib/availabilityCache.js.map +7 -0
- package/dist/modules/wms/lib/availabilityCalculation.js +178 -0
- package/dist/modules/wms/lib/availabilityCalculation.js.map +7 -0
- package/dist/modules/wms/lib/availabilityProvider.js +14 -0
- package/dist/modules/wms/lib/availabilityProvider.js.map +7 -0
- package/dist/modules/wms/lib/sqlInClause.js +9 -0
- package/dist/modules/wms/lib/sqlInClause.js.map +7 -0
- package/dist/modules/wms/lib/tryResolve.js +11 -0
- package/dist/modules/wms/lib/tryResolve.js.map +7 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js +16 -0
- package/dist/modules/wms/subscribers/invalidate-availability-cache.js.map +7 -0
- package/generated/entities/availability_policy/index.ts +19 -0
- package/generated/entities.ids.generated.ts +4 -0
- package/generated/entity-fields-registry.ts +21 -0
- package/package.json +7 -7
- package/src/modules/attachments/data/entities.ts +5 -3
- package/src/modules/auth/i18n/de.json +3 -0
- package/src/modules/auth/i18n/en.json +3 -0
- package/src/modules/auth/i18n/es.json +3 -0
- package/src/modules/auth/i18n/ko.json +3 -0
- package/src/modules/auth/i18n/pl.json +3 -0
- package/src/modules/availability/acl.ts +12 -0
- package/src/modules/availability/api/check/route.ts +114 -0
- package/src/modules/availability/api/openapi.ts +28 -0
- package/src/modules/availability/api/policies/resolve-preview/route.ts +67 -0
- package/src/modules/availability/api/policies/route.ts +224 -0
- package/src/modules/availability/backend/availability/check/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/check/page.tsx +223 -0
- package/src/modules/availability/backend/availability/policies/ResolutionPreviewPanel.tsx +106 -0
- package/src/modules/availability/backend/availability/policies/ScopeFields.tsx +55 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/[id]/page.tsx +182 -0
- package/src/modules/availability/backend/availability/policies/create/page.meta.ts +8 -0
- package/src/modules/availability/backend/availability/policies/create/page.tsx +105 -0
- package/src/modules/availability/backend/availability/policies/formGroups.ts +77 -0
- package/src/modules/availability/backend/availability/policies/page.meta.ts +12 -0
- package/src/modules/availability/backend/availability/policies/page.tsx +196 -0
- package/src/modules/availability/commands/policies.ts +358 -0
- package/src/modules/availability/commands/scope.ts +26 -0
- package/src/modules/availability/data/entities.ts +92 -0
- package/src/modules/availability/data/validators.ts +70 -0
- package/src/modules/availability/di.ts +54 -0
- package/src/modules/availability/events.ts +17 -0
- package/src/modules/availability/i18n/de.json +81 -0
- package/src/modules/availability/i18n/en.json +81 -0
- package/src/modules/availability/i18n/es.json +81 -0
- package/src/modules/availability/i18n/ko.json +81 -0
- package/src/modules/availability/i18n/pl.json +81 -0
- package/src/modules/availability/index.ts +13 -0
- package/src/modules/availability/lib/policyResolution.ts +264 -0
- package/src/modules/availability/lib/tryResolve.ts +8 -0
- package/src/modules/availability/migrations/.snapshot-open-mercato.json +375 -0
- package/src/modules/availability/migrations/Migration20260922095844_availability.ts +13 -0
- package/src/modules/availability/setup.ts +10 -0
- package/src/modules/entities/cli.ts +53 -13
- package/src/modules/inbox_ops/api/settings/route.ts +9 -32
- package/src/modules/inbox_ops/backend/inbox-ops/settings/page.tsx +2 -2
- package/src/modules/inbox_ops/components/proposals/ActionCard.tsx +1 -1
- package/src/modules/inbox_ops/i18n/de.json +1 -1
- package/src/modules/inbox_ops/i18n/en.json +1 -1
- package/src/modules/inbox_ops/i18n/es.json +1 -1
- package/src/modules/inbox_ops/i18n/ko.json +1 -1
- package/src/modules/inbox_ops/i18n/pl.json +1 -1
- package/src/modules/inbox_ops/lib/ensure-settings.ts +77 -0
- package/src/modules/inbox_ops/lib/executionEngine.ts +1 -1
- package/src/modules/inbox_ops/lib/executionHelpers.ts +0 -27
- package/src/modules/inbox_ops/lib/payloadEnrichment.ts +1 -5
- package/src/modules/inbox_ops/setup.ts +2 -21
- package/src/modules/inbox_ops/subscribers/extractionWorker.ts +1 -1
- package/src/modules/sales/data/entities.ts +2 -0
- package/src/modules/sales/inbox-actions.ts +0 -20
- package/src/modules/sales/migrations/.snapshot-open-mercato.json +20 -0
- package/src/modules/sales/migrations/Migration20260916120000_sales_payment_allocation_order_idx.ts +74 -0
- package/src/modules/wms/di.ts +6 -0
- package/src/modules/wms/lib/availabilityCache.ts +136 -0
- package/src/modules/wms/lib/availabilityCalculation.ts +289 -0
- package/src/modules/wms/lib/availabilityProvider.ts +29 -0
- package/src/modules/wms/lib/sqlInClause.ts +21 -0
- package/src/modules/wms/lib/tryResolve.ts +8 -0
- package/src/modules/wms/subscribers/invalidate-availability-cache.ts +30 -0
|
@@ -8,7 +8,7 @@ var __decorateClass = (decorators, target, key, kind) => {
|
|
|
8
8
|
if (kind && result) __defProp(target, key, result);
|
|
9
9
|
return result;
|
|
10
10
|
};
|
|
11
|
-
import { OptionalProps } from "@mikro-orm/core";
|
|
11
|
+
import { BigIntType, OptionalProps } from "@mikro-orm/core";
|
|
12
12
|
import { Entity, Index, PrimaryKey, Property, Unique } from "@mikro-orm/decorators/legacy";
|
|
13
13
|
import { resolveDefaultAttachmentOcrEnabled } from "../lib/ocrConfig.js";
|
|
14
14
|
OptionalProps;
|
|
@@ -141,10 +141,10 @@ __decorateClass([
|
|
|
141
141
|
Property({ name: "organization_id", type: "uuid" })
|
|
142
142
|
], AttachmentQuotaReservation.prototype, "organizationId", 2);
|
|
143
143
|
__decorateClass([
|
|
144
|
-
Property({ name: "reserved_bytes", type: "
|
|
144
|
+
Property({ name: "reserved_bytes", type: new BigIntType("number") })
|
|
145
145
|
], AttachmentQuotaReservation.prototype, "reservedBytes", 2);
|
|
146
146
|
__decorateClass([
|
|
147
|
-
Property({ name: "actual_bytes", type: "
|
|
147
|
+
Property({ name: "actual_bytes", type: new BigIntType("number"), nullable: true })
|
|
148
148
|
], AttachmentQuotaReservation.prototype, "actualBytes", 2);
|
|
149
149
|
__decorateClass([
|
|
150
150
|
Property({ type: "text", default: "reserved" })
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/modules/attachments/data/entities.ts"],
|
|
4
|
-
"sourcesContent": ["import { OptionalProps } from '@mikro-orm/core'\nimport { Entity, Index, PrimaryKey, Property, Unique } from '@mikro-orm/decorators/legacy'\nimport { resolveDefaultAttachmentOcrEnabled } from '../lib/ocrConfig'\n\n@Entity({ tableName: 'attachment_partitions' })\n@Unique({ name: 'attachment_partitions_code_unique', properties: ['code'] })\nexport class AttachmentPartition {\n [OptionalProps]?: 'createdAt' | 'updatedAt'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ type: 'text' })\n code!: string\n\n @Property({ type: 'text' })\n title!: string\n\n @Property({ type: 'text', nullable: true })\n description?: string | null\n\n @Property({ name: 'storage_driver', type: 'text', default: 'local' })\n storageDriver: string = 'local'\n\n @Property({ name: 'config_json', type: 'json', nullable: true })\n configJson?: Record<string, unknown> | null\n\n @Property({ name: 'is_public', type: 'boolean', default: false })\n isPublic: boolean = false\n\n @Property({ name: 'requires_ocr', type: 'boolean', default: resolveDefaultAttachmentOcrEnabled() })\n requiresOcr: boolean = resolveDefaultAttachmentOcrEnabled()\n\n @Property({ name: 'ocr_model', type: 'text', nullable: true })\n ocrModel?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n @Index({ name: 'attachment_partitions_tenant_idx' })\n tenantId?: string | null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n}\n\n@Entity({ tableName: 'attachments' })\nexport class Attachment {\n [OptionalProps]?: 'createdAt'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'entity_id', type: 'text' })\n entityId!: string\n\n @Property({ name: 'record_id', type: 'text' })\n @Index({ name: 'attachments_entity_record_idx' })\n recordId!: string\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n tenantId?: string | null\n\n @Property({ name: 'partition_code', type: 'text' })\n @Index({ name: 'attachments_partition_code_idx' })\n partitionCode!: string\n\n @Property({ name: 'file_name', type: 'text' })\n fileName!: string\n\n @Property({ name: 'mime_type', type: 'text' })\n mimeType!: string\n\n @Property({ name: 'file_size', type: 'int' })\n fileSize!: number\n\n @Property({ name: 'storage_driver', type: 'text', default: 'local' })\n storageDriver: string = 'local'\n\n @Property({ name: 'storage_path', type: 'text' })\n storagePath!: string\n\n @Property({ name: 'storage_metadata', type: 'jsonb', nullable: true })\n storageMetadata?: Record<string, unknown> | null\n\n @Property({ name: 'url', type: 'text' })\n url!: string\n\n @Property({ name: 'content', type: 'text', nullable: true })\n content: string | null = null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n}\n\n@Entity({ tableName: 'attachment_quota_reservations' })\n@Unique({\n name: 'attachment_quota_reservations_scope_path_unique',\n properties: ['tenantId', 'storageDriver', 'storagePath'],\n})\n@Index({\n name: 'attachment_quota_reservations_tenant_status_idx',\n properties: ['tenantId', 'status'],\n})\nexport class AttachmentQuotaReservation {\n [OptionalProps]?: 'actualBytes' | 'createdAt' | 'status' | 'updatedAt' | 'uploadTokenHash'\n\n @PrimaryKey({ type: 'uuid' })\n id!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n @Property({ name: 'reserved_bytes', type: '
|
|
5
|
-
"mappings": ";;;;;;;;;;AAAA,SAAS,qBAAqB;
|
|
4
|
+
"sourcesContent": ["import { BigIntType, OptionalProps } from '@mikro-orm/core'\nimport { Entity, Index, PrimaryKey, Property, Unique } from '@mikro-orm/decorators/legacy'\nimport { resolveDefaultAttachmentOcrEnabled } from '../lib/ocrConfig'\n\n@Entity({ tableName: 'attachment_partitions' })\n@Unique({ name: 'attachment_partitions_code_unique', properties: ['code'] })\nexport class AttachmentPartition {\n [OptionalProps]?: 'createdAt' | 'updatedAt'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ type: 'text' })\n code!: string\n\n @Property({ type: 'text' })\n title!: string\n\n @Property({ type: 'text', nullable: true })\n description?: string | null\n\n @Property({ name: 'storage_driver', type: 'text', default: 'local' })\n storageDriver: string = 'local'\n\n @Property({ name: 'config_json', type: 'json', nullable: true })\n configJson?: Record<string, unknown> | null\n\n @Property({ name: 'is_public', type: 'boolean', default: false })\n isPublic: boolean = false\n\n @Property({ name: 'requires_ocr', type: 'boolean', default: resolveDefaultAttachmentOcrEnabled() })\n requiresOcr: boolean = resolveDefaultAttachmentOcrEnabled()\n\n @Property({ name: 'ocr_model', type: 'text', nullable: true })\n ocrModel?: string | null\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n @Index({ name: 'attachment_partitions_tenant_idx' })\n tenantId?: string | null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n\n @Property({ name: 'updated_at', type: Date, onUpdate: () => new Date() })\n updatedAt: Date = new Date()\n}\n\n@Entity({ tableName: 'attachments' })\nexport class Attachment {\n [OptionalProps]?: 'createdAt'\n\n @PrimaryKey({ type: 'uuid', defaultRaw: 'gen_random_uuid()' })\n id!: string\n\n @Property({ name: 'entity_id', type: 'text' })\n entityId!: string\n\n @Property({ name: 'record_id', type: 'text' })\n @Index({ name: 'attachments_entity_record_idx' })\n recordId!: string\n\n @Property({ name: 'organization_id', type: 'uuid', nullable: true })\n organizationId?: string | null\n\n @Property({ name: 'tenant_id', type: 'uuid', nullable: true })\n tenantId?: string | null\n\n @Property({ name: 'partition_code', type: 'text' })\n @Index({ name: 'attachments_partition_code_idx' })\n partitionCode!: string\n\n @Property({ name: 'file_name', type: 'text' })\n fileName!: string\n\n @Property({ name: 'mime_type', type: 'text' })\n mimeType!: string\n\n @Property({ name: 'file_size', type: 'int' })\n fileSize!: number\n\n @Property({ name: 'storage_driver', type: 'text', default: 'local' })\n storageDriver: string = 'local'\n\n @Property({ name: 'storage_path', type: 'text' })\n storagePath!: string\n\n @Property({ name: 'storage_metadata', type: 'jsonb', nullable: true })\n storageMetadata?: Record<string, unknown> | null\n\n @Property({ name: 'url', type: 'text' })\n url!: string\n\n @Property({ name: 'content', type: 'text', nullable: true })\n content: string | null = null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n createdAt: Date = new Date()\n}\n\n@Entity({ tableName: 'attachment_quota_reservations' })\n@Unique({\n name: 'attachment_quota_reservations_scope_path_unique',\n properties: ['tenantId', 'storageDriver', 'storagePath'],\n})\n@Index({\n name: 'attachment_quota_reservations_tenant_status_idx',\n properties: ['tenantId', 'status'],\n})\nexport class AttachmentQuotaReservation {\n [OptionalProps]?: 'actualBytes' | 'createdAt' | 'status' | 'updatedAt' | 'uploadTokenHash'\n\n @PrimaryKey({ type: 'uuid' })\n id!: string\n\n @Property({ name: 'tenant_id', type: 'uuid' })\n tenantId!: string\n\n @Property({ name: 'organization_id', type: 'uuid' })\n organizationId!: string\n\n /** Backed by a `bigint` column; hydrate as `number` (safe under Number.MAX_SAFE_INTEGER for attachment byte counts) instead of MikroORM's default JS `bigint`. */\n @Property({ name: 'reserved_bytes', type: new BigIntType('number') })\n reservedBytes!: number\n\n /** Backed by a `bigint` column; hydrate as `number`, not MikroORM's default JS `bigint`. */\n @Property({ name: 'actual_bytes', type: new BigIntType('number'), nullable: true })\n actualBytes?: number | null\n\n @Property({ type: 'text', default: 'reserved' })\n status: 'reserved' | 'storing' | 'stored' | 'recovering' | 'committed' = 'reserved'\n\n @Property({ type: 'text' })\n source!: string\n\n @Property({ name: 'storage_driver', type: 'text' })\n storageDriver!: string\n\n @Property({ name: 'partition_code', type: 'text', nullable: true })\n partitionCode?: string | null\n\n @Property({ name: 'storage_path', type: 'text' })\n storagePath!: string\n\n @Property({ name: 'lease_token', type: 'uuid' })\n leaseToken!: string\n\n @Property({ name: 'upload_token_hash', type: 'text', nullable: true })\n uploadTokenHash?: string | null\n\n @Property({ name: 'expires_at', type: Date, nullable: true })\n @Index({ name: 'attachment_quota_reservations_expires_idx' })\n expiresAt?: Date | null\n\n @Property({ name: 'created_at', type: Date, onCreate: () => new Date() })\n created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AE,WAAW,gCAAgC,CAAC;AAAA,EACrD,OAAO;AAAA,IACN,MAAM;AAAA,IACN,YAAY,CAAC,YAAY,iBAAiB,aAAa;AAAA,EACzD,CAAC;AAAA,EACA,MAAM;AAAA,IACL,MAAM;AAAA,IACN,YAAY,CAAC,YAAY,QAAQ;AAAA,EACnC,CAAC;AAAA,GACY;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
const features = [
|
|
2
|
+
{ id: "availability.policies.view", title: "View availability policies", module: "availability" },
|
|
3
|
+
{
|
|
4
|
+
id: "availability.policies.manage",
|
|
5
|
+
title: "Manage availability policies",
|
|
6
|
+
module: "availability",
|
|
7
|
+
dependsOn: ["availability.policies.view"]
|
|
8
|
+
},
|
|
9
|
+
{ id: "availability.check", title: "Run availability checks", module: "availability" }
|
|
10
|
+
];
|
|
11
|
+
var acl_default = features;
|
|
12
|
+
export {
|
|
13
|
+
acl_default as default,
|
|
14
|
+
features
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=acl.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/modules/availability/acl.ts"],
|
|
4
|
+
"sourcesContent": ["export const features = [\n { id: 'availability.policies.view', title: 'View availability policies', module: 'availability' },\n {\n id: 'availability.policies.manage',\n title: 'Manage availability policies',\n module: 'availability',\n dependsOn: ['availability.policies.view'],\n },\n { id: 'availability.check', title: 'Run availability checks', module: 'availability' },\n]\n\nexport default features\n"],
|
|
5
|
+
"mappings": "AAAO,MAAM,WAAW;AAAA,EACtB,EAAE,IAAI,8BAA8B,OAAO,8BAA8B,QAAQ,eAAe;AAAA,EAChG;AAAA,IACE,IAAI;AAAA,IACJ,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,WAAW,CAAC,4BAA4B;AAAA,EAC1C;AAAA,EACA,EAAE,IAAI,sBAAsB,OAAO,2BAA2B,QAAQ,eAAe;AACvF;AAEA,IAAO,cAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
|
|
4
|
+
import { resolveActiveOrganizationId, organizationScopeRequiredResponse } from "@open-mercato/shared/lib/auth/organizationScope";
|
|
5
|
+
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
6
|
+
import { resolveAvailability, availabilityItemKey } from "@open-mercato/shared/lib/availability";
|
|
7
|
+
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
8
|
+
import { tryResolve } from "../../lib/tryResolve.js";
|
|
9
|
+
const routeMetadata = {
|
|
10
|
+
POST: { requireAuth: true, requireFeatures: ["availability.check"] }
|
|
11
|
+
};
|
|
12
|
+
const metadata = routeMetadata;
|
|
13
|
+
const openApi = {
|
|
14
|
+
tags: ["Availability"],
|
|
15
|
+
summary: "Reproduce the availability state and policy trace a buyer would see for one item.",
|
|
16
|
+
description: "Admin/debug tool. Mirrors resolveAvailability() and includes the per-field policySourceId trace."
|
|
17
|
+
};
|
|
18
|
+
const checkSchema = z.object({
|
|
19
|
+
productId: z.uuid(),
|
|
20
|
+
variantId: z.uuid().nullable().optional(),
|
|
21
|
+
quantity: z.coerce.number().int().min(1).default(1),
|
|
22
|
+
storeId: z.uuid().nullable().optional()
|
|
23
|
+
});
|
|
24
|
+
async function POST(req) {
|
|
25
|
+
const { translate } = await resolveTranslations();
|
|
26
|
+
const auth = await getAuthFromRequest(req);
|
|
27
|
+
if (!auth || !auth.tenantId) {
|
|
28
|
+
return NextResponse.json({ error: translate("availability.errors.unauthorized", "Unauthorized") }, { status: 401 });
|
|
29
|
+
}
|
|
30
|
+
const organizationId = resolveActiveOrganizationId(auth);
|
|
31
|
+
if (!organizationId) return organizationScopeRequiredResponse();
|
|
32
|
+
const body = await req.json().catch(() => ({}));
|
|
33
|
+
const parsed = checkSchema.safeParse(body);
|
|
34
|
+
if (!parsed.success) {
|
|
35
|
+
return NextResponse.json(
|
|
36
|
+
{ error: translate("availability.errors.invalidCheckRequest", "Invalid request") },
|
|
37
|
+
{ status: 400 }
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
const { productId, variantId, quantity, storeId } = parsed.data;
|
|
41
|
+
const tenantId = auth.tenantId;
|
|
42
|
+
const container = await createRequestContainer();
|
|
43
|
+
const em = container.resolve("em");
|
|
44
|
+
const CatalogProduct = tryResolve(container, "CatalogProduct");
|
|
45
|
+
if (CatalogProduct) {
|
|
46
|
+
const product = await em.findOne(CatalogProduct, { id: productId, organizationId, tenantId, deletedAt: null });
|
|
47
|
+
if (!product) {
|
|
48
|
+
return NextResponse.json(
|
|
49
|
+
{ error: translate("availability.errors.productNotFound", "No such product") },
|
|
50
|
+
{ status: 404 }
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
if (variantId) {
|
|
54
|
+
const CatalogProductVariant = tryResolve(container, "CatalogProductVariant");
|
|
55
|
+
if (CatalogProductVariant) {
|
|
56
|
+
const variant = await em.findOne(CatalogProductVariant, {
|
|
57
|
+
id: variantId,
|
|
58
|
+
organizationId,
|
|
59
|
+
tenantId,
|
|
60
|
+
deletedAt: null
|
|
61
|
+
});
|
|
62
|
+
if (!variant) {
|
|
63
|
+
return NextResponse.json(
|
|
64
|
+
{ error: translate("availability.errors.variantNotFound", "No such variant") },
|
|
65
|
+
{ status: 404 }
|
|
66
|
+
);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
const query = {
|
|
72
|
+
tenantId,
|
|
73
|
+
organizationId,
|
|
74
|
+
storeId: storeId ?? null,
|
|
75
|
+
items: [{ catalogProductId: productId, catalogVariantId: variantId ?? null, quantity }]
|
|
76
|
+
};
|
|
77
|
+
const moduleConfig = tryResolve(container, "moduleConfigService");
|
|
78
|
+
const result = await resolveAvailability(query, moduleConfig ? { moduleConfig } : void 0);
|
|
79
|
+
const item = result.byItem[availabilityItemKey({ catalogProductId: productId, catalogVariantId: variantId ?? null })] ?? null;
|
|
80
|
+
const policyResolutionService = tryResolve(container, "policyResolutionService");
|
|
81
|
+
const policyTrace = policyResolutionService ? await policyResolutionService.resolve(em, {
|
|
82
|
+
tenantId,
|
|
83
|
+
organizationId,
|
|
84
|
+
storeId: storeId ?? null,
|
|
85
|
+
productId,
|
|
86
|
+
variantId: variantId ?? null
|
|
87
|
+
}) : null;
|
|
88
|
+
return NextResponse.json({ availability: item, policyTrace });
|
|
89
|
+
}
|
|
90
|
+
export {
|
|
91
|
+
POST,
|
|
92
|
+
metadata,
|
|
93
|
+
openApi
|
|
94
|
+
};
|
|
95
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/availability/api/check/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { resolveActiveOrganizationId, organizationScopeRequiredResponse } from '@open-mercato/shared/lib/auth/organizationScope'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { resolveAvailability, availabilityItemKey } from '@open-mercato/shared/lib/availability'\nimport type { AvailabilityModuleConfigReader, AvailabilityQuery } from '@open-mercato/shared/lib/availability'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { tryResolve } from '../../lib/tryResolve'\nimport type { PolicyResolutionService } from '../../lib/policyResolution'\n\n/**\n * `POST /api/availability/check` \u2014 admin/debug reproduction of what a buyer saw,\n * including the per-field `policySourceId` trace. No public storefront endpoints\n * ship in this module (\u00A78).\n */\nconst routeMetadata = {\n POST: { requireAuth: true, requireFeatures: ['availability.check'] },\n}\n\nexport const metadata = routeMetadata\n\nexport const openApi = {\n tags: ['Availability'],\n summary: 'Reproduce the availability state and policy trace a buyer would see for one item.',\n description: 'Admin/debug tool. Mirrors resolveAvailability() and includes the per-field policySourceId trace.',\n}\n\nconst checkSchema = z.object({\n productId: z.uuid(),\n variantId: z.uuid().nullable().optional(),\n quantity: z.coerce.number().int().min(1).default(1),\n storeId: z.uuid().nullable().optional(),\n})\n\nexport async function POST(req: Request) {\n const { translate } = await resolveTranslations()\n const auth = await getAuthFromRequest(req)\n if (!auth || !auth.tenantId) {\n return NextResponse.json({ error: translate('availability.errors.unauthorized', 'Unauthorized') }, { status: 401 })\n }\n\n const organizationId = resolveActiveOrganizationId(auth)\n if (!organizationId) return organizationScopeRequiredResponse()\n\n const body = await req.json().catch(() => ({}))\n const parsed = checkSchema.safeParse(body)\n if (!parsed.success) {\n return NextResponse.json(\n { error: translate('availability.errors.invalidCheckRequest', 'Invalid request') },\n { status: 400 },\n )\n }\n const { productId, variantId, quantity, storeId } = parsed.data\n const tenantId = auth.tenantId\n\n const container = await createRequestContainer()\n const em = container.resolve('em') as EntityManager\n\n // Soft-resolved product/variant existence check \u2014 degrades gracefully when\n // `catalog` is ejected (Phase 1 gate: coherent behaviour without it).\n const CatalogProduct = tryResolve<new () => unknown>(container, 'CatalogProduct')\n if (CatalogProduct) {\n const product = await em.findOne(CatalogProduct as any, { id: productId, organizationId, tenantId, deletedAt: null })\n if (!product) {\n return NextResponse.json(\n { error: translate('availability.errors.productNotFound', 'No such product') },\n { status: 404 },\n )\n }\n if (variantId) {\n const CatalogProductVariant = tryResolve<new () => unknown>(container, 'CatalogProductVariant')\n if (CatalogProductVariant) {\n const variant = await em.findOne(CatalogProductVariant as any, {\n id: variantId,\n organizationId,\n tenantId,\n deletedAt: null,\n })\n if (!variant) {\n return NextResponse.json(\n { error: translate('availability.errors.variantNotFound', 'No such variant') },\n { status: 404 },\n )\n }\n }\n }\n }\n\n const query: AvailabilityQuery = {\n tenantId,\n organizationId,\n storeId: storeId ?? null,\n items: [{ catalogProductId: productId, catalogVariantId: variantId ?? null, quantity }],\n }\n\n const moduleConfig = tryResolve<AvailabilityModuleConfigReader>(container, 'moduleConfigService')\n const result = await resolveAvailability(query, moduleConfig ? { moduleConfig } : undefined)\n const item = result.byItem[availabilityItemKey({ catalogProductId: productId, catalogVariantId: variantId ?? null })] ?? null\n\n const policyResolutionService = tryResolve<PolicyResolutionService>(container, 'policyResolutionService')\n const policyTrace = policyResolutionService\n ? await policyResolutionService.resolve(em, {\n tenantId,\n organizationId,\n storeId: storeId ?? null,\n productId,\n variantId: variantId ?? null,\n })\n : null\n\n return NextResponse.json({ availability: item, policyTrace })\n}\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAElB,SAAS,0BAA0B;AACnC,SAAS,6BAA6B,yCAAyC;AAC/E,SAAS,8BAA8B;AACvC,SAAS,qBAAqB,2BAA2B;AAEzD,SAAS,2BAA2B;AACpC,SAAS,kBAAkB;AAQ3B,MAAM,gBAAgB;AAAA,EACpB,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,oBAAoB,EAAE;AACrE;AAEO,MAAM,WAAW;AAEjB,MAAM,UAAU;AAAA,EACrB,MAAM,CAAC,cAAc;AAAA,EACrB,SAAS;AAAA,EACT,aAAa;AACf;AAEA,MAAM,cAAc,EAAE,OAAO;AAAA,EAC3B,WAAW,EAAE,KAAK;AAAA,EAClB,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;AAAA,EACxC,UAAU,EAAE,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,QAAQ,CAAC;AAAA,EAClD,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,SAAS;AACxC,CAAC;AAED,eAAsB,KAAK,KAAc;AACvC,QAAM,EAAE,UAAU,IAAI,MAAM,oBAAoB;AAChD,QAAM,OAAO,MAAM,mBAAmB,GAAG;AACzC,MAAI,CAAC,QAAQ,CAA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,QAAQ,IAAI;AAAA,UAChB;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAEA,QAAM,QAA2B;AAAA,IAC/B;AAAA,IACA;AAAA,IACA,SAAS,WAAW;AAAA,IACpB,OAAO,CAAC,EAAE,kBAAkB,WAAW,kBAAkB,aAAa,MAAM,SAAS,CAAC;AAAA,EACxF;AAEA,QAAM,eAAe,WAA2C,WAAW,qBAAqB;AAChG,QAAM,SAAS,MAAM,oBAAoB,OAAO,eAAe,EAAE,aAAa,IAAI,MAAS;AAC3F,QAAM,OAAO,OAAO,OAAO,oBAAoB,EAAE,kBAAkB,WAAW,kBAAkB,aAAa,KAAK,CAAC,CAAC,KAAK;AAEzH,QAAM,0BAA0B,WAAoC,WAAW,yBAAyB;AACxG,QAAM,cAAc,0BAChB,MAAM,wBAAwB,QAAQ,IAAI;AAAA,IACxC;AAAA,IACA;AAAA,IACA,SAAS,WAAW;AAAA,IACpB;AAAA,IACA,WAAW,aAAa;AAAA,EAC1B,CAAC,IACD;AAEJ,SAAO,aAAa,KAAK,EAAE,cAAc,MAAM,YAAY,CAAC;AAC9D;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createCrudOpenApiFactory,
|
|
3
|
+
createPagedListResponseSchema as createSharedPagedListResponseSchema,
|
|
4
|
+
defaultCreateResponseSchema as sharedDefaultCreateResponseSchema,
|
|
5
|
+
defaultOkResponseSchema as sharedDefaultOkResponseSchema
|
|
6
|
+
} from "@open-mercato/shared/lib/openapi/crud";
|
|
7
|
+
const defaultCreateResponseSchema = sharedDefaultCreateResponseSchema;
|
|
8
|
+
const defaultOkResponseSchema = sharedDefaultOkResponseSchema;
|
|
9
|
+
function createPagedListResponseSchema(itemSchema) {
|
|
10
|
+
return createSharedPagedListResponseSchema(itemSchema, { paginationMetaOptional: true });
|
|
11
|
+
}
|
|
12
|
+
const buildAvailabilityCrudOpenApi = createCrudOpenApiFactory({
|
|
13
|
+
defaultTag: "Availability",
|
|
14
|
+
defaultCreateResponseSchema,
|
|
15
|
+
defaultOkResponseSchema,
|
|
16
|
+
makeListDescription: ({ pluralLower }) => `Returns a paginated collection of ${pluralLower} scoped to the authenticated organization.`
|
|
17
|
+
});
|
|
18
|
+
function createAvailabilityCrudOpenApi(options) {
|
|
19
|
+
return buildAvailabilityCrudOpenApi(options);
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
createAvailabilityCrudOpenApi,
|
|
23
|
+
createPagedListResponseSchema,
|
|
24
|
+
defaultCreateResponseSchema,
|
|
25
|
+
defaultOkResponseSchema
|
|
26
|
+
};
|
|
27
|
+
//# sourceMappingURL=openapi.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/modules/availability/api/openapi.ts"],
|
|
4
|
+
"sourcesContent": ["import { type ZodTypeAny } from 'zod'\nimport type { OpenApiRouteDoc } from '@open-mercato/shared/lib/openapi'\nimport {\n createCrudOpenApiFactory,\n createPagedListResponseSchema as createSharedPagedListResponseSchema,\n defaultCreateResponseSchema as sharedDefaultCreateResponseSchema,\n defaultOkResponseSchema as sharedDefaultOkResponseSchema,\n type CrudOpenApiOptions,\n} from '@open-mercato/shared/lib/openapi/crud'\n\nexport const defaultCreateResponseSchema = sharedDefaultCreateResponseSchema\nexport const defaultOkResponseSchema = sharedDefaultOkResponseSchema\n\nexport function createPagedListResponseSchema(itemSchema: ZodTypeAny) {\n return createSharedPagedListResponseSchema(itemSchema, { paginationMetaOptional: true })\n}\n\nconst buildAvailabilityCrudOpenApi = createCrudOpenApiFactory({\n defaultTag: 'Availability',\n defaultCreateResponseSchema,\n defaultOkResponseSchema,\n makeListDescription: ({ pluralLower }) =>\n `Returns a paginated collection of ${pluralLower} scoped to the authenticated organization.`,\n})\n\nexport function createAvailabilityCrudOpenApi(options: CrudOpenApiOptions): OpenApiRouteDoc {\n return buildAvailabilityCrudOpenApi(options)\n}\n"],
|
|
5
|
+
"mappings": "AAEA;AAAA,EACE;AAAA,EACA,iCAAiC;AAAA,EACjC,+BAA+B;AAAA,EAC/B,2BAA2B;AAAA,OAEtB;AAEA,MAAM,8BAA8B;AACpC,MAAM,0BAA0B;AAEhC,SAAS,8BAA8B,YAAwB;AACpE,SAAO,oCAAoC,YAAY,EAAE,wBAAwB,KAAK,CAAC;AACzF;AAEA,MAAM,+BAA+B,yBAAyB;AAAA,EAC5D,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA,qBAAqB,CAAC,EAAE,YAAY,MAClC,qCAAqC,WAAW;AACpD,CAAC;AAEM,SAAS,8BAA8B,SAA8C;AAC1F,SAAO,6BAA6B,OAAO;AAC7C;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
|
|
4
|
+
import { resolveActiveOrganizationId, organizationScopeRequiredResponse } from "@open-mercato/shared/lib/auth/organizationScope";
|
|
5
|
+
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
6
|
+
import { resolveTranslations } from "@open-mercato/shared/lib/i18n/server";
|
|
7
|
+
import { createPolicyResolutionService } from "../../../lib/policyResolution.js";
|
|
8
|
+
const routeMetadata = {
|
|
9
|
+
GET: { requireAuth: true, requireFeatures: ["availability.policies.view"] }
|
|
10
|
+
};
|
|
11
|
+
const metadata = routeMetadata;
|
|
12
|
+
const openApi = {
|
|
13
|
+
tags: ["Availability"],
|
|
14
|
+
summary: "Preview the currently persisted policy resolution chain for a product/variant/store target."
|
|
15
|
+
};
|
|
16
|
+
const querySchema = z.object({
|
|
17
|
+
productId: z.uuid(),
|
|
18
|
+
variantId: z.uuid().nullable().optional(),
|
|
19
|
+
storeId: z.uuid().nullable().optional()
|
|
20
|
+
});
|
|
21
|
+
async function GET(req) {
|
|
22
|
+
const { translate } = await resolveTranslations();
|
|
23
|
+
const auth = await getAuthFromRequest(req);
|
|
24
|
+
if (!auth || !auth.tenantId) {
|
|
25
|
+
return NextResponse.json({ error: translate("availability.errors.unauthorized", "Unauthorized") }, { status: 401 });
|
|
26
|
+
}
|
|
27
|
+
const organizationId = resolveActiveOrganizationId(auth);
|
|
28
|
+
if (!organizationId) return organizationScopeRequiredResponse();
|
|
29
|
+
const url = new URL(req.url);
|
|
30
|
+
const parsed = querySchema.safeParse({
|
|
31
|
+
productId: url.searchParams.get("productId") ?? void 0,
|
|
32
|
+
variantId: url.searchParams.get("variantId") ?? void 0,
|
|
33
|
+
storeId: url.searchParams.get("storeId") ?? void 0
|
|
34
|
+
});
|
|
35
|
+
if (!parsed.success) {
|
|
36
|
+
return NextResponse.json(
|
|
37
|
+
{ error: translate("availability.errors.invalidPreviewRequest", "Invalid request") },
|
|
38
|
+
{ status: 400 }
|
|
39
|
+
);
|
|
40
|
+
}
|
|
41
|
+
const container = await createRequestContainer();
|
|
42
|
+
const em = container.resolve("em");
|
|
43
|
+
const service = createPolicyResolutionService(container);
|
|
44
|
+
const trace = await service.resolve(em, {
|
|
45
|
+
tenantId: auth.tenantId,
|
|
46
|
+
organizationId,
|
|
47
|
+
storeId: parsed.data.storeId ?? null,
|
|
48
|
+
productId: parsed.data.productId,
|
|
49
|
+
variantId: parsed.data.variantId ?? null
|
|
50
|
+
});
|
|
51
|
+
return NextResponse.json({ policyTrace: trace });
|
|
52
|
+
}
|
|
53
|
+
export {
|
|
54
|
+
GET,
|
|
55
|
+
metadata,
|
|
56
|
+
openApi
|
|
57
|
+
};
|
|
58
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../../src/modules/availability/api/policies/resolve-preview/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { resolveActiveOrganizationId, organizationScopeRequiredResponse } from '@open-mercato/shared/lib/auth/organizationScope'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { resolveTranslations } from '@open-mercato/shared/lib/i18n/server'\nimport { createPolicyResolutionService } from '../../../lib/policyResolution'\n\n/**\n * `GET /api/availability/policies/resolve-preview` \u2014 the currently PERSISTED\n * resolution chain for a (product, variant, store) target, used by the policy\n * edit/create form to show \"which level currently decides each field\" (US-A2)\n * before the admin saves an override.\n */\nconst routeMetadata = {\n GET: { requireAuth: true, requireFeatures: ['availability.policies.view'] },\n}\n\nexport const metadata = routeMetadata\n\nexport const openApi = {\n tags: ['Availability'],\n summary: 'Preview the currently persisted policy resolution chain for a product/variant/store target.',\n}\n\nconst querySchema = z.object({\n productId: z.uuid(),\n variantId: z.uuid().nullable().optional(),\n storeId: z.uuid().nullable().optional(),\n})\n\nexport async function GET(req: Request) {\n const { translate } = await resolveTranslations()\n const auth = await getAuthFromRequest(req)\n if (!auth || !auth.tenantId) {\n return NextResponse.json({ error: translate('availability.errors.unauthorized', 'Unauthorized') }, { status: 401 })\n }\n const organizationId = resolveActiveOrganizationId(auth)\n if (!organizationId) return organizationScopeRequiredResponse()\n\n const url = new URL(req.url)\n const parsed = querySchema.safeParse({\n productId: url.searchParams.get('productId') ?? undefined,\n variantId: url.searchParams.get('variantId') ?? undefined,\n storeId: url.searchParams.get('storeId') ?? undefined,\n })\n if (!parsed.success) {\n return NextResponse.json(\n { error: translate('availability.errors.invalidPreviewRequest', 'Invalid request') },\n { status: 400 },\n )\n }\n\n const container = await createRequestContainer()\n const em = container.resolve('em') as EntityManager\n const service = createPolicyResolutionService(container)\n const trace = await service.resolve(em, {\n tenantId: auth.tenantId,\n organizationId,\n storeId: parsed.data.storeId ?? null,\n productId: parsed.data.productId,\n variantId: parsed.data.variantId ?? null,\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iBAAiB,EAAE;AAAA,MACnF,EAAE,QAAQ,IAAI;AAAA,IAChB;AAAA,EACF;AAEA,QAAM,YAAY,MAAM,uBAAuB;AAC/C,QAAM,KAAK,UAAU,QAAQ,IAAI;AACjC,QAAM,UAAU,8BAA8B,SAAS;AACvD,QAAM,QAAQ,MAAM,QAAQ,QAAQ,IAAI;AAAA,IACtC,UAAU,KAAK;AAAA,IACf;AAAA,IACA,SAAS,OAAO,KAAK,WAAW;AAAA,IAChC,WAAW,OAAO,KAAK;AAAA,IACvB,WAAW,OAAO,KAAK,aAAa;AAAA,EACtC,CAAC;AAED,SAAO,aAAa,KAAK,EAAE,aAAa,MAAM,CAAC;AACjD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { NextResponse } from "next/server";
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { makeCrudRoute } from "@open-mercato/shared/lib/crud/factory";
|
|
4
|
+
import { AvailabilityPolicy } from "../../data/entities.js";
|
|
5
|
+
import { getAuthFromRequest } from "@open-mercato/shared/lib/auth/server";
|
|
6
|
+
import { resolveActiveOrganizationId, organizationScopeRequiredResponse } from "@open-mercato/shared/lib/auth/organizationScope";
|
|
7
|
+
import { createRequestContainer } from "@open-mercato/shared/lib/di/container";
|
|
8
|
+
import { availabilityPolicyCreateSchema, availabilityPolicyUpdateSchema } from "../../data/validators.js";
|
|
9
|
+
import {
|
|
10
|
+
createAvailabilityCrudOpenApi,
|
|
11
|
+
createPagedListResponseSchema,
|
|
12
|
+
defaultOkResponseSchema
|
|
13
|
+
} from "../openapi.js";
|
|
14
|
+
const routeMetadata = {
|
|
15
|
+
GET: { requireAuth: true, requireFeatures: ["availability.policies.view"] },
|
|
16
|
+
POST: { requireAuth: true, requireFeatures: ["availability.policies.manage"] },
|
|
17
|
+
PUT: { requireAuth: true, requireFeatures: ["availability.policies.manage"] },
|
|
18
|
+
DELETE: { requireAuth: true, requireFeatures: ["availability.policies.manage"] }
|
|
19
|
+
};
|
|
20
|
+
const metadata = routeMetadata;
|
|
21
|
+
const rawBodySchema = z.object({}).loose();
|
|
22
|
+
const crud = makeCrudRoute({
|
|
23
|
+
metadata: routeMetadata,
|
|
24
|
+
orm: {
|
|
25
|
+
entity: AvailabilityPolicy,
|
|
26
|
+
idField: "id",
|
|
27
|
+
orgField: "organizationId",
|
|
28
|
+
tenantField: "tenantId",
|
|
29
|
+
softDeleteField: "deletedAt"
|
|
30
|
+
},
|
|
31
|
+
events: {
|
|
32
|
+
module: "availability",
|
|
33
|
+
entity: "policy",
|
|
34
|
+
persistent: true
|
|
35
|
+
},
|
|
36
|
+
actions: {
|
|
37
|
+
create: {
|
|
38
|
+
commandId: "availability.policies.create",
|
|
39
|
+
schema: rawBodySchema,
|
|
40
|
+
mapInput: ({ parsed }) => parsed,
|
|
41
|
+
response: ({ result }) => ({ id: String(result.policyId) }),
|
|
42
|
+
status: 201
|
|
43
|
+
},
|
|
44
|
+
update: {
|
|
45
|
+
commandId: "availability.policies.update",
|
|
46
|
+
schema: rawBodySchema,
|
|
47
|
+
mapInput: ({ parsed }) => parsed,
|
|
48
|
+
response: () => ({ ok: true })
|
|
49
|
+
},
|
|
50
|
+
delete: {
|
|
51
|
+
commandId: "availability.policies.delete",
|
|
52
|
+
schema: rawBodySchema,
|
|
53
|
+
mapInput: ({ raw, ctx }) => ({
|
|
54
|
+
id: raw.query?.id,
|
|
55
|
+
organizationId: ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? void 0,
|
|
56
|
+
tenantId: ctx.auth?.tenantId ?? void 0
|
|
57
|
+
}),
|
|
58
|
+
response: () => ({ ok: true })
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const listQuerySchema = z.object({
|
|
63
|
+
id: z.uuid().optional(),
|
|
64
|
+
page: z.coerce.number().min(1).default(1),
|
|
65
|
+
pageSize: z.coerce.number().min(1).max(100).default(50),
|
|
66
|
+
storeId: z.uuid().optional(),
|
|
67
|
+
productId: z.uuid().optional(),
|
|
68
|
+
variantId: z.uuid().optional(),
|
|
69
|
+
isActive: z.enum(["true", "false"]).optional(),
|
|
70
|
+
sortField: z.enum(["createdAt", "updatedAt"]).optional(),
|
|
71
|
+
sortDir: z.enum(["asc", "desc"]).optional()
|
|
72
|
+
}).loose();
|
|
73
|
+
const toRow = (policy) => ({
|
|
74
|
+
id: String(policy.id),
|
|
75
|
+
organizationId: String(policy.organizationId),
|
|
76
|
+
tenantId: String(policy.tenantId),
|
|
77
|
+
storeId: policy.storeId ?? null,
|
|
78
|
+
productId: policy.productId ?? null,
|
|
79
|
+
variantId: policy.variantId ?? null,
|
|
80
|
+
isStockManaged: !!policy.isStockManaged,
|
|
81
|
+
allowBackorder: !!policy.allowBackorder,
|
|
82
|
+
backorderLeadTimeDays: policy.backorderLeadTimeDays ?? null,
|
|
83
|
+
preorderReleaseAt: policy.preorderReleaseAt ? policy.preorderReleaseAt.toISOString() : null,
|
|
84
|
+
lowStockThreshold: policy.lowStockThreshold ?? null,
|
|
85
|
+
minOrderQuantity: policy.minOrderQuantity ?? null,
|
|
86
|
+
maxOrderQuantity: policy.maxOrderQuantity ?? null,
|
|
87
|
+
quantityIncrement: policy.quantityIncrement ?? null,
|
|
88
|
+
hideWhenOutOfStock: !!policy.hideWhenOutOfStock,
|
|
89
|
+
isActive: !!policy.isActive,
|
|
90
|
+
createdAt: policy.createdAt ? policy.createdAt.toISOString() : null,
|
|
91
|
+
updatedAt: policy.updatedAt ? policy.updatedAt.toISOString() : null
|
|
92
|
+
});
|
|
93
|
+
async function GET(req) {
|
|
94
|
+
const auth = await getAuthFromRequest(req);
|
|
95
|
+
if (!auth || !auth.tenantId) {
|
|
96
|
+
return NextResponse.json({ items: [], total: 0, page: 1, pageSize: 50, totalPages: 1 }, { status: 401 });
|
|
97
|
+
}
|
|
98
|
+
const organizationId = resolveActiveOrganizationId(auth);
|
|
99
|
+
if (!organizationId && !auth.isSuperAdmin) return organizationScopeRequiredResponse();
|
|
100
|
+
const url = new URL(req.url);
|
|
101
|
+
const parsed = listQuerySchema.safeParse({
|
|
102
|
+
id: url.searchParams.get("id") ?? void 0,
|
|
103
|
+
page: url.searchParams.get("page") ?? void 0,
|
|
104
|
+
pageSize: url.searchParams.get("pageSize") ?? void 0,
|
|
105
|
+
storeId: url.searchParams.get("storeId") ?? void 0,
|
|
106
|
+
productId: url.searchParams.get("productId") ?? void 0,
|
|
107
|
+
variantId: url.searchParams.get("variantId") ?? void 0,
|
|
108
|
+
isActive: url.searchParams.get("isActive") ?? void 0,
|
|
109
|
+
sortField: url.searchParams.get("sortField") ?? void 0,
|
|
110
|
+
sortDir: url.searchParams.get("sortDir") ?? void 0
|
|
111
|
+
});
|
|
112
|
+
if (!parsed.success) {
|
|
113
|
+
return NextResponse.json({ items: [], total: 0, page: 1, pageSize: 50, totalPages: 1 }, { status: 400 });
|
|
114
|
+
}
|
|
115
|
+
const container = await createRequestContainer();
|
|
116
|
+
const em = container.resolve("em");
|
|
117
|
+
const { id, page, pageSize, storeId, productId, variantId, isActive, sortField, sortDir } = parsed.data;
|
|
118
|
+
const filter = {
|
|
119
|
+
tenantId: auth.tenantId,
|
|
120
|
+
deletedAt: null
|
|
121
|
+
};
|
|
122
|
+
if (organizationId) filter.organizationId = organizationId;
|
|
123
|
+
if (id) filter.id = id;
|
|
124
|
+
if (storeId) filter.storeId = storeId;
|
|
125
|
+
if (productId) filter.productId = productId;
|
|
126
|
+
if (variantId) filter.variantId = variantId;
|
|
127
|
+
if (isActive === "true") filter.isActive = true;
|
|
128
|
+
if (isActive === "false") filter.isActive = false;
|
|
129
|
+
const orderBy = {};
|
|
130
|
+
orderBy[sortField ?? "createdAt"] = sortDir === "asc" ? "ASC" : "DESC";
|
|
131
|
+
const offset = (page - 1) * pageSize;
|
|
132
|
+
const [rows, total] = await em.findAndCount(AvailabilityPolicy, filter, { orderBy, limit: pageSize, offset });
|
|
133
|
+
const items = rows.map(toRow);
|
|
134
|
+
const totalPages = Math.max(1, Math.ceil(total / pageSize));
|
|
135
|
+
return NextResponse.json({ items, total, page, pageSize, totalPages });
|
|
136
|
+
}
|
|
137
|
+
const POST = crud.POST;
|
|
138
|
+
const PUT = crud.PUT;
|
|
139
|
+
const DELETE = crud.DELETE;
|
|
140
|
+
const availabilityPolicyListItemSchema = z.object({
|
|
141
|
+
id: z.uuid(),
|
|
142
|
+
organizationId: z.uuid(),
|
|
143
|
+
tenantId: z.uuid(),
|
|
144
|
+
storeId: z.uuid().nullable(),
|
|
145
|
+
productId: z.uuid().nullable(),
|
|
146
|
+
variantId: z.uuid().nullable(),
|
|
147
|
+
isStockManaged: z.boolean(),
|
|
148
|
+
allowBackorder: z.boolean(),
|
|
149
|
+
backorderLeadTimeDays: z.number().nullable(),
|
|
150
|
+
preorderReleaseAt: z.string().nullable(),
|
|
151
|
+
lowStockThreshold: z.number().nullable(),
|
|
152
|
+
minOrderQuantity: z.number().nullable(),
|
|
153
|
+
maxOrderQuantity: z.number().nullable(),
|
|
154
|
+
quantityIncrement: z.number().nullable(),
|
|
155
|
+
hideWhenOutOfStock: z.boolean(),
|
|
156
|
+
isActive: z.boolean(),
|
|
157
|
+
createdAt: z.string().nullable(),
|
|
158
|
+
updatedAt: z.string().nullable()
|
|
159
|
+
});
|
|
160
|
+
const openApi = createAvailabilityCrudOpenApi({
|
|
161
|
+
resourceName: "AvailabilityPolicy",
|
|
162
|
+
pluralName: "AvailabilityPolicies",
|
|
163
|
+
querySchema: listQuerySchema,
|
|
164
|
+
listResponseSchema: createPagedListResponseSchema(availabilityPolicyListItemSchema),
|
|
165
|
+
create: {
|
|
166
|
+
schema: availabilityPolicyCreateSchema,
|
|
167
|
+
description: "Creates a new availability policy."
|
|
168
|
+
},
|
|
169
|
+
update: {
|
|
170
|
+
schema: availabilityPolicyUpdateSchema,
|
|
171
|
+
responseSchema: defaultOkResponseSchema,
|
|
172
|
+
description: "Updates an existing availability policy by id."
|
|
173
|
+
},
|
|
174
|
+
del: {
|
|
175
|
+
schema: z.object({ id: z.string().uuid() }),
|
|
176
|
+
responseSchema: defaultOkResponseSchema,
|
|
177
|
+
description: "Deletes an availability policy by id."
|
|
178
|
+
}
|
|
179
|
+
});
|
|
180
|
+
export {
|
|
181
|
+
DELETE,
|
|
182
|
+
GET,
|
|
183
|
+
POST,
|
|
184
|
+
PUT,
|
|
185
|
+
metadata,
|
|
186
|
+
openApi
|
|
187
|
+
};
|
|
188
|
+
//# sourceMappingURL=route.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../../src/modules/availability/api/policies/route.ts"],
|
|
4
|
+
"sourcesContent": ["import { NextResponse } from 'next/server'\nimport { z } from 'zod'\nimport { makeCrudRoute } from '@open-mercato/shared/lib/crud/factory'\nimport { AvailabilityPolicy } from '../../data/entities'\nimport type { EntityManager } from '@mikro-orm/postgresql'\nimport type { FilterQuery } from '@mikro-orm/core'\nimport { getAuthFromRequest } from '@open-mercato/shared/lib/auth/server'\nimport { resolveActiveOrganizationId, organizationScopeRequiredResponse } from '@open-mercato/shared/lib/auth/organizationScope'\nimport { createRequestContainer } from '@open-mercato/shared/lib/di/container'\nimport { availabilityPolicyCreateSchema, availabilityPolicyUpdateSchema } from '../../data/validators'\nimport {\n createAvailabilityCrudOpenApi,\n createPagedListResponseSchema,\n defaultOkResponseSchema,\n} from '../openapi'\n\nconst routeMetadata = {\n GET: { requireAuth: true, requireFeatures: ['availability.policies.view'] },\n POST: { requireAuth: true, requireFeatures: ['availability.policies.manage'] },\n PUT: { requireAuth: true, requireFeatures: ['availability.policies.manage'] },\n DELETE: { requireAuth: true, requireFeatures: ['availability.policies.manage'] },\n}\n\nexport const metadata = routeMetadata\n\nconst rawBodySchema = z.object({}).loose()\ntype CrudInput = Record<string, unknown>\n\nconst crud = makeCrudRoute<CrudInput, CrudInput, Record<string, unknown>>({\n metadata: routeMetadata,\n orm: {\n entity: AvailabilityPolicy,\n idField: 'id',\n orgField: 'organizationId',\n tenantField: 'tenantId',\n softDeleteField: 'deletedAt',\n },\n events: {\n module: 'availability',\n entity: 'policy',\n persistent: true,\n },\n actions: {\n create: {\n commandId: 'availability.policies.create',\n schema: rawBodySchema,\n mapInput: ({ parsed }) => parsed,\n response: ({ result }) => ({ id: String(result.policyId) }),\n status: 201,\n },\n update: {\n commandId: 'availability.policies.update',\n schema: rawBodySchema,\n mapInput: ({ parsed }) => parsed,\n response: () => ({ ok: true }),\n },\n delete: {\n commandId: 'availability.policies.delete',\n schema: rawBodySchema,\n mapInput: ({ raw, ctx }) => ({\n id: ((raw as Record<string, unknown>).query as Record<string, unknown> | undefined)?.id as string | undefined,\n organizationId: ctx.selectedOrganizationId ?? ctx.auth?.orgId ?? undefined,\n tenantId: ctx.auth?.tenantId ?? undefined,\n }),\n response: () => ({ ok: true }),\n },\n },\n})\n\nconst listQuerySchema = z.object({\n id: z.uuid().optional(),\n page: z.coerce.number().min(1).default(1),\n pageSize: z.coerce.number().min(1).max(100).default(50),\n storeId: z.uuid().optional(),\n productId: z.uuid().optional(),\n variantId: z.uuid().optional(),\n isActive: z.enum(['true', 'false']).optional(),\n sortField: z.enum(['createdAt', 'updatedAt']).optional(),\n sortDir: z.enum(['asc', 'desc']).optional(),\n}).loose()\n\ntype AvailabilityPolicyRow = {\n id: string\n organizationId: string\n tenantId: string\n storeId: string | null\n productId: string | null\n variantId: string | null\n isStockManaged: boolean\n allowBackorder: boolean\n backorderLeadTimeDays: number | null\n preorderReleaseAt: string | null\n lowStockThreshold: number | null\n minOrderQuantity: number | null\n maxOrderQuantity: number | null\n quantityIncrement: number | null\n hideWhenOutOfStock: boolean\n isActive: boolean\n createdAt: string | null\n updatedAt: string | null\n}\n\nconst toRow = (policy: AvailabilityPolicy): AvailabilityPolicyRow => ({\n id: String(policy.id),\n organizationId: String(policy.organizationId),\n tenantId: String(policy.tenantId),\n storeId: policy.storeId ?? null,\n productId: policy.productId ?? null,\n variantId: policy.variantId ?? null,\n isStockManaged: !!policy.isStockManaged,\n allowBackorder: !!policy.allowBackorder,\n backorderLeadTimeDays: policy.backorderLeadTimeDays ?? null,\n preorderReleaseAt: policy.preorderReleaseAt ? policy.preorderReleaseAt.toISOString() : null,\n lowStockThreshold: policy.lowStockThreshold ?? null,\n minOrderQuantity: policy.minOrderQuantity ?? null,\n maxOrderQuantity: policy.maxOrderQuantity ?? null,\n quantityIncrement: policy.quantityIncrement ?? null,\n hideWhenOutOfStock: !!policy.hideWhenOutOfStock,\n isActive: !!policy.isActive,\n createdAt: policy.createdAt ? policy.createdAt.toISOString() : null,\n updatedAt: policy.updatedAt ? policy.updatedAt.toISOString() : null,\n})\n\nexport async function GET(req: Request) {\n const auth = await getAuthFromRequest(req)\n if (!auth || !auth.tenantId) {\n return NextResponse.json({ items: [], total: 0, page: 1, pageSize: 50, totalPages: 1 }, { status: 401 })\n }\n const organizationId = resolveActiveOrganizationId(auth)\n // A superadmin with no organization selected legitimately sees every\n // organization in the tenant (om_selected_org=__all__); anyone else with\n // an unresolved scope gets the standard 400, never a 401 (that reads as an\n // expired session to the client and redirect-loops through session\n // refresh \u2014 see organizationScope.ts).\n if (!organizationId && !auth.isSuperAdmin) return organizationScopeRequiredResponse()\n\n const url = new URL(req.url)\n const parsed = listQuerySchema.safeParse({\n id: url.searchParams.get('id') ?? undefined,\n page: url.searchParams.get('page') ?? undefined,\n pageSize: url.searchParams.get('pageSize') ?? undefined,\n storeId: url.searchParams.get('storeId') ?? undefined,\n productId: url.searchParams.get('productId') ?? undefined,\n variantId: url.searchParams.get('variantId') ?? undefined,\n isActive: url.searchParams.get('isActive') ?? undefined,\n sortField: url.searchParams.get('sortField') ?? undefined,\n sortDir: url.searchParams.get('sortDir') ?? undefined,\n })\n if (!parsed.success) {\n return NextResponse.json({ items: [], total: 0, page: 1, pageSize: 50, totalPages: 1 }, { status: 400 })\n }\n\n const container = await createRequestContainer()\n const em = container.resolve('em') as EntityManager\n\n const { id, page, pageSize, storeId, productId, variantId, isActive, sortField, sortDir } = parsed.data\n const filter: FilterQuery<AvailabilityPolicy> = {\n tenantId: auth.tenantId,\n deletedAt: null,\n }\n if (organizationId) filter.organizationId = organizationId\n if (id) filter.id = id\n if (storeId) filter.storeId = storeId\n if (productId) filter.productId = productId\n if (variantId) filter.variantId = variantId\n if (isActive === 'true') filter.isActive = true\n if (isActive === 'false') filter.isActive = false\n\n const orderBy: Record<string, 'ASC' | 'DESC'> = {}\n orderBy[sortField ?? 'createdAt'] = sortDir === 'asc' ? 'ASC' : 'DESC'\n\n const offset = (page - 1) * pageSize\n const [rows, total] = await em.findAndCount(AvailabilityPolicy, filter, { orderBy, limit: pageSize, offset })\n const items = rows.map(toRow)\n const totalPages = Math.max(1, Math.ceil(total / pageSize))\n\n return NextResponse.json({ items, total, page, pageSize, totalPages })\n}\n\nexport const POST = crud.POST\nexport const PUT = crud.PUT\nexport const DELETE = crud.DELETE\n\nconst availabilityPolicyListItemSchema = z.object({\n id: z.uuid(),\n organizationId: z.uuid(),\n tenantId: z.uuid(),\n storeId: z.uuid().nullable(),\n productId: z.uuid().nullable(),\n variantId: z.uuid().nullable(),\n isStockManaged: z.boolean(),\n allowBackorder: z.boolean(),\n backorderLeadTimeDays: z.number().nullable(),\n preorderReleaseAt: z.string().nullable(),\n lowStockThreshold: z.number().nullable(),\n minOrderQuantity: z.number().nullable(),\n maxOrderQuantity: z.number().nullable(),\n quantityIncrement: z.number().nullable(),\n hideWhenOutOfStock: z.boolean(),\n isActive: z.boolean(),\n createdAt: z.string().nullable(),\n updatedAt: z.string().nullable(),\n})\n\nexport const openApi = createAvailabilityCrudOpenApi({\n resourceName: 'AvailabilityPolicy',\n pluralName: 'AvailabilityPolicies',\n querySchema: listQuerySchema,\n listResponseSchema: createPagedListResponseSchema(availabilityPolicyListItemSchema),\n create: {\n schema: availabilityPolicyCreateSchema,\n description: 'Creates a new availability policy.',\n },\n update: {\n schema: availabilityPolicyUpdateSchema,\n responseSchema: defaultOkResponseSchema,\n description: 'Updates an existing availability policy by id.',\n },\n del: {\n schema: z.object({ id: z.string().uuid() }),\n responseSchema: defaultOkResponseSchema,\n description: 'Deletes an availability policy by id.',\n },\n})\n"],
|
|
5
|
+
"mappings": "AAAA,SAAS,oBAAoB;AAC7B,SAAS,SAAS;AAClB,SAAS,qBAAqB;AAC9B,SAAS,0BAA0B;AAGnC,SAAS,0BAA0B;AACnC,SAAS,6BAA6B,yCAAyC;AAC/E,SAAS,8BAA8B;AACvC,SAAS,gCAAgC,sCAAsC;AAC/E;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,gBAAgB;AAAA,EACpB,KAAK,EAAE,aAAa,MAAM,iBAAiB,CAAC,4BAA4B,EAAE;AAAA,EAC1E,MAAM,EAAE,aAAa,MAAM,iBAAiB,CAAC,8BAA8B,EAAE;AAAA,EAC7E,KAAK,EAAE,aAAa,MAAM,iBAAiB,CAAC,8BAA8B,EAAE;AAAA,EAC5E,QAAQ,EAAE,aAAa,MAAM,iBAAiB,CAAC,8BAA8B,EAAE;AACjF;AAEO,MAAM,WAAW;AAExB,MAAM,gBAAgB,EAAE,OAAO,CAAC,CAAC,EAAE,MAAM;AAGzC,MAAM,OAAO,cAA6D;AAAA,EACxE,UAAU;AAAA,EACV,KAAK;AAAA,IACH,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,UAAU;AAAA,IACV,aAAa;AAAA,IACb,iBAAiB;AAAA,EACnB;AAAA,EACA,QAAQ;AAAA,IACN,QAAQ;AAAA,IACR,QAAQ;AAAA,IACR,YAAY;AAAA,EACd;AAAA,EACA,SAAS;AAAA,IACP,QAAQ;AAAA,MACN,WAAW;AAAA,MACX,QAAQ;AAAA,MACR,UAAU,CAAC,EAAE,OAAO,MAAM;AAAA,MAC1B,UAAU,CAAC,EAAE,OAAO,OAAO,EAAE,IAAI,OAAO,OAAO,QAAQ,EAAE;AAAA,MACzD,QAAQ;AAAA,IACV;AAAA,IACA,QAAQ;AAAA,MACN,WAAW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