spine-framework 0.3.144 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +76 -0
- package/.framework/.spine-manifest.json +19 -0
- package/.framework/cli/commands/agents.ts +61 -33
- package/.framework/cli/commands/auth.ts +60 -28
- package/.framework/cli/commands/create-app.ts +212 -80
- package/.framework/cli/commands/dev.ts +184 -68
- package/.framework/cli/commands/doctor.ts +324 -152
- package/.framework/cli/commands/generate.ts +119 -68
- package/.framework/cli/commands/init.ts +141 -242
- package/.framework/cli/commands/install-app.ts +1336 -314
- package/.framework/cli/commands/items.ts +31 -29
- package/.framework/cli/commands/migrate.ts +299 -156
- package/.framework/cli/commands/migrations.ts +62 -30
- package/.framework/cli/commands/pipelines.ts +31 -29
- package/.framework/cli/commands/status.ts +105 -45
- package/.framework/cli/commands/system.ts +47 -42
- package/.framework/cli/commands/test.ts +161 -102
- package/.framework/cli/commands/upgrade.ts +260 -0
- package/.framework/cli/commands/validate-app.ts +517 -161
- package/.framework/cli/context.ts +117 -85
- package/.framework/cli/env-loader.ts +74 -43
- package/.framework/cli/index.ts +70 -46
- package/.framework/cli/lib/project-files.ts +404 -0
- package/.framework/docs/guides/testing-guide.md +1 -1
- package/.framework/docs/runtime-types.md +72 -72
- package/.framework/functions/_shared/access.ts +84 -0
- package/.framework/functions/_shared/agent-runner.ts +5051 -1026
- package/.framework/functions/_shared/app-manifest.ts +214 -94
- package/.framework/functions/_shared/ast.ts +214 -0
- package/.framework/functions/_shared/audit.ts +91 -55
- package/.framework/functions/_shared/cil.ts +368 -127
- package/.framework/functions/_shared/db.ts +337 -68
- package/.framework/functions/_shared/funnel.ts +228 -0
- package/.framework/functions/_shared/geo.ts +105 -0
- package/.framework/functions/_shared/hash-api-key.ts +94 -17
- package/.framework/functions/_shared/index.ts +22 -224
- package/.framework/functions/_shared/kb.ts +832 -58
- package/.framework/functions/_shared/llm.ts +118 -18
- package/.framework/functions/_shared/logging.ts +317 -19
- package/.framework/functions/_shared/middleware.ts +701 -131
- package/.framework/functions/_shared/notify.ts +70 -0
- package/.framework/functions/_shared/outcomes.ts +34 -19
- package/.framework/functions/_shared/permissions.ts +501 -315
- package/.framework/functions/_shared/pipeline-runner.ts +704 -155
- package/.framework/functions/_shared/principal.ts +436 -263
- package/.framework/functions/_shared/rate-limit.ts +233 -0
- package/.framework/functions/_shared/resolve-credentials.ts +86 -19
- package/.framework/functions/_shared/resolve-ids.ts +203 -139
- package/.framework/functions/_shared/retry-deliveries.ts +51 -16
- package/.framework/functions/_shared/schema-utils.ts +602 -521
- package/.framework/functions/_shared/security.ts +345 -0
- package/.framework/functions/_shared/testing.ts +197 -172
- package/.framework/functions/_shared/tracing.ts +351 -21
- package/.framework/functions/_shared/trigger-engine.ts +425 -136
- package/.framework/functions/_shared/webhook-registration.ts +71 -70
- package/.framework/functions/_shared/webhook-registry.ts +126 -83
- package/.framework/functions/account-nodes.ts +30 -30
- package/.framework/functions/adapters/generic-webhook-inbound.ts +49 -16
- package/.framework/functions/adapters/generic-webhook-outbound.ts +17 -17
- package/.framework/functions/adapters/openai-outbound.ts +15 -16
- package/.framework/functions/admin-data.ts +596 -173
- package/.framework/functions/admin-funnel.ts +64 -60
- package/.framework/functions/admin-install-funnel.ts +84 -66
- package/.framework/functions/admin-signals.ts +69 -51
- package/.framework/functions/ai-agents.ts +431 -106
- package/.framework/functions/ai-interactions.ts +186 -112
- package/.framework/functions/api-keys.ts +107 -107
- package/.framework/functions/apps.ts +154 -136
- package/.framework/functions/auth.ts +83 -65
- package/.framework/functions/cil-agent-ingest.ts +189 -232
- package/.framework/functions/cil-agent.ts +433 -177
- package/.framework/functions/cil-callmap.ts +642 -430
- package/.framework/functions/cil-config.ts +139 -135
- package/.framework/functions/cil-context.ts +214 -127
- package/.framework/functions/cil-doc.ts +587 -458
- package/.framework/functions/cil-embeddings.ts +453 -364
- package/.framework/functions/cil-graph.ts +427 -142
- package/.framework/functions/cil-ingest.ts +1418 -1154
- package/.framework/functions/cil-pipeline.ts +276 -21
- package/.framework/functions/cil-project.ts +659 -132
- package/.framework/functions/cil-validate.ts +198 -164
- package/.framework/functions/debug-auth.ts +57 -55
- package/.framework/functions/deliveries.ts +80 -21
- package/.framework/functions/embeddings.ts +1023 -318
- package/.framework/functions/eval-harness.ts +146 -108
- package/.framework/functions/integration-outbound.ts +205 -75
- package/.framework/functions/integration-routes.ts +128 -23
- package/.framework/functions/integrations.ts +125 -100
- package/.framework/functions/invites.ts +1095 -460
- package/.framework/functions/item-progress.ts +158 -102
- package/.framework/functions/kb.ts +34 -10
- package/.framework/functions/logs.ts +133 -133
- package/.framework/functions/observability.ts +152 -122
- package/.framework/functions/pipeline-executions.ts +147 -132
- package/.framework/functions/pipelines.ts +134 -119
- package/.framework/functions/prompt-configs.ts +96 -80
- package/.framework/functions/roles.ts +112 -82
- package/.framework/functions/security.ts +450 -0
- package/.framework/functions/system-cron.ts +117 -80
- package/.framework/functions/system.ts +158 -98
- package/.framework/functions/tests.ts +29 -29
- package/.framework/functions/timers.ts +94 -95
- package/.framework/functions/trigger-scheduler.ts +10 -0
- package/.framework/functions/triggers.ts +179 -149
- package/.framework/functions/types.ts +137 -125
- package/.framework/mcp/index.ts +133 -0
- package/.framework/mcp/load-env.ts +60 -0
- package/.framework/mcp/shared/app-manifest.ts +275 -0
- package/.framework/mcp/shared/db.ts +477 -0
- package/.framework/mcp/shared/kb.ts +118 -0
- package/.framework/mcp/tools/architect.ts +431 -0
- package/.framework/mcp/tools/cil/context.ts +345 -0
- package/.framework/mcp/tools/cil/graph.ts +242 -0
- package/.framework/mcp/tools/cil/ingest.ts +1217 -0
- package/.framework/mcp/tools/cil/pipeline-orchestrator.ts +693 -0
- package/.framework/mcp/tools/cil/pipeline.ts +767 -0
- package/.framework/mcp/tools/cil/project.ts +791 -0
- package/.framework/mcp/tools/cil/retrieval.ts +336 -0
- package/.framework/mcp/tools/cil/search-core.ts +454 -0
- package/.framework/mcp/tools/cil/search.ts +97 -0
- package/.framework/mcp/tools/cil/suggest.ts +186 -0
- package/.framework/mcp/tools/cil/validate.ts +1369 -0
- package/.framework/mcp/tools/kb/delete.ts +139 -0
- package/.framework/mcp/tools/kb/index.ts +52 -0
- package/.framework/mcp/tools/kb/ingest.ts +84 -0
- package/.framework/mcp/tools/kb/list-types.ts +102 -0
- package/.framework/mcp/tools/kb/publish.ts +100 -0
- package/.framework/mcp/tools/kb/reindex.ts +86 -0
- package/.framework/mcp/tools/kb/revoke.ts +85 -0
- package/.framework/mcp/tools/kb/search.ts +101 -0
- package/.framework/mcp/tools/kb/upsert.ts +125 -0
- package/.framework/mcp/tools/observability.ts +510 -0
- package/.framework/migrations/001_core_schema.sql +15 -0
- package/.framework/migrations/002_core_rls_and_functions.sql +15 -0
- package/.framework/migrations/003_core_system_data.sql +16 -1
- package/.framework/migrations/004_core_rpc_and_broker.sql +17 -1
- package/.framework/migrations/005_core_observability.sql +17 -1
- package/.framework/migrations/006_security_hardening_rls.sql +15 -0
- package/.framework/migrations/007_kb_article_list.sql +17 -1
- package/.framework/migrations/008_items_target.sql +15 -0
- package/.framework/migrations/009_roles_slug_unique.sql +15 -0
- package/.framework/migrations/010_auth_user_trigger.sql +15 -0
- package/.framework/migrations/011_spine_system_account.sql +16 -0
- package/.framework/migrations/012_service_role_grants.sql +16 -0
- package/.framework/migrations/013_get_account_apps_role_filter.sql +15 -0
- package/.framework/migrations/014_apps_required_roles.sql +16 -0
- package/.framework/migrations/015_types_kind_slug_unique.sql +20 -0
- package/.framework/migrations/016_cil_types.sql +281 -0
- package/.framework/migrations/017_cil_stable_ids.sql +37 -0
- package/.framework/migrations/018_runtime_tables.sql +129 -0
- package/.framework/migrations/019_agent_prompt_columns.sql +56 -0
- package/.framework/migrations/020_schema_reconciliation.sql +67 -0
- package/.framework/migrations/021_kb_embedding_lifecycle.sql +31 -0
- package/.framework/migrations/032_cil_status_migration.sql +73 -0
- package/.framework/migrations/033_cil_versioning.sql +73 -0
- package/.framework/migrations/034_match_embeddings_knn.sql +115 -0
- package/.framework/migrations/035_rate_limits.sql +55 -0
- package/.framework/migrations/036_demo_record_flags.sql +72 -0
- package/.framework/migrations/037_kb_types_canonical.sql +244 -0
- package/.framework/migrations/038_drop_demo_record_flags.sql +38 -0
- package/.framework/migrations/042_registration_hierarchy.sql +309 -0
- package/.framework/migrations/043_policy_actor_cleanup.sql +39 -0
- package/.framework/migrations/044_match_embeddings_filtered_knn.sql +151 -0
- package/.framework/migrations/045_security_critical_rls.sql +139 -0
- package/.framework/migrations/046_security_missing_rls.sql +79 -0
- package/.framework/migrations/047_people_updated_by.sql +27 -0
- package/.framework/migrations/048_watcher_last_seen_at.sql +24 -0
- package/.framework/migrations/049_security_blocklist.sql +148 -0
- package/.framework/migrations/050_notifications.sql +49 -0
- package/.framework/migrations/051_message_agent_fields.sql +74 -0
- package/.framework/migrations/052_registration_security.sql +421 -0
- package/.framework/migrations/053_builtin_action_seeds.sql +66 -0
- package/.framework/migrations/054_kb_ingest_lease.sql +157 -0
- package/.framework/migrations/055_type_id_drift_reconciliation.sql +33 -0
- package/.framework/migrations/056_slug_column_reconciliation.sql +38 -0
- package/.framework/migrations/057_pipelines_slug_identity.sql +14 -0
- package/.framework/migrations/058_account_data_field_declarations.sql +53 -0
- package/.framework/migrations/059_registration_placement_fixes.sql +269 -0
- package/.framework/migrations/060_account_person_record_permissions.sql +38 -0
- package/.framework/migrations/061_fk_dedup.sql +32 -0
- package/.framework/public/spine-logo.svg +10 -3
- package/.framework/scripts/app-install-cli.ts +190 -93
- package/.framework/scripts/assemble-frontend.sh +127 -44
- package/.framework/scripts/assemble-functions.sh +128 -30
- package/.framework/scripts/boundary-check.sh +6 -2
- package/.framework/scripts/build-manifest.sh +24 -68
- package/.framework/scripts/check-core-integrity.sh +15 -76
- package/.framework/scripts/checksum-manifest.mts +343 -0
- package/.framework/scripts/cil-migrate-markers.ts +403 -0
- package/.framework/scripts/fix-cil-markers.mjs +176 -0
- package/.framework/scripts/verify-integrity.sh +21 -57
- package/.framework/scripts/verify-manifest.mts +305 -0
- package/.framework/seeds/types/funnel_signal_use.json +74 -21
- package/.framework/seeds/types/spine_instance.json +73 -21
- package/.framework/src/App.tsx +118 -72
- package/.framework/src/apps/admin/index.tsx +855 -58
- package/.framework/src/components/AppWrapper.tsx +43 -45
- package/.framework/src/components/CustomAppLoader.tsx +160 -116
- package/.framework/src/components/admin/AdminListPage.tsx +46 -44
- package/.framework/src/components/admin/AdminSidebar.tsx +57 -47
- package/.framework/src/components/admin/AdminStatsCard.tsx +46 -44
- package/.framework/src/components/admin/PageInstructions.tsx +98 -2
- package/.framework/src/components/admin/SortableTableHeader.tsx +44 -45
- package/.framework/src/components/app-shell/GenericAppShell.tsx +64 -65
- package/.framework/src/components/app-shell/GenericDetailPage.tsx +44 -47
- package/.framework/src/components/app-shell/GenericListPage.tsx +45 -49
- package/.framework/src/components/app-sidebar.tsx +42 -45
- package/.framework/src/components/auth/ProtectedRoute.tsx +48 -41
- package/.framework/src/components/auth/TurnstileWidget.tsx +27 -0
- package/.framework/src/components/kb/KBArticleEditor.tsx +231 -22
- package/.framework/src/components/kb/KBArticleList.tsx +251 -10
- package/.framework/src/components/layout/AppShell.tsx +51 -45
- package/.framework/src/components/layout/Header.tsx +42 -43
- package/.framework/src/components/layout/Layout.tsx +46 -46
- package/.framework/src/components/layout/Sidebar.tsx +196 -96
- package/.framework/src/components/runtime/DataDetailHeader.tsx +55 -30
- package/.framework/src/components/runtime/DataDetailPage.tsx +31 -269
- package/.framework/src/components/runtime/DataFilters.tsx +49 -74
- package/.framework/src/components/runtime/DataHeader.tsx +53 -32
- package/.framework/src/components/runtime/DataListPage.tsx +51 -155
- package/.framework/src/components/runtime/DataStats.tsx +66 -44
- package/.framework/src/components/runtime/DataTable.tsx +49 -149
- package/.framework/src/components/runtime/SchemaDetailForm.tsx +45 -75
- package/.framework/src/components/runtime/index.ts +119 -16
- package/.framework/src/components/search-form.tsx +46 -29
- package/.framework/src/components/shared/AgentView.tsx +65 -48
- package/.framework/src/components/shared/FieldRenderer.tsx +144 -50
- package/.framework/src/components/shared/InviteManager.tsx +207 -97
- package/.framework/src/components/shared/MemberList.tsx +97 -0
- package/.framework/src/components/shared/SchemaFields.tsx +107 -86
- package/.framework/src/components/ui/DataTable.tsx +80 -68
- package/.framework/src/components/ui/Form.tsx +157 -146
- package/.framework/src/components/ui/ItemCard.tsx +74 -67
- package/.framework/src/components/ui/ItemListView.tsx +73 -68
- package/.framework/src/components/ui/LoadingSpinner.tsx +43 -48
- package/.framework/src/components/ui/Modal.tsx +78 -68
- package/.framework/src/components/ui/RichTextEditor.tsx +89 -69
- package/.framework/src/components/ui/accordion.tsx +85 -86
- package/.framework/src/components/ui/alert-dialog.tsx +197 -184
- package/.framework/src/components/ui/alert.tsx +105 -94
- package/.framework/src/components/ui/aspect-ratio.tsx +57 -43
- package/.framework/src/components/ui/avatar.tsx +122 -107
- package/.framework/src/components/ui/badge.tsx +60 -55
- package/.framework/src/components/ui/breadcrumb.tsx +127 -128
- package/.framework/src/components/ui/button-group.tsx +86 -72
- package/.framework/src/components/ui/button.tsx +71 -50
- package/.framework/src/components/ui/calendar.tsx +72 -57
- package/.framework/src/components/ui/card.tsx +136 -129
- package/.framework/src/components/ui/carousel.tsx +226 -107
- package/.framework/src/components/ui/chart.tsx +252 -147
- package/.framework/src/components/ui/checkbox.tsx +43 -44
- package/.framework/src/components/ui/collapsible.tsx +86 -71
- package/.framework/src/components/ui/combobox.tsx +282 -249
- package/.framework/src/components/ui/command.tsx +158 -146
- package/.framework/src/components/ui/context-menu.tsx +239 -240
- package/.framework/src/components/ui/dialog.tsx +174 -157
- package/.framework/src/components/ui/direction.tsx +72 -56
- package/.framework/src/components/ui/drawer.tsx +168 -169
- package/.framework/src/components/ui/dropdown-menu.tsx +254 -223
- package/.framework/src/components/ui/empty.tsx +131 -120
- package/.framework/src/components/ui/field.tsx +205 -173
- package/.framework/src/components/ui/hover-card.tsx +71 -72
- package/.framework/src/components/ui/input-group.tsx +148 -133
- package/.framework/src/components/ui/input-otp.tsx +99 -86
- package/.framework/src/components/ui/input.tsx +43 -41
- package/.framework/src/components/ui/item.tsx +207 -185
- package/.framework/src/components/ui/kbd.tsx +57 -56
- package/.framework/src/components/ui/label.tsx +45 -41
- package/.framework/src/components/ui/menubar.tsx +268 -236
- package/.framework/src/components/ui/native-select.tsx +85 -86
- package/.framework/src/components/ui/navigation-menu.tsx +166 -156
- package/.framework/src/components/ui/pagination.tsx +131 -141
- package/.framework/src/components/ui/popover.tsx +125 -128
- package/.framework/src/components/ui/progress.tsx +47 -44
- package/.framework/src/components/ui/radio-group.tsx +60 -55
- package/.framework/src/components/ui/resizable.tsx +85 -72
- package/.framework/src/components/ui/scroll-area.tsx +57 -58
- package/.framework/src/components/ui/select.tsx +182 -169
- package/.framework/src/components/ui/separator.tsx +42 -43
- package/.framework/src/components/ui/sheet.tsx +170 -159
- package/.framework/src/components/ui/sidebar.tsx +395 -398
- package/.framework/src/components/ui/skeleton.tsx +42 -43
- package/.framework/src/components/ui/slider.tsx +61 -44
- package/.framework/src/components/ui/sonner.tsx +44 -44
- package/.framework/src/components/ui/spinner.tsx +47 -42
- package/.framework/src/components/ui/switch.tsx +56 -42
- package/.framework/src/components/ui/table-primitives.tsx +272 -132
- package/.framework/src/components/ui/table.tsx +140 -142
- package/.framework/src/components/ui/tabs.tsx +110 -93
- package/.framework/src/components/ui/textarea.tsx +43 -44
- package/.framework/src/components/ui/toggle-group.tsx +87 -71
- package/.framework/src/components/ui/toggle.tsx +56 -56
- package/.framework/src/components/ui/tooltip.tsx +99 -85
- package/.framework/src/contexts/AppContext.tsx +166 -114
- package/.framework/src/contexts/AuthContext.tsx +232 -137
- package/.framework/src/hooks/use-mobile.ts +43 -44
- package/.framework/src/hooks/useApi.ts +185 -172
- package/.framework/src/hooks/useAppPath.ts +31 -29
- package/.framework/src/hooks/useApps.ts +77 -42
- package/.framework/src/hooks/useEntityList.ts +66 -29
- package/.framework/src/hooks/useEntityRecord.ts +76 -32
- package/.framework/src/hooks/useForm.ts +62 -30
- package/.framework/src/hooks/useListSchema.ts +60 -43
- package/.framework/src/hooks/useSchemaRecord.ts +115 -95
- package/.framework/src/lib/api.ts +258 -134
- package/.framework/src/lib/registration.ts +181 -0
- package/.framework/src/lib/supabase.ts +118 -81
- package/.framework/src/lib/utils.ts +266 -266
- package/.framework/src/main.tsx +43 -44
- package/.framework/src/pages/DashboardPage.tsx +44 -43
- package/.framework/src/pages/NoAppPage.tsx +50 -0
- package/.framework/src/pages/NotFoundPage.tsx +32 -29
- package/.framework/src/pages/SetupPage.tsx +34 -33
- package/.framework/src/pages/admin/AIAgentDetailPage.tsx +69 -58
- package/.framework/src/pages/admin/AIAgentsPage.tsx +43 -40
- package/.framework/src/pages/admin/APIKeyDetailPage.tsx +63 -55
- package/.framework/src/pages/admin/APIKeysPage.tsx +44 -42
- package/.framework/src/pages/admin/AlertsConfigPage.tsx +117 -94
- package/.framework/src/pages/admin/AppDetailPage.tsx +48 -42
- package/.framework/src/pages/admin/AppsPage.tsx +45 -42
- package/.framework/src/pages/admin/DeliveriesPage.tsx +49 -17
- package/.framework/src/pages/admin/DesignedPage.tsx +31 -30
- package/.framework/src/pages/admin/EmbeddingDetailPage.tsx +58 -0
- package/.framework/src/pages/admin/EmbeddingsPage.tsx +49 -0
- package/.framework/src/pages/admin/ExtendedShadcnTestPage.tsx +31 -29
- package/.framework/src/pages/admin/IncrementalShadcnTestPage.tsx +46 -29
- package/.framework/src/pages/admin/IntegratedDashboard.tsx +32 -29
- package/.framework/src/pages/admin/IntegrationDetailPage.tsx +68 -55
- package/.framework/src/pages/admin/IntegrationsPage.tsx +45 -42
- package/.framework/src/pages/admin/InvitesPage.tsx +60 -44
- package/.framework/src/pages/admin/LogsPage.tsx +87 -137
- package/.framework/src/pages/admin/MinimalShadcnTestPage.tsx +31 -29
- package/.framework/src/pages/admin/ObservabilityDashboard.tsx +150 -89
- package/.framework/src/pages/admin/PipelineDetailPage.tsx +77 -104
- package/.framework/src/pages/admin/PipelineExecutionsPage.tsx +44 -43
- package/.framework/src/pages/admin/PipelinesPage.tsx +59 -145
- package/.framework/src/pages/admin/PromptConfigDetailPage.tsx +53 -42
- package/.framework/src/pages/admin/PromptConfigsPage.tsx +47 -117
- package/.framework/src/pages/admin/ProperlyDesignedPage.tsx +31 -44
- package/.framework/src/pages/admin/RoleDetailPage.tsx +49 -92
- package/.framework/src/pages/admin/RolesPage.tsx +47 -164
- package/.framework/src/pages/admin/SecurityPage.tsx +310 -0
- package/.framework/src/pages/admin/SelectTestPage.tsx +30 -32
- package/.framework/src/pages/admin/ShadcnTestPage.tsx +37 -44
- package/.framework/src/pages/admin/SimpleDashboard.tsx +32 -44
- package/.framework/src/pages/admin/TestRunDetailPage.tsx +97 -44
- package/.framework/src/pages/admin/TestingDashboard.tsx +126 -71
- package/.framework/src/pages/admin/TimerDetailPage.tsx +67 -55
- package/.framework/src/pages/admin/TimersPage.tsx +44 -42
- package/.framework/src/pages/admin/TriggerDetailPage.tsx +47 -42
- package/.framework/src/pages/admin/TriggersPage.tsx +58 -57
- package/.framework/src/pages/admin/TypeDetailPage.tsx +91 -55
- package/.framework/src/pages/admin/TypesPage.tsx +45 -42
- package/.framework/src/pages/admin/cil/CILAgentPage.tsx +258 -128
- package/.framework/src/pages/admin/cil/CILChunkDetailPage.tsx +127 -123
- package/.framework/src/pages/admin/cil/CILDashboardPage.tsx +308 -235
- package/.framework/src/pages/admin/cil/CILFileListPage.tsx +159 -110
- package/.framework/src/pages/admin/cil/CILFileSelectPage.tsx +432 -0
- package/.framework/src/pages/admin/cil/CILGraphPage.tsx +200 -178
- package/.framework/src/pages/admin/cil/CILIngestionPage.tsx +286 -239
- package/.framework/src/pages/admin/cil/CILProjectsPage.tsx +211 -90
- package/.framework/src/pages/admin/cil/CILSearchPage.tsx +156 -143
- package/.framework/src/pages/admin/cil/CILSuggestionsPage.tsx +379 -0
- package/.framework/src/pages/admin/cil/CILVersionsPage.tsx +337 -0
- package/.framework/src/pages/admin/cil/FlexiblePipelinePage.tsx +219 -214
- package/.framework/src/pages/admin/kb/KBAdminPage.tsx +64 -0
- package/.framework/src/pages/auth/AuthConfirmPage.tsx +135 -65
- package/.framework/src/pages/auth/ForgotPasswordPage.tsx +39 -31
- package/.framework/src/pages/auth/LoginPage.tsx +38 -32
- package/.framework/src/pages/auth/PendingApprovalPage.tsx +31 -28
- package/.framework/src/pages/auth/RegisterPage.tsx +429 -155
- package/.framework/src/pages/spine-framework/APIPage.tsx +33 -30
- package/.framework/src/pages/spine-framework/CLIPage.tsx +32 -30
- package/.framework/src/types/auth.ts +101 -93
- package/.framework/src/types/types.ts +283 -262
- package/.framework/templates/project.json +87 -0
- package/.framework/templates/spine.config.neutral.json +7 -0
- package/.framework/tests/api/api-surface.test.ts +381 -0
- package/.framework/tests/fixtures/seed.ts +427 -0
- package/.framework/tests/fixtures/teardown.ts +228 -0
- package/.framework/tests/reporter.ts +351 -0
- package/.framework/tests/setup.ts +135 -0
- package/.framework/tests/ui/ui-sweep.ts +278 -0
- package/.framework/tests/unit/admin-data-logger.test.ts +310 -0
- package/.framework/tests/unit/agent-runner.test.ts +2389 -0
- package/.framework/tests/unit/ai-interactions.test.ts +81 -0
- package/.framework/tests/unit/app-manifest.test.ts +359 -0
- package/.framework/tests/unit/assembly-scripts.test.ts +172 -0
- package/.framework/tests/unit/cil-determinism.test.ts +85 -0
- package/.framework/tests/unit/core-isolation.test.ts +153 -0
- package/.framework/tests/unit/funnel-signals.test.ts +135 -0
- package/.framework/tests/unit/install-app.test.ts +1759 -0
- package/.framework/tests/unit/invites-security.test.ts +572 -0
- package/.framework/tests/unit/kb-ingest-lease.test.ts +287 -0
- package/.framework/tests/unit/kb-search.test.ts +119 -0
- package/.framework/tests/unit/migrate.test.ts +509 -0
- package/.framework/tests/unit/notify.test.ts +136 -0
- package/.framework/tests/unit/permissions.test.ts +269 -0
- package/.framework/tests/unit/pipeline-runner.test.ts +755 -0
- package/.framework/tests/unit/principal-cache.test.ts +138 -0
- package/.framework/tests/unit/retrieval-golden.test.ts +520 -0
- package/.framework/tests/unit/runtime-isolation.test.ts +642 -0
- package/.framework/tests/unit/schema-utils.test.ts +225 -0
- package/.framework/tests/unit/trigger-engine.test.ts +513 -0
- package/.framework/tests/unit/validate-app.test.ts +527 -0
- package/README.md +34 -3
- package/bin/spine-framework.cjs +1 -0
- package/config/tailwind.config.cjs +7 -0
- package/config/tsconfig.functions.json +42 -0
- package/config/tsconfig.json +37 -9
- package/config/vite.config.ts +31 -2
- package/netlify.toml +31 -3
- package/package.json +46 -29
- package/scripts/assemble-frontend.sh +127 -44
- package/scripts/assemble-functions.sh +127 -29
- package/scripts/boundary-check.sh +6 -2
- package/scripts/build-manifest.sh +24 -68
- package/scripts/checksum-manifest.mts +345 -0
- package/scripts/dev-clean.sh +86 -0
- package/scripts/dev-netlify.sh +49 -0
- package/scripts/netlify-dev-wrapper.sh +2 -0
- package/scripts/verify-install.ts +358 -0
- package/scripts/verify-integrity.sh +21 -57
- package/scripts/verify-manifest.mts +305 -0
- package/templates/project/gitignore +45 -0
- package/{config → templates/project}/package-lock.json +22335 -9366
- package/vitest.config.ts +46 -0
- package/.framework/public/spine.config.json +0 -91
- package/config/deno.lock +0 -108
- package/config/tsconfig.node.tsbuildinfo +0 -1
- package/config/tsconfig.tsbuildinfo +0 -1
- package/config/vite.config.d.ts +0 -2
- package/custom/.devin/AGENT.md +0 -357
- package/custom/.devin/skills/install-app/SKILL.md +0 -39
- package/custom/.devin/skills/spine-workbench-discovery/SKILL.md +0 -39
- package/custom/.devin/skills/spine-workbench-idea/SKILL.md +0 -36
- package/custom/.devin/skills/spine-workbench-implement/SKILL.md +0 -46
- package/custom/.devin/skills/spine-workbench-initiative/SKILL.md +0 -28
- package/custom/.devin/skills/spine-workbench-plan/SKILL.md +0 -38
- package/custom/.devin/workflows/app-install.yaml +0 -83
- package/custom/README.md +0 -79
- package/docs/README.md +0 -15
- package/scripts/app-install-cli.ts +0 -286
- package/scripts/check-core-integrity.sh +0 -82
- package/scripts/ingest-chunks.cjs +0 -202
- package/scripts/kb-chunk-parser.cjs +0 -312
- package/scripts/kb-chunk-parser.ts +0 -330
- package/scripts/kb-ingest-docs.ts +0 -203
- package/scripts/load-test-app-install.ts +0 -484
- package/scripts/test-login.js +0 -33
- package/spine.config.json +0 -91
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:module_header:module_header" type="module_header" identity="module_header" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
2
|
+
// CIL[DOC-MACRO purpose="schema-utils shared module header and imports"]
|
|
3
|
+
// CIL[DOC-RESPONSIBILITY responsibility="declare module scope and dependency on the FieldDefinition type"]
|
|
4
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/src/types/types.ts"]
|
|
5
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="none" errors="none" side_effects="none"]
|
|
6
|
+
// CIL[DOC-MICRO logic_summary="imports FieldDefinition from the shared types module and serves as the file header" notable_decisions="[]"]
|
|
7
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
8
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
9
|
+
// CIL[DOC-AUDIENCE audience="developers"]
|
|
10
|
+
|
|
11
|
+
|
|
1
12
|
|
|
2
13
|
|
|
3
14
|
|
|
@@ -35,37 +46,24 @@
|
|
|
35
46
|
|
|
36
47
|
|
|
37
48
|
|
|
38
|
-
// CIL[BEGIN chunk_id="schemautils_imports_1784020784" type="module_header" identity="imports" parent="none"]
|
|
39
|
-
// CIL[DOC-MACRO purpose="Import field definition type for schema utilities"]
|
|
40
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Import FieldDefinition interface from types"]
|
|
41
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[\".framework/src/pages/admin/TypeDetailPage.tsx\",\"custom/apps/cortex/pages/operations/OperationsDashboard.tsx\",\".framework/migrations/025_retype_threads_messages.sql\",\"\\\"]"]
|
|
42
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="FieldDefinition type" errors="none" side_effects="none"]
|
|
43
|
-
// CIL[DOC-MICRO logic_summary="Import type definition for field structure" notable_decisions="[]"]
|
|
44
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
45
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
46
|
-
// CIL[DOC-AUDIENCE audience="developer"]
|
|
47
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: .framework/src/pages/admin/TypeDetailPage.tsx, custom/apps/cortex/pages/operations/OperationsDashboard.tsx, .framework/migrations/025_retype_threads_messages.sql, \."]
|
|
48
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
49
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
50
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
51
|
-
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
52
|
-
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
53
49
|
import { FieldDefinition } from '../../src/types/types'
|
|
54
|
-
// CIL[
|
|
55
|
-
// CIL[
|
|
56
|
-
// CIL[DOC-
|
|
57
|
-
// CIL[DOC-
|
|
58
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[\".framework/src/components/layout/Sidebar.tsx\",\".framework/src/pages/admin/TypeDetailPage.tsx\",\".framework/functions/_shared/principal.ts\",\"\\\"]"]
|
|
59
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="ValidationSchema interface" errors="none" side_effects="none"]
|
|
60
|
-
// CIL[DOC-MICRO logic_summary="Interface with fields containing data_type and validation rules" notable_decisions="[]"]
|
|
61
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
62
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
63
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: .framework/src/components/layout/Sidebar.tsx, .framework/src/pages/admin/TypeDetailPage.tsx, .framework/functions/_shared/principal.ts, \."]
|
|
64
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
65
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
66
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
50
|
+
// CIL[DOC-VECTOR type="context" content="purpose='schema-utils shared module header and imports'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
51
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
52
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
53
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
67
54
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
68
55
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
56
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:module_header:module_header"]
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:ValidationSchema:interface" type="interface" identity="ValidationSchema" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
60
|
+
// CIL[DOC-MACRO purpose="validation schema type definition"]
|
|
61
|
+
// CIL[DOC-RESPONSIBILITY responsibility="declare the typed contract for generated validation schemas"]
|
|
62
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
63
|
+
// CIL[DOC-CONTRACT inputs="none" outputs="ValidationSchema type definition" errors="none" side_effects="none"]
|
|
64
|
+
// CIL[DOC-MICRO logic_summary="defines a fields record keyed by string with data_type, optional required, and extensible validation properties" notable_decisions="[]"]
|
|
65
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
66
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
69
67
|
export interface ValidationSchema {
|
|
70
68
|
fields: Record<string, {
|
|
71
69
|
data_type: string
|
|
@@ -73,23 +71,23 @@ export interface ValidationSchema {
|
|
|
73
71
|
[key: string]: any
|
|
74
72
|
}>
|
|
75
73
|
}
|
|
76
|
-
// CIL[
|
|
77
|
-
// CIL[
|
|
78
|
-
// CIL[DOC-
|
|
79
|
-
// CIL[DOC-
|
|
80
|
-
// CIL[DOC-MACRO purpose="Generate validation schema from design schema"]
|
|
81
|
-
// CIL[DOC-RESPONSIBILITY responsibility="Convert design schema to validation rules"]
|
|
82
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[\".framework/src/pages/admin/TypeDetailPage.tsx\",\".framework/src/pages/admin/RolesPage.tsx\",\"\\\"]"]
|
|
83
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="ValidationSchema" errors="none" side_effects="none"]
|
|
84
|
-
// CIL[DOC-MICRO logic_summary="Extracts field definitions and builds validation schema" notable_decisions="[]"]
|
|
85
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
86
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
87
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: .framework/src/pages/admin/TypeDetailPage.tsx, .framework/src/pages/admin/RolesPage.tsx, \."]
|
|
88
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
89
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
90
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
74
|
+
// CIL[DOC-VECTOR type="context" content="purpose='validation schema type definition'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
75
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
76
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
77
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
91
78
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
92
79
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
80
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:ValidationSchema:interface"]
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:generateValidationSchema:function" type="function" identity="generateValidationSchema" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
84
|
+
// CIL[DOC-MACRO purpose="generate a ValidationSchema from a design schema"]
|
|
85
|
+
// CIL[DOC-RESPONSIBILITY responsibility="build a validation schema capturing data types and constraints from a design schema"]
|
|
86
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
87
|
+
// CIL[DOC-CONTRACT inputs="designSchema: any" outputs="ValidationSchema" errors="none" side_effects="none"]
|
|
88
|
+
// CIL[DOC-MICRO logic_summary="iterates design schema fields, copies data_type and required, merges validation and options, and returns the validation schema" notable_decisions="[]"]
|
|
89
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
90
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
93
91
|
export function generateValidationSchema(designSchema: any): ValidationSchema {
|
|
94
92
|
const validationSchema: ValidationSchema = {
|
|
95
93
|
fields: {}
|
|
@@ -125,21 +123,23 @@ export function generateValidationSchema(designSchema: any): ValidationSchema {
|
|
|
125
123
|
|
|
126
124
|
return validationSchema
|
|
127
125
|
}
|
|
128
|
-
// CIL[
|
|
129
|
-
// CIL[
|
|
130
|
-
// CIL[DOC-
|
|
131
|
-
// CIL[DOC-
|
|
132
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[\".framework/migrations/025_retype_threads_messages.sql\",\".framework/src/pages/admin/IntegrationsPage.tsx\",\".framework/src/components/ui/dialog.tsx\",\"\\\"]"]
|
|
133
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized data" errors="validation errors" side_effects="none"]
|
|
134
|
-
// CIL[DOC-MICRO logic_summary="Switch statement routes to type-specific sanitizers" notable_decisions="[]"]
|
|
135
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
136
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
137
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/025_retype_threads_messages.sql, .framework/src/pages/admin/IntegrationsPage.tsx, .framework/src/components/ui/dialog.tsx, \."]
|
|
138
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
139
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
140
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
126
|
+
// CIL[DOC-VECTOR type="context" content="purpose='generate a ValidationSchema from a design schema'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
127
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
128
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
129
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
141
130
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
142
131
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
132
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:generateValidationSchema:function"]
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeFieldData:function" type="function" identity="sanitizeFieldData" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
136
|
+
// CIL[DOC-MACRO purpose="dispatch a field value to the correct sanitizer"]
|
|
137
|
+
// CIL[DOC-RESPONSIBILITY responsibility="route a single field value to the type-specific sanitizer based on data_type"]
|
|
138
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
139
|
+
// CIL[DOC-CONTRACT inputs="data: any, data_type: string, validation?: any" outputs="any" errors="throws Error when the field data fails type-specific validation or constraints" side_effects="none"]
|
|
140
|
+
// CIL[DOC-MICRO logic_summary="uses a switch over data_type to call the appropriate sanitize function with the field value and validation rules" notable_decisions="[]"]
|
|
141
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
142
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
143
143
|
export function sanitizeFieldData(
|
|
144
144
|
data: any,
|
|
145
145
|
data_type: string,
|
|
@@ -198,21 +198,23 @@ export function sanitizeFieldData(
|
|
|
198
198
|
return data
|
|
199
199
|
}
|
|
200
200
|
}
|
|
201
|
-
// CIL[
|
|
202
|
-
// CIL[
|
|
203
|
-
// CIL[DOC-
|
|
204
|
-
// CIL[DOC-
|
|
205
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[\".framework/migrations/025_retype_threads_messages.sql\",\".framework/src/pages/admin/IntegrationsPage.tsx\",\".framework/src/components/ui/dialog.tsx\",\"\\\"]"]
|
|
206
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted data" errors="none" side_effects="none"]
|
|
207
|
-
// CIL[DOC-MICRO logic_summary="Switch statement routes to type-specific formatters" notable_decisions="[]"]
|
|
208
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
209
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
210
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: .framework/migrations/025_retype_threads_messages.sql, .framework/src/pages/admin/IntegrationsPage.tsx, .framework/src/components/ui/dialog.tsx, \."]
|
|
211
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
212
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
213
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
201
|
+
// CIL[DOC-VECTOR type="context" content="purpose='dispatch a field value to the correct sanitizer'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
202
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
203
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
204
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
214
205
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
215
206
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
207
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeFieldData:function"]
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatFieldData:function" type="function" identity="formatFieldData" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
211
|
+
// CIL[DOC-MACRO purpose="dispatch a field value to the correct formatter"]
|
|
212
|
+
// CIL[DOC-RESPONSIBILITY responsibility="route a single field value to the type-specific formatter based on data_type"]
|
|
213
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
214
|
+
// CIL[DOC-CONTRACT inputs="data: any, data_type: string, context?: any" outputs="any" errors="none" side_effects="none"]
|
|
215
|
+
// CIL[DOC-MICRO logic_summary="uses a switch over data_type to call the appropriate format function with the field value and optional context" notable_decisions="[]"]
|
|
216
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
217
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
216
218
|
export function formatFieldData(
|
|
217
219
|
data: any,
|
|
218
220
|
data_type: string,
|
|
@@ -247,21 +249,23 @@ export function formatFieldData(
|
|
|
247
249
|
return data
|
|
248
250
|
}
|
|
249
251
|
}
|
|
250
|
-
// CIL[
|
|
251
|
-
// CIL[
|
|
252
|
-
// CIL[DOC-
|
|
253
|
-
// CIL[DOC-
|
|
254
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
255
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="transformed data" errors="none" side_effects="none"]
|
|
256
|
-
// CIL[DOC-MICRO logic_summary="Iterates through fields and applies appropriate transformation" notable_decisions="[]"]
|
|
257
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
258
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
259
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
260
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
261
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
262
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
252
|
+
// CIL[DOC-VECTOR type="context" content="purpose='dispatch a field value to the correct formatter'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
253
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
254
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
255
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
263
256
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
264
257
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
258
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatFieldData:function"]
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:transformRecordData:function" type="function" identity="transformRecordData" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
262
|
+
// CIL[DOC-MACRO purpose="apply sanitize or format to every field of a record"]
|
|
263
|
+
// CIL[DOC-RESPONSIBILITY responsibility="transform a full record by dispatching each field through sanitizeFieldData or formatFieldData"]
|
|
264
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
265
|
+
// CIL[DOC-CONTRACT inputs="data: Record<string, any>, validationSchema: ValidationSchema, operation: 'sanitize' | 'format', context?: any" outputs="Record<string, any>" errors="throws Error when any individual field fails validation during sanitize" side_effects="none"]
|
|
266
|
+
// CIL[DOC-MICRO logic_summary="iterates record entries, looks up each field in the validation schema, and applies the requested operation" notable_decisions="[]"]
|
|
267
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
268
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
265
269
|
export function transformRecordData(
|
|
266
270
|
data: Record<string, any>,
|
|
267
271
|
validationSchema: ValidationSchema,
|
|
@@ -295,33 +299,28 @@ export function transformRecordData(
|
|
|
295
299
|
|
|
296
300
|
return transformed
|
|
297
301
|
}
|
|
298
|
-
// CIL[
|
|
299
|
-
// CIL[
|
|
300
|
-
// CIL[DOC-
|
|
301
|
-
// CIL[DOC-
|
|
302
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
303
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized string" errors="validation errors" side_effects="none"]
|
|
304
|
-
// CIL[DOC-MICRO logic_summary="Removes control chars, HTML encodes, validates length/pattern" notable_decisions="[]"]
|
|
305
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
306
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
307
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
308
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
309
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
310
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
302
|
+
// CIL[DOC-VECTOR type="context" content="purpose='apply sanitize or format to every field of a record'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
303
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
304
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
305
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
311
306
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
312
307
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
308
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:transformRecordData:function"]
|
|
309
|
+
|
|
310
|
+
|
|
311
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeText:function" type="function" identity="sanitizeText" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
312
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a text input"]
|
|
313
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate text field data so downstream code can trust the value"]
|
|
314
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
315
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
316
|
+
// CIL[DOC-MICRO logic_summary="trims the input, strips control characters, and enforces min, max, and pattern constraints; output encoding is left to renderers (React escapes text nodes, DOMPurify guards innerHTML paths)" notable_decisions="HTML entity escaping was removed — it stored '-style entities in the database, corrupting text for JSON consumers, embeddings, and plain-text renders while providing no real XSS defense since every render path already escapes/sanitizes on output"]
|
|
317
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
318
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
313
319
|
function sanitizeText(data: any, validation?: any): string {
|
|
314
320
|
let text = String(data).trim()
|
|
315
321
|
|
|
316
322
|
text = text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '')
|
|
317
323
|
|
|
318
|
-
text = text
|
|
319
|
-
.replace(/&/g, '&')
|
|
320
|
-
.replace(/</g, '<')
|
|
321
|
-
.replace(/>/g, '>')
|
|
322
|
-
.replace(/"/g, '"')
|
|
323
|
-
.replace(/'/g, ''')
|
|
324
|
-
|
|
325
324
|
if (validation?.minLength && text.length < validation.minLength) {
|
|
326
325
|
throw new Error(`Text must be at least ${validation.minLength} characters`)
|
|
327
326
|
}
|
|
@@ -338,33 +337,28 @@ function sanitizeText(data: any, validation?: any): string {
|
|
|
338
337
|
|
|
339
338
|
return text
|
|
340
339
|
}
|
|
341
|
-
// CIL[
|
|
342
|
-
// CIL[
|
|
343
|
-
// CIL[DOC-
|
|
344
|
-
// CIL[DOC-
|
|
345
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
346
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized string" errors="length validation errors" side_effects="none"]
|
|
347
|
-
// CIL[DOC-MICRO logic_summary="Removes control chars, HTML encodes, checks length limits" notable_decisions="[]"]
|
|
348
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
349
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
350
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
351
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
352
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
353
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
340
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a text input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
341
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
342
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
343
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
354
344
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
355
345
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
346
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeText:function"]
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeTextarea:function" type="function" identity="sanitizeTextarea" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
350
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a textarea input"]
|
|
351
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate textarea field data so downstream code can trust the value"]
|
|
352
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
353
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
354
|
+
// CIL[DOC-MICRO logic_summary="trims the input, strips control characters, and enforces min and max length constraints; output encoding is left to renderers (React escapes text nodes, DOMPurify guards innerHTML paths)" notable_decisions="HTML entity escaping was removed — it stored '-style entities in the database, corrupting text for JSON consumers, embeddings, and plain-text renders while providing no real XSS defense since every render path already escapes/sanitizes on output"]
|
|
355
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
356
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
356
357
|
function sanitizeTextarea(data: any, validation?: any): string {
|
|
357
358
|
let text = String(data).trim()
|
|
358
359
|
|
|
359
360
|
text = text.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '')
|
|
360
361
|
|
|
361
|
-
text = text
|
|
362
|
-
.replace(/&/g, '&')
|
|
363
|
-
.replace(/</g, '<')
|
|
364
|
-
.replace(/>/g, '>')
|
|
365
|
-
.replace(/"/g, '"')
|
|
366
|
-
.replace(/'/g, ''')
|
|
367
|
-
|
|
368
362
|
if (validation?.minLength && text.length < validation.minLength) {
|
|
369
363
|
throw new Error(`Text must be at least ${validation.minLength} characters`)
|
|
370
364
|
}
|
|
@@ -374,21 +368,23 @@ function sanitizeTextarea(data: any, validation?: any): string {
|
|
|
374
368
|
|
|
375
369
|
return text
|
|
376
370
|
}
|
|
377
|
-
// CIL[
|
|
378
|
-
// CIL[
|
|
379
|
-
// CIL[DOC-
|
|
380
|
-
// CIL[DOC-
|
|
381
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
382
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized HTML" errors="length validation errors" side_effects="none"]
|
|
383
|
-
// CIL[DOC-MICRO logic_summary="Allows safe tags, removes scripts, strips event handlers" notable_decisions="[]"]
|
|
384
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
385
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
386
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
387
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
388
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
389
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
371
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a textarea input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
372
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
373
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
374
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
390
375
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
391
376
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
377
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeTextarea:function"]
|
|
378
|
+
|
|
379
|
+
|
|
380
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRichText:function" type="function" identity="sanitizeRichText" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
381
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a rich text input"]
|
|
382
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate rich text field data so downstream code can trust the value"]
|
|
383
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
384
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
385
|
+
// CIL[DOC-MICRO logic_summary="trims HTML, filters against an allowed tag whitelist, removes script and event handlers, and validates length constraints" notable_decisions="[]"]
|
|
386
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
387
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
392
388
|
function sanitizeRichText(data: any, validation?: any): string {
|
|
393
389
|
let html = String(data).trim()
|
|
394
390
|
|
|
@@ -414,21 +410,23 @@ function sanitizeRichText(data: any, validation?: any): string {
|
|
|
414
410
|
|
|
415
411
|
return html
|
|
416
412
|
}
|
|
417
|
-
// CIL[
|
|
418
|
-
// CIL[
|
|
419
|
-
// CIL[DOC-
|
|
420
|
-
// CIL[DOC-
|
|
421
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
422
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="normalized email" errors="invalid format error" side_effects="none"]
|
|
423
|
-
// CIL[DOC-MICRO logic_summary="Lowercases, trims, validates with regex pattern" notable_decisions="[]"]
|
|
424
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
425
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
426
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
427
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
428
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
429
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
413
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a rich text input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
414
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
415
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
416
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
430
417
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
431
418
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
419
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRichText:function"]
|
|
420
|
+
|
|
421
|
+
|
|
422
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeEmail:function" type="function" identity="sanitizeEmail" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
423
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a email input"]
|
|
424
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate email field data so downstream code can trust the value"]
|
|
425
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
426
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
427
|
+
// CIL[DOC-MICRO logic_summary="coerces the input to lowercase, trims it, and validates the email pattern" notable_decisions="[]"]
|
|
428
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
429
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
432
430
|
function sanitizeEmail(data: any, validation?: any): string {
|
|
433
431
|
let email = String(data).toLowerCase().trim()
|
|
434
432
|
|
|
@@ -439,21 +437,23 @@ function sanitizeEmail(data: any, validation?: any): string {
|
|
|
439
437
|
|
|
440
438
|
return email
|
|
441
439
|
}
|
|
442
|
-
// CIL[
|
|
443
|
-
// CIL[
|
|
444
|
-
// CIL[DOC-
|
|
445
|
-
// CIL[DOC-
|
|
446
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
447
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="cleaned phone" errors="format validation errors" side_effects="none"]
|
|
448
|
-
// CIL[DOC-MICRO logic_summary="Removes non-digits, validates against pattern if provided" notable_decisions="[]"]
|
|
449
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
450
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
451
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
452
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
453
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
454
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
440
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a email input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
441
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
442
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
443
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
455
444
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
456
445
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
446
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeEmail:function"]
|
|
447
|
+
|
|
448
|
+
|
|
449
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizePhone:function" type="function" identity="sanitizePhone" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
450
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a phone input"]
|
|
451
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate phone field data so downstream code can trust the value"]
|
|
452
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
453
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
454
|
+
// CIL[DOC-MICRO logic_summary="strips non-digits and validates the result against a pattern if provided" notable_decisions="[]"]
|
|
455
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
456
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
457
457
|
function sanitizePhone(data: any, validation?: any): string {
|
|
458
458
|
let phone = String(data).trim()
|
|
459
459
|
|
|
@@ -468,21 +468,23 @@ function sanitizePhone(data: any, validation?: any): string {
|
|
|
468
468
|
|
|
469
469
|
return phone
|
|
470
470
|
}
|
|
471
|
-
// CIL[
|
|
472
|
-
// CIL[
|
|
473
|
-
// CIL[DOC-
|
|
474
|
-
// CIL[DOC-
|
|
475
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
476
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="normalized URL" errors="invalid URL error" side_effects="none"]
|
|
477
|
-
// CIL[DOC-MICRO logic_summary="Validates URL format, restricts to HTTP/HTTPS protocols" notable_decisions="[]"]
|
|
478
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
479
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
480
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
481
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
482
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
483
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
471
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a phone input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
472
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
473
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
474
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
484
475
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
485
476
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
477
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizePhone:function"]
|
|
478
|
+
|
|
479
|
+
|
|
480
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeUrl:function" type="function" identity="sanitizeUrl" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
481
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a url input"]
|
|
482
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate url field data so downstream code can trust the value"]
|
|
483
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
484
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
485
|
+
// CIL[DOC-MICRO logic_summary="parses the input as a URL and restricts it to HTTP or HTTPS protocols" notable_decisions="[]"]
|
|
486
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
487
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
486
488
|
function sanitizeUrl(data: any, validation?: any): string {
|
|
487
489
|
let url = String(data).trim()
|
|
488
490
|
|
|
@@ -496,21 +498,23 @@ function sanitizeUrl(data: any, validation?: any): string {
|
|
|
496
498
|
throw new Error('Invalid URL format')
|
|
497
499
|
}
|
|
498
500
|
}
|
|
499
|
-
// CIL[
|
|
500
|
-
// CIL[
|
|
501
|
-
// CIL[DOC-
|
|
502
|
-
// CIL[DOC-
|
|
503
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
504
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated number" errors="range/validation errors" side_effects="none"]
|
|
505
|
-
// CIL[DOC-MICRO logic_summary="Validates NaN, checks min/max, applies step rounding" notable_decisions="[]"]
|
|
506
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
507
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
508
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
509
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
510
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
511
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
501
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a url input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
502
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
503
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
504
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
512
505
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
513
506
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
507
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeUrl:function"]
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeNumber:function" type="function" identity="sanitizeNumber" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
511
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a number input"]
|
|
512
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate number field data so downstream code can trust the value"]
|
|
513
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
514
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="number" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
515
|
+
// CIL[DOC-MICRO logic_summary="coerces the input to a number and enforces min, max, and step constraints" notable_decisions="[]"]
|
|
516
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
517
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
514
518
|
function sanitizeNumber(data: any, validation?: any): number {
|
|
515
519
|
let num = Number(data)
|
|
516
520
|
|
|
@@ -534,21 +538,23 @@ function sanitizeNumber(data: any, validation?: any): number {
|
|
|
534
538
|
|
|
535
539
|
return num
|
|
536
540
|
}
|
|
537
|
-
// CIL[
|
|
538
|
-
// CIL[
|
|
539
|
-
// CIL[DOC-
|
|
540
|
-
// CIL[DOC-
|
|
541
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
542
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="rounded currency" errors="range/validation errors" side_effects="none"]
|
|
543
|
-
// CIL[DOC-MICRO logic_summary="Rounds to 2 decimal places, validates range constraints" notable_decisions="[]"]
|
|
544
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
545
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
546
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
547
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
548
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
549
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
541
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a number input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
542
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
543
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
544
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
550
545
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
551
546
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
547
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeNumber:function"]
|
|
548
|
+
|
|
549
|
+
|
|
550
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeCurrency:function" type="function" identity="sanitizeCurrency" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
551
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a currency input"]
|
|
552
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate currency field data so downstream code can trust the value"]
|
|
553
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
554
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="number" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
555
|
+
// CIL[DOC-MICRO logic_summary="coerces the input to a number, rounds to two decimals, and enforces min and max" notable_decisions="[]"]
|
|
556
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
557
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
552
558
|
function sanitizeCurrency(data: any, validation?: any): number {
|
|
553
559
|
let num = Number(data)
|
|
554
560
|
|
|
@@ -567,39 +573,43 @@ function sanitizeCurrency(data: any, validation?: any): number {
|
|
|
567
573
|
|
|
568
574
|
return num
|
|
569
575
|
}
|
|
570
|
-
// CIL[
|
|
571
|
-
// CIL[
|
|
572
|
-
// CIL[DOC-
|
|
573
|
-
// CIL[DOC-
|
|
574
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
575
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized number" errors="number validation errors" side_effects="none"]
|
|
576
|
-
// CIL[DOC-MICRO logic_summary="Simple wrapper around sanitizeNumber function" notable_decisions="[]"]
|
|
577
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
578
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
579
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
580
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
581
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
582
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
576
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a currency input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
577
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
578
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
579
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
583
580
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
584
581
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
582
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeCurrency:function"]
|
|
583
|
+
|
|
584
|
+
|
|
585
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRange:function" type="function" identity="sanitizeRange" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
586
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a range input"]
|
|
587
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate range field data so downstream code can trust the value"]
|
|
588
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
589
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="number" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
590
|
+
// CIL[DOC-MICRO logic_summary="coerces the input through the number sanitizer to enforce range and step constraints" notable_decisions="[]"]
|
|
591
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
592
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
585
593
|
function sanitizeRange(data: any, validation?: any): number {
|
|
586
594
|
return sanitizeNumber(data, validation)
|
|
587
595
|
}
|
|
588
|
-
// CIL[
|
|
589
|
-
// CIL[
|
|
590
|
-
// CIL[DOC-
|
|
591
|
-
// CIL[DOC-
|
|
592
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
593
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="ISO date string" errors="date validation errors" side_effects="none"]
|
|
594
|
-
// CIL[DOC-MICRO logic_summary="Parses date, validates range, returns ISO format" notable_decisions="[]"]
|
|
595
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
596
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
597
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
598
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
599
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
600
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
596
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a range input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
597
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
598
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
599
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
601
600
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
602
601
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
602
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRange:function"]
|
|
603
|
+
|
|
604
|
+
|
|
605
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeDate:function" type="function" identity="sanitizeDate" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
606
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a date input"]
|
|
607
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate date field data so downstream code can trust the value"]
|
|
608
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
609
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
610
|
+
// CIL[DOC-MICRO logic_summary="parses the input as a date and enforces optional min and max dates" notable_decisions="[]"]
|
|
611
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
612
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
603
613
|
function sanitizeDate(data: any, validation?: any): string {
|
|
604
614
|
let dateStr = String(data).trim()
|
|
605
615
|
|
|
@@ -625,21 +635,23 @@ function sanitizeDate(data: any, validation?: any): string {
|
|
|
625
635
|
|
|
626
636
|
return isoDate
|
|
627
637
|
}
|
|
628
|
-
// CIL[
|
|
629
|
-
// CIL[
|
|
630
|
-
// CIL[DOC-
|
|
631
|
-
// CIL[DOC-
|
|
632
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
633
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="ISO datetime string" errors="datetime validation errors" side_effects="none"]
|
|
634
|
-
// CIL[DOC-MICRO logic_summary="Parses datetime, validates range, returns ISO format" notable_decisions="[]"]
|
|
635
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
636
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
637
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
638
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
639
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
640
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
638
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a date input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
639
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
640
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
641
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
641
642
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
642
643
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
644
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeDate:function"]
|
|
645
|
+
|
|
646
|
+
|
|
647
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeDatetime:function" type="function" identity="sanitizeDatetime" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
648
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a datetime input"]
|
|
649
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate datetime field data so downstream code can trust the value"]
|
|
650
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
651
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
652
|
+
// CIL[DOC-MICRO logic_summary="parses the input as a datetime and enforces optional min and max datetimes" notable_decisions="[]"]
|
|
653
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
654
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
643
655
|
function sanitizeDatetime(data: any, validation?: any): string {
|
|
644
656
|
let dateStr = String(data).trim()
|
|
645
657
|
|
|
@@ -665,21 +677,23 @@ function sanitizeDatetime(data: any, validation?: any): string {
|
|
|
665
677
|
|
|
666
678
|
return isoDatetime
|
|
667
679
|
}
|
|
668
|
-
// CIL[
|
|
669
|
-
// CIL[
|
|
670
|
-
// CIL[DOC-
|
|
671
|
-
// CIL[DOC-
|
|
672
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
673
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="boolean value" errors="invalid boolean error" side_effects="none"]
|
|
674
|
-
// CIL[DOC-MICRO logic_summary="Handles boolean, string, number representations" notable_decisions="[]"]
|
|
675
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
676
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
677
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
678
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
679
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
680
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
680
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a datetime input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
681
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
682
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
683
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
681
684
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
682
685
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
686
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeDatetime:function"]
|
|
687
|
+
|
|
688
|
+
|
|
689
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeBoolean:function" type="function" identity="sanitizeBoolean" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
690
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a boolean input"]
|
|
691
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate boolean field data so downstream code can trust the value"]
|
|
692
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
693
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="boolean" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
694
|
+
// CIL[DOC-MICRO logic_summary="coerces common string and boolean inputs to true or false" notable_decisions="[]"]
|
|
695
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
696
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
683
697
|
function sanitizeBoolean(data: any, validation?: any): boolean {
|
|
684
698
|
if (typeof data === 'boolean') {
|
|
685
699
|
return data
|
|
@@ -694,66 +708,73 @@ function sanitizeBoolean(data: any, validation?: any): boolean {
|
|
|
694
708
|
|
|
695
709
|
throw new Error('Invalid boolean value')
|
|
696
710
|
}
|
|
697
|
-
// CIL[
|
|
698
|
-
// CIL[
|
|
699
|
-
// CIL[DOC-
|
|
700
|
-
// CIL[DOC-
|
|
701
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
702
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="boolean value" errors="boolean validation errors" side_effects="none"]
|
|
703
|
-
// CIL[DOC-MICRO logic_summary="Simple wrapper around sanitizeBoolean function" notable_decisions="[]"]
|
|
704
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
705
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
706
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
707
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
708
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
709
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
711
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a boolean input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
712
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
713
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
714
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
710
715
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
711
716
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
717
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeBoolean:function"]
|
|
718
|
+
|
|
719
|
+
|
|
720
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeCheckbox:function" type="function" identity="sanitizeCheckbox" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
721
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a checkbox input"]
|
|
722
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate checkbox field data so downstream code can trust the value"]
|
|
723
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
724
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="boolean" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
725
|
+
// CIL[DOC-MICRO logic_summary="coerces the input to a boolean using the boolean sanitizer" notable_decisions="[]"]
|
|
726
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
727
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
712
728
|
function sanitizeCheckbox(data: any, validation?: any): boolean {
|
|
713
729
|
return sanitizeBoolean(data, validation)
|
|
714
730
|
}
|
|
715
|
-
// CIL[
|
|
716
|
-
// CIL[
|
|
717
|
-
// CIL[DOC-
|
|
718
|
-
// CIL[DOC-
|
|
719
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
720
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated option" errors="invalid option error" side_effects="none"]
|
|
721
|
-
// CIL[DOC-MICRO logic_summary="Trims value, checks against allowed options array" notable_decisions="[]"]
|
|
722
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
723
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
724
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
725
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
726
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
727
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
731
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a checkbox input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
732
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
733
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
734
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
728
735
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
729
736
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
737
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeCheckbox:function"]
|
|
738
|
+
|
|
739
|
+
|
|
740
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeSelect:function" type="function" identity="sanitizeSelect" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
741
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a select input"]
|
|
742
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate select field data so downstream code can trust the value"]
|
|
743
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
744
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
745
|
+
// CIL[DOC-MICRO logic_summary="trims the input and validates it against the configured allowed options" notable_decisions="[]"]
|
|
746
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
747
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
730
748
|
function sanitizeSelect(data: any, validation?: any): string {
|
|
731
749
|
let value = String(data).trim()
|
|
732
|
-
|
|
750
|
+
|
|
733
751
|
if (validation?.options) {
|
|
734
|
-
const allowedValues = Array.isArray(validation.options) ? validation.options : []
|
|
752
|
+
const allowedValues = (Array.isArray(validation.options) ? validation.options : [])
|
|
753
|
+
.map((o: any) => (o && typeof o === 'object' ? o.value : o))
|
|
735
754
|
if (!allowedValues.includes(value)) {
|
|
736
755
|
throw new Error('Invalid option selected')
|
|
737
756
|
}
|
|
738
757
|
}
|
|
739
|
-
|
|
758
|
+
|
|
740
759
|
return value
|
|
741
760
|
}
|
|
742
|
-
// CIL[
|
|
743
|
-
// CIL[
|
|
744
|
-
// CIL[DOC-
|
|
745
|
-
// CIL[DOC-
|
|
746
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
747
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated array" errors="invalid option errors" side_effects="none"]
|
|
748
|
-
// CIL[DOC-MICRO logic_summary="Converts to array, removes duplicates, validates options" notable_decisions="[]"]
|
|
749
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
750
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
751
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
752
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
753
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
754
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
761
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a select input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
762
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
763
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
764
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
755
765
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
756
766
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
767
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeSelect:function"]
|
|
768
|
+
|
|
769
|
+
|
|
770
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeMultiselect:function" type="function" identity="sanitizeMultiselect" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
771
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a multiselect input"]
|
|
772
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate multiselect field data so downstream code can trust the value"]
|
|
773
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
774
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string[]" errors="none" side_effects="none"]
|
|
775
|
+
// CIL[DOC-MICRO logic_summary="normalizes input to an array, deduplicates, validates against allowed options, and enforces max selection count" notable_decisions="[]"]
|
|
776
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
777
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
757
778
|
function sanitizeMultiselect(data: any, validation?: any): string[] {
|
|
758
779
|
let values: string[]
|
|
759
780
|
|
|
@@ -768,7 +789,8 @@ function sanitizeMultiselect(data: any, validation?: any): string[] {
|
|
|
768
789
|
values = [...new Set(values)]
|
|
769
790
|
|
|
770
791
|
if (validation?.options) {
|
|
771
|
-
const allowedValues = Array.isArray(validation.options) ? validation.options : []
|
|
792
|
+
const allowedValues = (Array.isArray(validation.options) ? validation.options : [])
|
|
793
|
+
.map((o: any) => (o && typeof o === 'object' ? o.value : o))
|
|
772
794
|
for (const value of values) {
|
|
773
795
|
if (!allowedValues.includes(value)) {
|
|
774
796
|
throw new Error(`Invalid option: ${value}`)
|
|
@@ -782,39 +804,43 @@ function sanitizeMultiselect(data: any, validation?: any): string[] {
|
|
|
782
804
|
|
|
783
805
|
return values
|
|
784
806
|
}
|
|
785
|
-
// CIL[
|
|
786
|
-
// CIL[
|
|
787
|
-
// CIL[DOC-
|
|
788
|
-
// CIL[DOC-
|
|
789
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
790
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated option" errors="invalid option error" side_effects="none"]
|
|
791
|
-
// CIL[DOC-MICRO logic_summary="Simple wrapper around sanitizeSelect function" notable_decisions="[]"]
|
|
792
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
793
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
794
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
795
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
796
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
797
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
807
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a multiselect input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
808
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
809
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
810
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
798
811
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
799
812
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
813
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeMultiselect:function"]
|
|
814
|
+
|
|
815
|
+
|
|
816
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRadio:function" type="function" identity="sanitizeRadio" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
817
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a radio input"]
|
|
818
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate radio field data so downstream code can trust the value"]
|
|
819
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
820
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
821
|
+
// CIL[DOC-MICRO logic_summary="trims the input and validates it against the configured allowed options using the select sanitizer" notable_decisions="[]"]
|
|
822
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
823
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
800
824
|
function sanitizeRadio(data: any, validation?: any): string {
|
|
801
825
|
return sanitizeSelect(data, validation)
|
|
802
826
|
}
|
|
803
|
-
// CIL[
|
|
804
|
-
// CIL[
|
|
805
|
-
// CIL[DOC-
|
|
806
|
-
// CIL[DOC-
|
|
807
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
808
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="normalized hex color" errors="invalid color format error" side_effects="none"]
|
|
809
|
-
// CIL[DOC-MICRO logic_summary="Validates hex format, converts 3-digit to 6-digit, uppercases" notable_decisions="[]"]
|
|
810
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
811
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
812
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
813
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
814
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
815
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
827
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a radio input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
828
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
829
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
830
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
816
831
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
817
832
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
833
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeRadio:function"]
|
|
834
|
+
|
|
835
|
+
|
|
836
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeColor:function" type="function" identity="sanitizeColor" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
837
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a color input"]
|
|
838
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate color field data so downstream code can trust the value"]
|
|
839
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
840
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
841
|
+
// CIL[DOC-MICRO logic_summary="validates and normalizes a hex color to a six-digit uppercase string" notable_decisions="[]"]
|
|
842
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
843
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
818
844
|
function sanitizeColor(data: any, validation?: any): string {
|
|
819
845
|
let color = String(data).trim()
|
|
820
846
|
|
|
@@ -829,21 +855,23 @@ function sanitizeColor(data: any, validation?: any): string {
|
|
|
829
855
|
|
|
830
856
|
return color.toUpperCase()
|
|
831
857
|
}
|
|
832
|
-
// CIL[
|
|
833
|
-
// CIL[
|
|
834
|
-
// CIL[DOC-
|
|
835
|
-
// CIL[DOC-
|
|
836
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
837
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated file object" errors="file validation errors" side_effects="none"]
|
|
838
|
-
// CIL[DOC-MICRO logic_summary="Checks object structure, size, type, sanitizes filename" notable_decisions="[]"]
|
|
839
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
840
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
841
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
842
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
843
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
844
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
858
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a color input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
859
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
860
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
861
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
845
862
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
846
863
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
864
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeColor:function"]
|
|
865
|
+
|
|
866
|
+
|
|
867
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeFile:function" type="function" identity="sanitizeFile" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
868
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a file input"]
|
|
869
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate file field data so downstream code can trust the value"]
|
|
870
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
871
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="any" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
872
|
+
// CIL[DOC-MICRO logic_summary="validates file metadata, enforces size and type constraints, and sanitizes the file name" notable_decisions="[]"]
|
|
873
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
874
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
847
875
|
function sanitizeFile(data: any, validation?: any): any {
|
|
848
876
|
if (typeof data !== 'object' || !data.name) {
|
|
849
877
|
throw new Error('Invalid file data')
|
|
@@ -861,21 +889,23 @@ function sanitizeFile(data: any, validation?: any): any {
|
|
|
861
889
|
|
|
862
890
|
return data
|
|
863
891
|
}
|
|
864
|
-
// CIL[
|
|
865
|
-
// CIL[
|
|
866
|
-
// CIL[DOC-
|
|
867
|
-
// CIL[DOC-
|
|
868
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
869
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="validated image object" errors="image validation errors" side_effects="none"]
|
|
870
|
-
// CIL[DOC-MICRO logic_summary="Uses file sanitizer, placeholder for dimension validation" notable_decisions="[]"]
|
|
871
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
872
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
873
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
874
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
875
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
876
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
892
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a file input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
893
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
894
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
895
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
877
896
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
878
897
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
898
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeFile:function"]
|
|
899
|
+
|
|
900
|
+
|
|
901
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeImage:function" type="function" identity="sanitizeImage" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
902
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a image input"]
|
|
903
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate image field data so downstream code can trust the value"]
|
|
904
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
905
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="any" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
906
|
+
// CIL[DOC-MICRO logic_summary="validates file data and applies optional dimension constraints (placeholder)" notable_decisions="[]"]
|
|
907
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
908
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
879
909
|
function sanitizeImage(data: any, validation?: any): any {
|
|
880
910
|
const file = sanitizeFile(data, validation)
|
|
881
911
|
|
|
@@ -884,21 +914,23 @@ function sanitizeImage(data: any, validation?: any): any {
|
|
|
884
914
|
|
|
885
915
|
return file
|
|
886
916
|
}
|
|
887
|
-
// CIL[
|
|
888
|
-
// CIL[
|
|
889
|
-
// CIL[DOC-
|
|
890
|
-
// CIL[DOC-
|
|
891
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
892
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="parsed JSON object" errors="JSON parsing/security errors" side_effects="none"]
|
|
893
|
-
// CIL[DOC-MICRO logic_summary="Parses string JSON, checks for dangerous keywords" notable_decisions="[]"]
|
|
894
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
895
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
896
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
897
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
898
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
899
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
917
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a image input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
918
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
919
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
920
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
900
921
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
901
922
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
923
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeImage:function"]
|
|
924
|
+
|
|
925
|
+
|
|
926
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeJson:function" type="function" identity="sanitizeJson" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
927
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a json input"]
|
|
928
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate json field data so downstream code can trust the value"]
|
|
929
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
930
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="any" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
931
|
+
// CIL[DOC-MICRO logic_summary="parses string input to JSON, stringifies for safety checks, and rejects values containing forbidden tokens" notable_decisions="[]"]
|
|
932
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
933
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
902
934
|
function sanitizeJson(data: any, validation?: any): any {
|
|
903
935
|
if (typeof data === 'string') {
|
|
904
936
|
try {
|
|
@@ -907,29 +939,50 @@ function sanitizeJson(data: any, validation?: any): any {
|
|
|
907
939
|
throw new Error('Invalid JSON format')
|
|
908
940
|
}
|
|
909
941
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
if (jsonStr.includes('function') || jsonStr.includes('eval') || jsonStr.includes('script')) {
|
|
942
|
+
|
|
943
|
+
if (jsonContainsDangerousContent(data)) {
|
|
913
944
|
throw new Error('JSON contains potentially dangerous content')
|
|
914
945
|
}
|
|
915
|
-
|
|
946
|
+
|
|
916
947
|
return data
|
|
917
948
|
}
|
|
918
|
-
|
|
919
|
-
//
|
|
920
|
-
//
|
|
921
|
-
//
|
|
922
|
-
//
|
|
923
|
-
//
|
|
924
|
-
//
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
949
|
+
|
|
950
|
+
// JSON field values are inert data — the real hazards are executable
|
|
951
|
+
// payloads smuggled inside string values (script tags, javascript: URLs,
|
|
952
|
+
// eval/Function calls, inline event handlers) and __proto__ keys, which
|
|
953
|
+
// prototype-pollute objects the payload is later merged into. Substring
|
|
954
|
+
// matching on the serialized JSON is NOT safe here: it rejects ordinary
|
|
955
|
+
// words like "functionality", "description", "evaluate", and "transcript".
|
|
956
|
+
const DANGEROUS_JSON_VALUE_PATTERN =
|
|
957
|
+
/<\s*\/?\s*script|javascript\s*:|\beval\s*\(|\bfunction\s*\(|new\s+Function\s*\(|\bon\w+\s*=/i
|
|
958
|
+
|
|
959
|
+
function jsonContainsDangerousContent(value: any): boolean {
|
|
960
|
+
if (typeof value === 'string') return DANGEROUS_JSON_VALUE_PATTERN.test(value)
|
|
961
|
+
if (Array.isArray(value)) return value.some(jsonContainsDangerousContent)
|
|
962
|
+
if (value && typeof value === 'object') {
|
|
963
|
+
return Object.entries(value).some(
|
|
964
|
+
([key, v]) => key === '__proto__' || jsonContainsDangerousContent(v)
|
|
965
|
+
)
|
|
966
|
+
}
|
|
967
|
+
return false
|
|
968
|
+
}
|
|
969
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a json input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
970
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
971
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
972
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
931
973
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
932
974
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
975
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeJson:function"]
|
|
976
|
+
|
|
977
|
+
|
|
978
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeReference:function" type="function" identity="sanitizeReference" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
979
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a reference input"]
|
|
980
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate reference field data so downstream code can trust the value"]
|
|
981
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
982
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="string" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
983
|
+
// CIL[DOC-MICRO logic_summary="validates that the input is a standard UUID string" notable_decisions="[]"]
|
|
984
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
985
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
933
986
|
function sanitizeReference(data: any, validation?: any): string {
|
|
934
987
|
let ref = String(data).trim()
|
|
935
988
|
|
|
@@ -940,21 +993,23 @@ function sanitizeReference(data: any, validation?: any): string {
|
|
|
940
993
|
|
|
941
994
|
return ref
|
|
942
995
|
}
|
|
943
|
-
// CIL[
|
|
944
|
-
// CIL[
|
|
945
|
-
// CIL[DOC-
|
|
946
|
-
// CIL[DOC-
|
|
947
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
948
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="sanitized address object" errors="invalid address error" side_effects="none"]
|
|
949
|
-
// CIL[DOC-MICRO logic_summary="Validates object type, sanitizes string fields with text sanitizer" notable_decisions="[]"]
|
|
950
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
951
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
952
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
953
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
954
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
955
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
996
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a reference input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
997
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
998
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
999
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
956
1000
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
957
1001
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1002
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeReference:function"]
|
|
1003
|
+
|
|
1004
|
+
|
|
1005
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeAddress:function" type="function" identity="sanitizeAddress" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1006
|
+
// CIL[DOC-MACRO purpose="sanitize and validate a address input"]
|
|
1007
|
+
// CIL[DOC-RESPONSIBILITY responsibility="clean and validate address field data so downstream code can trust the value"]
|
|
1008
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1009
|
+
// CIL[DOC-CONTRACT inputs="data: any, validation?: any" outputs="any" errors="throws Error when the input fails validation or constraint checks" side_effects="none"]
|
|
1010
|
+
// CIL[DOC-MICRO logic_summary="sanitizes string fields of an address object and returns the cleaned object" notable_decisions="[]"]
|
|
1011
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1012
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
958
1013
|
function sanitizeAddress(data: any, validation?: any): any {
|
|
959
1014
|
if (typeof data !== 'object' || data === null) {
|
|
960
1015
|
throw new Error('Address must be an object')
|
|
@@ -971,39 +1026,43 @@ function sanitizeAddress(data: any, validation?: any): any {
|
|
|
971
1026
|
|
|
972
1027
|
return sanitized
|
|
973
1028
|
}
|
|
974
|
-
// CIL[
|
|
975
|
-
// CIL[
|
|
976
|
-
// CIL[DOC-
|
|
977
|
-
// CIL[DOC-
|
|
978
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
979
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted JSON string" errors="none" side_effects="none"]
|
|
980
|
-
// CIL[DOC-MICRO logic_summary="Uses JSON.stringify with 2-space indentation" notable_decisions="[]"]
|
|
981
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
982
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
983
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
984
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
985
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
986
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1029
|
+
// CIL[DOC-VECTOR type="context" content="purpose='sanitize and validate a address input'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1030
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1031
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1032
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
987
1033
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
988
1034
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1035
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:sanitizeAddress:function"]
|
|
1036
|
+
|
|
1037
|
+
|
|
1038
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatJson:function" type="function" identity="formatJson" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1039
|
+
// CIL[DOC-MACRO purpose="format a json value for display"]
|
|
1040
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert json data into a human-readable string for UI rendering"]
|
|
1041
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1042
|
+
// CIL[DOC-CONTRACT inputs="data: any" outputs="string" errors="none" side_effects="none"]
|
|
1043
|
+
// CIL[DOC-MICRO logic_summary="pretty-prints a JSON value with two-space indentation" notable_decisions="[]"]
|
|
1044
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1045
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
989
1046
|
function formatJson(data: any): string {
|
|
990
1047
|
return JSON.stringify(data, null, 2)
|
|
991
1048
|
}
|
|
992
|
-
// CIL[
|
|
993
|
-
// CIL[
|
|
994
|
-
// CIL[DOC-
|
|
995
|
-
// CIL[DOC-
|
|
996
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
997
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted date string" errors="none" side_effects="none"]
|
|
998
|
-
// CIL[DOC-MICRO logic_summary="Uses toLocaleDateString with long month format" notable_decisions="[]"]
|
|
999
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1000
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1001
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1002
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1003
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1004
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1049
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a json value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1050
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1051
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1052
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1005
1053
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1006
1054
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1055
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatJson:function"]
|
|
1056
|
+
|
|
1057
|
+
|
|
1058
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatDate:function" type="function" identity="formatDate" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1059
|
+
// CIL[DOC-MACRO purpose="format a date value for display"]
|
|
1060
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert date data into a human-readable string for UI rendering"]
|
|
1061
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1062
|
+
// CIL[DOC-CONTRACT inputs="data: string" outputs="string" errors="none" side_effects="none"]
|
|
1063
|
+
// CIL[DOC-MICRO logic_summary="converts an ISO date string to a human-readable localized date" notable_decisions="[]"]
|
|
1064
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1065
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1007
1066
|
function formatDate(data: string): string {
|
|
1008
1067
|
const date = new Date(data)
|
|
1009
1068
|
if (isNaN(date.getTime())) {
|
|
@@ -1016,21 +1075,23 @@ function formatDate(data: string): string {
|
|
|
1016
1075
|
day: 'numeric'
|
|
1017
1076
|
})
|
|
1018
1077
|
}
|
|
1019
|
-
// CIL[
|
|
1020
|
-
// CIL[
|
|
1021
|
-
// CIL[DOC-
|
|
1022
|
-
// CIL[DOC-
|
|
1023
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1024
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted datetime string" errors="none" side_effects="none"]
|
|
1025
|
-
// CIL[DOC-MICRO logic_summary="Uses toLocaleString with date and time components" notable_decisions="[]"]
|
|
1026
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1027
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1028
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1029
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1030
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1031
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1078
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a date value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1079
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1080
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1081
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1032
1082
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1033
1083
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1084
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatDate:function"]
|
|
1085
|
+
|
|
1086
|
+
|
|
1087
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatDatetime:function" type="function" identity="formatDatetime" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1088
|
+
// CIL[DOC-MACRO purpose="format a datetime value for display"]
|
|
1089
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert datetime data into a human-readable string for UI rendering"]
|
|
1090
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1091
|
+
// CIL[DOC-CONTRACT inputs="data: string" outputs="string" errors="none" side_effects="none"]
|
|
1092
|
+
// CIL[DOC-MICRO logic_summary="converts an ISO datetime string to a human-readable localized datetime" notable_decisions="[]"]
|
|
1093
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1094
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1034
1095
|
function formatDatetime(data: string): string {
|
|
1035
1096
|
const date = new Date(data)
|
|
1036
1097
|
if (isNaN(date.getTime())) {
|
|
@@ -1045,21 +1106,23 @@ function formatDatetime(data: string): string {
|
|
|
1045
1106
|
minute: '2-digit'
|
|
1046
1107
|
})
|
|
1047
1108
|
}
|
|
1048
|
-
// CIL[
|
|
1049
|
-
// CIL[
|
|
1050
|
-
// CIL[DOC-
|
|
1051
|
-
// CIL[DOC-
|
|
1052
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1053
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted currency string" errors="none" side_effects="none"]
|
|
1054
|
-
// CIL[DOC-MICRO logic_summary="Uses Intl.NumberFormat with currency style" notable_decisions="[]"]
|
|
1055
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1056
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1057
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1058
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1059
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1060
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1109
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a datetime value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1110
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1111
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1112
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1061
1113
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1062
1114
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1115
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatDatetime:function"]
|
|
1116
|
+
|
|
1117
|
+
|
|
1118
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatCurrency:function" type="function" identity="formatCurrency" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1119
|
+
// CIL[DOC-MACRO purpose="format a currency value for display"]
|
|
1120
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert currency data into a human-readable string for UI rendering"]
|
|
1121
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1122
|
+
// CIL[DOC-CONTRACT inputs="data: number, context?: any" outputs="string" errors="none" side_effects="none"]
|
|
1123
|
+
// CIL[DOC-MICRO logic_summary="formats a number as an ICU currency string using the provided context currency or USD" notable_decisions="[]"]
|
|
1124
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1125
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1063
1126
|
function formatCurrency(data: number, context?: any): string {
|
|
1064
1127
|
const currency = context?.currency_code || 'USD'
|
|
1065
1128
|
return new Intl.NumberFormat('en-US', {
|
|
@@ -1067,21 +1130,23 @@ function formatCurrency(data: number, context?: any): string {
|
|
|
1067
1130
|
currency: currency
|
|
1068
1131
|
}).format(data)
|
|
1069
1132
|
}
|
|
1070
|
-
// CIL[
|
|
1071
|
-
// CIL[
|
|
1072
|
-
// CIL[DOC-
|
|
1073
|
-
// CIL[DOC-
|
|
1074
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1075
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted phone string" errors="none" side_effects="none"]
|
|
1076
|
-
// CIL[DOC-MICRO logic_summary="Formats 10-digit and 11-digit US phone numbers" notable_decisions="[]"]
|
|
1077
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1078
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1079
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1080
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1081
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1082
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1133
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a currency value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1134
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1135
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1136
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1083
1137
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1084
1138
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1139
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatCurrency:function"]
|
|
1140
|
+
|
|
1141
|
+
|
|
1142
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatPhone:function" type="function" identity="formatPhone" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1143
|
+
// CIL[DOC-MACRO purpose="format a phone value for display"]
|
|
1144
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert phone data into a human-readable string for UI rendering"]
|
|
1145
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1146
|
+
// CIL[DOC-CONTRACT inputs="data: string" outputs="string" errors="none" side_effects="none"]
|
|
1147
|
+
// CIL[DOC-MICRO logic_summary="strips non-digits and formats 10 or 11-digit US numbers" notable_decisions="[]"]
|
|
1148
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1149
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1085
1150
|
function formatPhone(data: string): string {
|
|
1086
1151
|
const phone = data.replace(/\D/g, '')
|
|
1087
1152
|
if (phone.length === 10) {
|
|
@@ -1092,57 +1157,63 @@ function formatPhone(data: string): string {
|
|
|
1092
1157
|
|
|
1093
1158
|
return data
|
|
1094
1159
|
}
|
|
1095
|
-
// CIL[
|
|
1096
|
-
// CIL[
|
|
1097
|
-
// CIL[DOC-
|
|
1098
|
-
// CIL[DOC-
|
|
1099
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1100
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="URL string" errors="none" side_effects="none"]
|
|
1101
|
-
// CIL[DOC-MICRO logic_summary="Pass-through function, no formatting applied" notable_decisions="[]"]
|
|
1102
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1103
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1104
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1105
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1106
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1107
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1160
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a phone value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1161
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1162
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1163
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1108
1164
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1109
1165
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1166
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatPhone:function"]
|
|
1167
|
+
|
|
1168
|
+
|
|
1169
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatUrl:function" type="function" identity="formatUrl" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1170
|
+
// CIL[DOC-MACRO purpose="format a url value for display"]
|
|
1171
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert url data into a human-readable string for UI rendering"]
|
|
1172
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1173
|
+
// CIL[DOC-CONTRACT inputs="data: string" outputs="string" errors="none" side_effects="none"]
|
|
1174
|
+
// CIL[DOC-MICRO logic_summary="returns the URL string unchanged" notable_decisions="[]"]
|
|
1175
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1176
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1110
1177
|
function formatUrl(data: string): string {
|
|
1111
1178
|
return data
|
|
1112
1179
|
}
|
|
1113
|
-
// CIL[
|
|
1114
|
-
// CIL[
|
|
1115
|
-
// CIL[DOC-
|
|
1116
|
-
// CIL[DOC-
|
|
1117
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1118
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="reference string" errors="none" side_effects="none"]
|
|
1119
|
-
// CIL[DOC-MICRO logic_summary="Pass-through function, no formatting applied" notable_decisions="[]"]
|
|
1120
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1121
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1122
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1123
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1124
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1125
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1180
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a url value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1181
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1182
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1183
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1126
1184
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1127
1185
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1186
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatUrl:function"]
|
|
1187
|
+
|
|
1188
|
+
|
|
1189
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatReference:function" type="function" identity="formatReference" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1190
|
+
// CIL[DOC-MACRO purpose="format a reference value for display"]
|
|
1191
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert reference data into a human-readable string for UI rendering"]
|
|
1192
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1193
|
+
// CIL[DOC-CONTRACT inputs="data: string, context?: any" outputs="string" errors="none" side_effects="none"]
|
|
1194
|
+
// CIL[DOC-MICRO logic_summary="returns the reference string unchanged" notable_decisions="[]"]
|
|
1195
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1196
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1128
1197
|
function formatReference(data: string, context?: any): string {
|
|
1129
1198
|
return data
|
|
1130
1199
|
}
|
|
1131
|
-
// CIL[
|
|
1132
|
-
// CIL[
|
|
1133
|
-
// CIL[DOC-
|
|
1134
|
-
// CIL[DOC-
|
|
1135
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1136
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted address string" errors="none" side_effects="none"]
|
|
1137
|
-
// CIL[DOC-MICRO logic_summary="Joins address components with commas, filters empty values" notable_decisions="[]"]
|
|
1138
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1139
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1140
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1141
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1142
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1143
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1200
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a reference value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1201
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1202
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1203
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1144
1204
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1145
1205
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1206
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatReference:function"]
|
|
1207
|
+
|
|
1208
|
+
|
|
1209
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatAddress:function" type="function" identity="formatAddress" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1210
|
+
// CIL[DOC-MACRO purpose="format a address value for display"]
|
|
1211
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert address data into a human-readable string for UI rendering"]
|
|
1212
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1213
|
+
// CIL[DOC-CONTRACT inputs="data: any" outputs="string" errors="none" side_effects="none"]
|
|
1214
|
+
// CIL[DOC-MICRO logic_summary="joins present address parts into a comma-separated display string" notable_decisions="[]"]
|
|
1215
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1216
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1146
1217
|
function formatAddress(data: any): string {
|
|
1147
1218
|
if (typeof data !== 'object' || data === null) {
|
|
1148
1219
|
return String(data)
|
|
@@ -1158,21 +1229,23 @@ function formatAddress(data: any): string {
|
|
|
1158
1229
|
|
|
1159
1230
|
return parts.join(', ')
|
|
1160
1231
|
}
|
|
1161
|
-
// CIL[
|
|
1162
|
-
// CIL[
|
|
1163
|
-
// CIL[DOC-
|
|
1164
|
-
// CIL[DOC-
|
|
1165
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1166
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="comma-separated string" errors="none" side_effects="none"]
|
|
1167
|
-
// CIL[DOC-MICRO logic_summary="Joins array elements with commas, handles non-arrays" notable_decisions="[]"]
|
|
1168
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1169
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1170
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1171
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1172
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1173
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1232
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a address value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1233
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1234
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1235
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1174
1236
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1175
1237
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1238
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatAddress:function"]
|
|
1239
|
+
|
|
1240
|
+
|
|
1241
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatMultiselect:function" type="function" identity="formatMultiselect" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1242
|
+
// CIL[DOC-MACRO purpose="format a multiselect value for display"]
|
|
1243
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert multiselect data into a human-readable string for UI rendering"]
|
|
1244
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1245
|
+
// CIL[DOC-CONTRACT inputs="data: string[]" outputs="string" errors="none" side_effects="none"]
|
|
1246
|
+
// CIL[DOC-MICRO logic_summary="joins an array into a comma-separated display string" notable_decisions="[]"]
|
|
1247
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1248
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1176
1249
|
function formatMultiselect(data: string[]): string {
|
|
1177
1250
|
if (!Array.isArray(data)) {
|
|
1178
1251
|
return String(data)
|
|
@@ -1180,21 +1253,23 @@ function formatMultiselect(data: string[]): string {
|
|
|
1180
1253
|
|
|
1181
1254
|
return data.join(', ')
|
|
1182
1255
|
}
|
|
1183
|
-
// CIL[
|
|
1184
|
-
// CIL[
|
|
1185
|
-
// CIL[DOC-
|
|
1186
|
-
// CIL[DOC-
|
|
1187
|
-
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files="[]"]
|
|
1188
|
-
// CIL[DOC-CONTRACT inputs="none" outputs="formatted boolean string" errors="none" side_effects="none"]
|
|
1189
|
-
// CIL[DOC-MICRO logic_summary="Uses contextual labels for is_active, defaults to Yes/No" notable_decisions="[]"]
|
|
1190
|
-
// CIL[DOC-CONFIDENCE pass="second" score="0.95" flags="none"]
|
|
1191
|
-
// CIL[DOC-STABILITY stability="stable"]
|
|
1192
|
-
// CIL[DOC-VECTOR type="context" content="Layer: shared. Direct callers: 0. Direct calls: 0. Related files: none."]
|
|
1193
|
-
// CIL[DOC-VECTOR type="blast_radius" content="Direct callers: 0. Total affected: 0."]
|
|
1194
|
-
// CIL[DOC-VECTOR type="configuration" content="No configuration dependencies."]
|
|
1195
|
-
// CIL[DOC-VECTOR type="constraint" content="No test paths identified."]
|
|
1256
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a multiselect value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1257
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1258
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1259
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1196
1260
|
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1197
1261
|
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1262
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatMultiselect:function"]
|
|
1263
|
+
|
|
1264
|
+
|
|
1265
|
+
// CIL[BEGIN stable_id="~/.framework/functions/_shared/schema-utils.ts:formatBoolean:function" type="function" identity="formatBoolean" parent="~/.framework/functions/_shared/schema-utils.ts"]
|
|
1266
|
+
// CIL[DOC-MACRO purpose="format a boolean value for display"]
|
|
1267
|
+
// CIL[DOC-RESPONSIBILITY responsibility="convert boolean data into a human-readable string for UI rendering"]
|
|
1268
|
+
// CIL[DOC-CONTEXT module="schema-utils" layer="shared" related_files=".framework/functions/_shared/schema-utils.ts,.framework/src/types/types.ts"]
|
|
1269
|
+
// CIL[DOC-CONTRACT inputs="data: boolean, context?: any" outputs="string" errors="none" side_effects="none"]
|
|
1270
|
+
// CIL[DOC-MICRO logic_summary="returns Active/Inactive for the is_active field and Yes/No for other booleans" notable_decisions="[]"]
|
|
1271
|
+
// CIL[DOC-CONFIDENCE pass="second" score="0.90" flags="none"]
|
|
1272
|
+
// CIL[DOC-STABILITY stability="stable"]
|
|
1198
1273
|
function formatBoolean(data: boolean, context?: any): string {
|
|
1199
1274
|
if (context?.field === 'is_active') {
|
|
1200
1275
|
return data ? 'Active' : 'Inactive'
|
|
@@ -1202,4 +1277,10 @@ function formatBoolean(data: boolean, context?: any): string {
|
|
|
1202
1277
|
|
|
1203
1278
|
return data ? 'Yes' : 'No'
|
|
1204
1279
|
}
|
|
1205
|
-
// CIL[
|
|
1280
|
+
// CIL[DOC-VECTOR type="context" content="purpose='format a boolean value for display'; No verified external callers; imports: .framework/src/types/types.ts"]
|
|
1281
|
+
// CIL[DOC-VECTOR type="blast_radius" content="No direct caller data from CIL graph; local impact only"]
|
|
1282
|
+
// CIL[DOC-VECTOR type="configuration" content="No environment or build configuration dependencies identified"]
|
|
1283
|
+
// CIL[DOC-VECTOR type="constraint" content="Standard runtime; no special invariants documented"]
|
|
1284
|
+
// CIL[DOC-VECTOR type="implementation_pattern" content="" status="pending_human_input"]
|
|
1285
|
+
// CIL[DOC-VECTOR type="user_journey" content="" status="pending_human_input"]
|
|
1286
|
+
// CIL[END stable_id="~/.framework/functions/_shared/schema-utils.ts:formatBoolean:function"]
|