polen 0.11.0-next.17 → 0.11.0-next.19
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/build/api/builder/ssg/generate.d.ts.map +1 -1
- package/build/api/builder/ssg/generate.js +5 -5
- package/build/api/builder/ssg/generate.js.map +1 -1
- package/build/api/builder/ssg/page-generator.worker.js +13 -3
- package/build/api/builder/ssg/page-generator.worker.js.map +1 -1
- package/build/api/config/input.d.ts +88 -3
- package/build/api/config/input.d.ts.map +1 -1
- package/build/api/config/normalized.d.ts +92 -7
- package/build/api/config/normalized.d.ts.map +1 -1
- package/build/api/config/normalized.js +11 -3
- package/build/api/config/normalized.js.map +1 -1
- package/build/api/config-template/template.js +2 -2
- package/build/api/config-template/template.js.map +1 -1
- package/build/api/content/sidebar.d.ts.map +1 -1
- package/build/api/content/sidebar.js +2 -1
- package/build/api/content/sidebar.js.map +1 -1
- package/build/api/errors.d.ts +278 -0
- package/build/api/errors.d.ts.map +1 -0
- package/build/api/errors.js +153 -0
- package/build/api/errors.js.map +1 -0
- package/build/api/examples/config.d.ts +366 -3
- package/build/api/examples/config.d.ts.map +1 -1
- package/build/api/examples/config.js +25 -3
- package/build/api/examples/config.js.map +1 -1
- package/build/api/examples/diagnostic/diagnostic.d.ts +1 -1
- package/build/api/examples/diagnostic/validation-error.d.ts +3 -2
- package/build/api/examples/diagnostic/validation-error.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validation-error.js +9 -3
- package/build/api/examples/diagnostic/validation-error.js.map +1 -1
- package/build/api/examples/diagnostic/validator.d.ts.map +1 -1
- package/build/api/examples/diagnostic/validator.js +115 -68
- package/build/api/examples/diagnostic/validator.js.map +1 -1
- package/build/api/examples/filter.d.ts.map +1 -1
- package/build/api/examples/filter.js +9 -6
- package/build/api/examples/filter.js.map +1 -1
- package/build/api/examples/scanner.d.ts.map +1 -1
- package/build/api/examples/scanner.js +89 -103
- package/build/api/examples/scanner.js.map +1 -1
- package/build/api/examples/type-usage-indexer.d.ts.map +1 -1
- package/build/api/examples/type-usage-indexer.js +17 -30
- package/build/api/examples/type-usage-indexer.js.map +1 -1
- package/build/api/iso/schema/routing.d.ts.map +1 -1
- package/build/api/iso/schema/routing.js +8 -8
- package/build/api/iso/schema/routing.js.map +1 -1
- package/build/api/iso/schema/validation.d.ts.map +1 -1
- package/build/api/iso/schema/validation.js +3 -2
- package/build/api/iso/schema/validation.js.map +1 -1
- package/build/api/schema/input-source/$$.d.ts +1 -0
- package/build/api/schema/input-source/$$.d.ts.map +1 -1
- package/build/api/schema/input-source/$$.js +1 -0
- package/build/api/schema/input-source/$$.js.map +1 -1
- package/build/api/schema/input-source/errors.d.ts +36 -0
- package/build/api/schema/input-source/errors.d.ts.map +1 -0
- package/build/api/schema/input-source/errors.js +17 -0
- package/build/api/schema/input-source/errors.js.map +1 -0
- package/build/api/schema/input-source/input-source.d.ts +1 -7
- package/build/api/schema/input-source/input-source.d.ts.map +1 -1
- package/build/api/schema/input-source/input-source.js +0 -6
- package/build/api/schema/input-source/input-source.js.map +1 -1
- package/build/api/schema/input-sources/directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/directory.js +19 -6
- package/build/api/schema/input-sources/directory.js.map +1 -1
- package/build/api/schema/input-sources/file.d.ts.map +1 -1
- package/build/api/schema/input-sources/file.js +15 -4
- package/build/api/schema/input-sources/file.js.map +1 -1
- package/build/api/schema/input-sources/introspection-file.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection-file.js +28 -6
- package/build/api/schema/input-sources/introspection-file.js.map +1 -1
- package/build/api/schema/input-sources/introspection.d.ts.map +1 -1
- package/build/api/schema/input-sources/introspection.js +35 -7
- package/build/api/schema/input-sources/introspection.js.map +1 -1
- package/build/api/schema/input-sources/memory.d.ts.map +1 -1
- package/build/api/schema/input-sources/memory.js +15 -3
- package/build/api/schema/input-sources/memory.js.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.d.ts.map +1 -1
- package/build/api/schema/input-sources/versioned-directory.js +23 -7
- package/build/api/schema/input-sources/versioned-directory.js.map +1 -1
- package/build/api/schema/load.d.ts +1 -1
- package/build/api/schema/load.d.ts.map +1 -1
- package/build/api/schema/load.js.map +1 -1
- package/build/cli/commands/hero-image.d.ts +1 -2
- package/build/cli/commands/hero-image.d.ts.map +1 -1
- package/build/cli/index.d.ts +1 -1
- package/build/lib/catalog/catalog.d.ts +43 -3
- package/build/lib/catalog/catalog.d.ts.map +1 -1
- package/build/lib/catalog/catalog.js +67 -5
- package/build/lib/catalog/catalog.js.map +1 -1
- package/build/lib/catalog/versioned.d.ts +11 -1
- package/build/lib/catalog/versioned.d.ts.map +1 -1
- package/build/lib/catalog/versioned.js +23 -5
- package/build/lib/catalog/versioned.js.map +1 -1
- package/build/lib/document/document.d.ts +55 -5
- package/build/lib/document/document.d.ts.map +1 -1
- package/build/lib/document/document.js +96 -2
- package/build/lib/document/document.js.map +1 -1
- package/build/lib/document/versioned.d.ts +2 -2
- package/build/lib/document/versioned.d.ts.map +1 -1
- package/build/lib/document/versioned.js +7 -7
- package/build/lib/document/versioned.js.map +1 -1
- package/build/lib/lifecycles/lifecycles.d.ts +5 -4
- package/build/lib/lifecycles/lifecycles.d.ts.map +1 -1
- package/build/lib/lifecycles/lifecycles.js +14 -12
- package/build/lib/lifecycles/lifecycles.js.map +1 -1
- package/build/lib/version-coverage/$$.d.ts +2 -0
- package/build/lib/version-coverage/$$.d.ts.map +1 -0
- package/build/lib/version-coverage/$$.js +2 -0
- package/build/lib/version-coverage/$$.js.map +1 -0
- package/build/lib/version-coverage/$.d.ts.map +1 -0
- package/build/lib/version-coverage/$.js.map +1 -0
- package/build/lib/{version-selection/version-selection.d.ts → version-coverage/version-coverage.d.ts} +1 -1
- package/build/lib/version-coverage/version-coverage.d.ts.map +1 -0
- package/build/lib/{version-selection/version-selection.js → version-coverage/version-coverage.js} +2 -2
- package/build/lib/version-coverage/version-coverage.js.map +1 -0
- package/build/template/components/GraphQLDocument.d.ts +1 -1
- package/build/template/components/GraphQLDocument.d.ts.map +1 -1
- package/build/template/components/GraphQLDocument.js +10 -39
- package/build/template/components/GraphQLDocument.js.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts +28 -0
- package/build/template/components/GraphQLInteractive/lib/parser.d.ts.map +1 -1
- package/build/template/components/GraphQLInteractive/lib/parser.js +60 -27
- package/build/template/components/GraphQLInteractive/lib/parser.js.map +1 -1
- package/build/template/components/ReferenceVersionPicker.d.ts +9 -0
- package/build/template/components/ReferenceVersionPicker.d.ts.map +1 -0
- package/build/template/components/ReferenceVersionPicker.js +79 -0
- package/build/template/components/ReferenceVersionPicker.js.map +1 -0
- package/build/template/components/VersionCoveragePicker.d.ts +1 -1
- package/build/template/components/VersionCoveragePicker.d.ts.map +1 -1
- package/build/template/components/VersionCoveragePicker.js +4 -6
- package/build/template/components/VersionCoveragePicker.js.map +1 -1
- package/build/template/components/VersionPicker.d.ts +8 -3
- package/build/template/components/VersionPicker.d.ts.map +1 -1
- package/build/template/components/VersionPicker.js +12 -77
- package/build/template/components/VersionPicker.js.map +1 -1
- package/build/template/components/home/QuickStart.d.ts.map +1 -1
- package/build/template/components/home/QuickStart.js +8 -4
- package/build/template/components/home/QuickStart.js.map +1 -1
- package/build/template/hooks/use-highlighted.d.ts.map +1 -1
- package/build/template/hooks/use-highlighted.js +19 -13
- package/build/template/hooks/use-highlighted.js.map +1 -1
- package/build/template/lib/fetch-text.d.ts +18 -0
- package/build/template/lib/fetch-text.d.ts.map +1 -1
- package/build/template/lib/fetch-text.js +32 -4
- package/build/template/lib/fetch-text.js.map +1 -1
- package/build/template/routes/changelog/ChangelogBody.d.ts +6 -0
- package/build/template/routes/changelog/ChangelogBody.d.ts.map +1 -0
- package/build/template/{components/Changelog/Changelog.js → routes/changelog/ChangelogBody.js} +8 -58
- package/build/template/routes/changelog/ChangelogBody.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts +7 -0
- package/build/template/routes/changelog/ChangelogSidebar.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebar.js +46 -0
- package/build/template/routes/changelog/ChangelogSidebar.js.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts +11 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.d.ts.map +1 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js +35 -0
- package/build/template/routes/changelog/ChangelogSidebarItem.js.map +1 -0
- package/build/template/routes/changelog/_.d.ts +3264 -0
- package/build/template/routes/changelog/_.d.ts.map +1 -0
- package/build/template/routes/changelog/_.js +111 -0
- package/build/template/routes/changelog/_.js.map +1 -0
- package/build/template/routes/changelog/utils.d.ts +3 -0
- package/build/template/routes/changelog/utils.d.ts.map +1 -0
- package/build/template/routes/changelog/utils.js +11 -0
- package/build/template/routes/changelog/utils.js.map +1 -0
- package/build/template/routes/examples/name.d.ts.map +1 -1
- package/build/template/routes/examples/name.js +4 -2
- package/build/template/routes/examples/name.js.map +1 -1
- package/build/template/routes/reference.js +2 -2
- package/build/template/routes/reference.js.map +1 -1
- package/build/template/routes/root.js +1 -1
- package/build/template/routes/root.js.map +1 -1
- package/build/template/stores/toast.d.ts.map +1 -1
- package/build/template/stores/toast.js +5 -3
- package/build/template/stores/toast.js.map +1 -1
- package/build/template/theme/swiss-sharp.css +14 -14
- package/build/vite/plugins/schemas.d.ts +1 -2
- package/build/vite/plugins/schemas.d.ts.map +1 -1
- package/build/vite/plugins/schemas.js +0 -1
- package/build/vite/plugins/schemas.js.map +1 -1
- package/package.json +7 -7
- package/src/api/builder/ssg/generate.ts +10 -5
- package/src/api/builder/ssg/page-generator.worker.ts +18 -3
- package/src/api/config/normalized.ts +12 -3
- package/src/api/config-template/template.ts +2 -2
- package/src/api/content/sidebar.ts +3 -3
- package/src/api/errors.ts +227 -0
- package/src/api/examples/config.test.ts +10 -0
- package/src/api/examples/config.ts +33 -4
- package/src/api/examples/diagnostic/validation-error.ts +9 -3
- package/src/api/examples/diagnostic/validator.test.ts +30 -0
- package/src/api/examples/diagnostic/validator.ts +148 -103
- package/src/api/examples/filter.ts +9 -6
- package/src/api/examples/scanner.ts +136 -117
- package/src/api/examples/type-usage-indexer.ts +24 -36
- package/src/api/iso/schema/routing.ts +10 -10
- package/src/api/iso/schema/validation.ts +3 -2
- package/src/api/schema/input-source/$$.ts +1 -0
- package/src/api/schema/input-source/errors.ts +26 -0
- package/src/api/schema/input-source/input-source.ts +1 -22
- package/src/api/schema/input-sources/directory.ts +20 -15
- package/src/api/schema/input-sources/file.ts +17 -4
- package/src/api/schema/input-sources/introspection-file.ts +30 -15
- package/src/api/schema/input-sources/introspection.ts +38 -7
- package/src/api/schema/input-sources/memory.ts +19 -3
- package/src/api/schema/input-sources/versioned-directory.ts +25 -27
- package/src/api/schema/load.ts +2 -1
- package/src/lib/catalog/catalog.ts +89 -6
- package/src/lib/catalog/versioned.ts +26 -5
- package/src/lib/document/document.ts +135 -2
- package/src/lib/document/versioned.ts +8 -8
- package/src/lib/lifecycles/lifecycles.ts +32 -27
- package/src/lib/version-coverage/$$.ts +1 -0
- package/src/lib/{version-selection/version-selection.ts → version-coverage/version-coverage.ts} +1 -1
- package/src/template/components/GraphQLDocument.tsx +11 -69
- package/src/template/components/GraphQLInteractive/lib/parser.ts +81 -29
- package/src/template/components/ReferenceVersionPicker.tsx +107 -0
- package/src/template/components/VersionCoveragePicker.tsx +4 -5
- package/src/template/components/VersionPicker.tsx +32 -98
- package/src/template/components/home/QuickStart.tsx +16 -7
- package/src/template/hooks/use-highlighted.ts +31 -19
- package/src/template/lib/fetch-text.ts +45 -4
- package/src/template/{components/Changelog/Changelog.tsx → routes/changelog/ChangelogBody.tsx} +7 -64
- package/src/template/routes/changelog/ChangelogSidebar.tsx +80 -0
- package/src/template/routes/changelog/ChangelogSidebarItem.tsx +68 -0
- package/src/template/routes/changelog/_.tsx +129 -0
- package/src/template/routes/changelog/utils.ts +13 -0
- package/src/template/routes/examples/name.tsx +4 -2
- package/src/template/routes/reference.tsx +2 -2
- package/src/template/routes/root.tsx +1 -1
- package/src/template/stores/toast.ts +6 -3
- package/src/template/theme/swiss-sharp.css +14 -14
- package/src/vite/plugins/schemas.ts +0 -1
- package/build/lib/graph/$$.d.ts +0 -2
- package/build/lib/graph/$$.d.ts.map +0 -1
- package/build/lib/graph/$$.js +0 -2
- package/build/lib/graph/$$.js.map +0 -1
- package/build/lib/graph/$.d.ts +0 -2
- package/build/lib/graph/$.d.ts.map +0 -1
- package/build/lib/graph/$.js +0 -2
- package/build/lib/graph/$.js.map +0 -1
- package/build/lib/graph/graph.d.ts +0 -127
- package/build/lib/graph/graph.d.ts.map +0 -1
- package/build/lib/graph/graph.js +0 -152
- package/build/lib/graph/graph.js.map +0 -1
- package/build/lib/mask/$$.d.ts +0 -3
- package/build/lib/mask/$$.d.ts.map +0 -1
- package/build/lib/mask/$$.js +0 -3
- package/build/lib/mask/$$.js.map +0 -1
- package/build/lib/mask/$.d.ts +0 -2
- package/build/lib/mask/$.d.ts.map +0 -1
- package/build/lib/mask/$.js +0 -2
- package/build/lib/mask/$.js.map +0 -1
- package/build/lib/mask/apply.d.ts +0 -86
- package/build/lib/mask/apply.d.ts.map +0 -1
- package/build/lib/mask/apply.js +0 -86
- package/build/lib/mask/apply.js.map +0 -1
- package/build/lib/mask/mask.d.ts +0 -124
- package/build/lib/mask/mask.d.ts.map +0 -1
- package/build/lib/mask/mask.js +0 -137
- package/build/lib/mask/mask.js.map +0 -1
- package/build/lib/mask/mask.test-d.d.ts +0 -2
- package/build/lib/mask/mask.test-d.d.ts.map +0 -1
- package/build/lib/mask/mask.test-d.js +0 -102
- package/build/lib/mask/mask.test-d.js.map +0 -1
- package/build/lib/version-selection/$$.d.ts +0 -2
- package/build/lib/version-selection/$$.d.ts.map +0 -1
- package/build/lib/version-selection/$$.js +0 -2
- package/build/lib/version-selection/$$.js.map +0 -1
- package/build/lib/version-selection/$.d.ts.map +0 -1
- package/build/lib/version-selection/$.js.map +0 -1
- package/build/lib/version-selection/version-selection.d.ts.map +0 -1
- package/build/lib/version-selection/version-selection.js.map +0 -1
- package/build/sandbox.d.ts +0 -2
- package/build/sandbox.d.ts.map +0 -1
- package/build/sandbox.js +0 -17
- package/build/sandbox.js.map +0 -1
- package/build/template/components/Changelog/Changelog.d.ts +0 -8
- package/build/template/components/Changelog/Changelog.d.ts.map +0 -1
- package/build/template/components/Changelog/Changelog.js.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts +0 -8
- package/build/template/components/Changelog/ChangelogVersionPicker.d.ts.map +0 -1
- package/build/template/components/Changelog/ChangelogVersionPicker.js +0 -16
- package/build/template/components/Changelog/ChangelogVersionPicker.js.map +0 -1
- package/build/template/components/SimpleVersionPicker.d.ts +0 -15
- package/build/template/components/SimpleVersionPicker.d.ts.map +0 -1
- package/build/template/components/SimpleVersionPicker.js +0 -15
- package/build/template/components/SimpleVersionPicker.js.map +0 -1
- package/build/template/routes/changelog.d.ts +0 -1635
- package/build/template/routes/changelog.d.ts.map +0 -1
- package/build/template/routes/changelog.js +0 -168
- package/build/template/routes/changelog.js.map +0 -1
- package/src/lib/graph/$$.ts +0 -1
- package/src/lib/graph/$.ts +0 -1
- package/src/lib/graph/graph.ts +0 -197
- package/src/lib/mask/$$.ts +0 -2
- package/src/lib/mask/$.test.ts +0 -226
- package/src/lib/mask/$.ts +0 -1
- package/src/lib/mask/apply.ts +0 -134
- package/src/lib/mask/mask.test-d.ts +0 -156
- package/src/lib/mask/mask.ts +0 -244
- package/src/lib/version-selection/$$.ts +0 -1
- package/src/sandbox.ts +0 -15
- package/src/template/components/Changelog/ChangelogVersionPicker.tsx +0 -36
- package/src/template/components/SimpleVersionPicker.tsx +0 -48
- package/src/template/routes/changelog.tsx +0 -267
- /package/build/lib/{version-selection → version-coverage}/$.d.ts +0 -0
- /package/build/lib/{version-selection → version-coverage}/$.js +0 -0
- /package/src/lib/{version-selection → version-coverage}/$.ts +0 -0
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"changelog.d.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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;YAqBlB,CAAA"}
|
@@ -1,168 +0,0 @@
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
2
|
-
import { Catalog } from '#lib/catalog';
|
3
|
-
import { Change } from '#lib/change';
|
4
|
-
import { route } from '#lib/react-router-effect/route';
|
5
|
-
import { useLoaderData } from '#lib/react-router-effect/use-loader-data';
|
6
|
-
import { Revision } from '#lib/revision';
|
7
|
-
import { Swiss } from '#lib/swiss';
|
8
|
-
import { Version } from '#lib/version';
|
9
|
-
import { Box, Flex, Text } from '@radix-ui/themes';
|
10
|
-
import { Effect, HashMap, Option } from 'effect';
|
11
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
12
|
-
import { useParams } from 'react-router';
|
13
|
-
import { schemasCatalog } from 'virtual:polen/project/schemas';
|
14
|
-
import { Changelog } from '../components/Changelog/Changelog.js';
|
15
|
-
import { renderDate } from '../components/Changelog/Changelog.js';
|
16
|
-
import { ChangelogVersionPicker } from '../components/Changelog/ChangelogVersionPicker.js';
|
17
|
-
const calculateCounts = (revision) => {
|
18
|
-
return {
|
19
|
-
breaking: revision.changes.filter(Change.isBreaking).length,
|
20
|
-
dangerous: revision.changes.filter(Change.isDangerous).length,
|
21
|
-
safe: revision.changes.filter(Change.isSafe).length,
|
22
|
-
};
|
23
|
-
};
|
24
|
-
const SidebarEntry = ({ revision, counts, isActive }) => {
|
25
|
-
const dateId = revision.date;
|
26
|
-
return (_jsx(Box, { mb: '2', children: _jsxs("a", { href: `#${dateId}`, style: {
|
27
|
-
textDecoration: 'none',
|
28
|
-
display: 'flex',
|
29
|
-
alignItems: 'center',
|
30
|
-
justifyContent: 'space-between',
|
31
|
-
padding: '0.5rem 0.75rem',
|
32
|
-
borderRadius: '4px',
|
33
|
-
backgroundColor: isActive ? 'var(--gray-a3)' : 'transparent',
|
34
|
-
color: 'inherit',
|
35
|
-
transition: 'background-color 0.2s',
|
36
|
-
}, onClick: (e) => {
|
37
|
-
e.preventDefault();
|
38
|
-
// Update URL hash
|
39
|
-
window.history.pushState(null, '', `#${dateId}`);
|
40
|
-
// Dispatch custom event for pushState
|
41
|
-
window.dispatchEvent(new Event('pushstate'));
|
42
|
-
// Smooth scroll to element
|
43
|
-
document.getElementById(dateId)?.scrollIntoView({ behavior: 'smooth' });
|
44
|
-
}, children: [_jsx(Text, { size: '2', weight: isActive ? 'medium' : 'regular', children: renderDate(revision.date) }), _jsxs(Flex, { gap: '2', align: 'center', children: [counts.breaking > 0 && (_jsx(Text, { size: '1', weight: 'medium', style: { color: '#ef4444' }, children: counts.breaking })), counts.dangerous > 0 && (_jsx(Text, { size: '1', weight: 'medium', style: { color: '#f59e0b' }, children: counts.dangerous })), counts.safe > 0 && (_jsx(Text, { size: '1', weight: 'medium', style: { color: '#10b981' }, children: counts.safe }))] })] }) }));
|
45
|
-
};
|
46
|
-
//
|
47
|
-
//
|
48
|
-
//
|
49
|
-
//
|
50
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Schema
|
51
|
-
//
|
52
|
-
//
|
53
|
-
const schema = Catalog.Catalog;
|
54
|
-
//
|
55
|
-
//
|
56
|
-
//
|
57
|
-
//
|
58
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Loader
|
59
|
-
//
|
60
|
-
//
|
61
|
-
const changelogLoader = () => {
|
62
|
-
// This should never be called when schemasCatalog is null
|
63
|
-
// because the route won't be added to the router
|
64
|
-
// But we return an Effect.fail for safety
|
65
|
-
if (!schemasCatalog) {
|
66
|
-
return Effect.fail(new Error('No schema catalog available. This page requires a GraphQL schema to be configured. '
|
67
|
-
+ 'Please ensure your Polen configuration includes a valid schema source.'));
|
68
|
-
}
|
69
|
-
return Effect.succeed(schemasCatalog);
|
70
|
-
};
|
71
|
-
//
|
72
|
-
//
|
73
|
-
//
|
74
|
-
//
|
75
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Component
|
76
|
-
//
|
77
|
-
//
|
78
|
-
const Component = () => {
|
79
|
-
const catalog = useLoaderData(schema);
|
80
|
-
const [activeRevision, setActiveRevision] = useState(null);
|
81
|
-
const params = useParams();
|
82
|
-
const urlVersion = params['version'];
|
83
|
-
// Get available versions if catalog is versioned
|
84
|
-
const availableVersions = useMemo(() => {
|
85
|
-
if (Catalog.Versioned.is(catalog)) {
|
86
|
-
return Catalog.Versioned.getVersions(catalog).map(Version.encodeSync);
|
87
|
-
}
|
88
|
-
return [];
|
89
|
-
}, [catalog]);
|
90
|
-
// Get revisions for the current version (for sidebar)
|
91
|
-
const revisions = useMemo(() => {
|
92
|
-
if (Catalog.Unversioned.is(catalog)) {
|
93
|
-
return catalog.schema.revisions;
|
94
|
-
}
|
95
|
-
else {
|
96
|
-
// For versioned catalogs, show only current version's revisions
|
97
|
-
if (urlVersion) {
|
98
|
-
const entryOption = Option.map(HashMap.findFirst(catalog.entries, (_, key) => Version.encodeSync(key) === urlVersion), ([, value]) => value);
|
99
|
-
return Option.match(entryOption, {
|
100
|
-
onNone: () => [],
|
101
|
-
onSome: (entry) => entry.revisions,
|
102
|
-
});
|
103
|
-
}
|
104
|
-
// No revisions if no version selected (will redirect)
|
105
|
-
return [];
|
106
|
-
}
|
107
|
-
}, [catalog, urlVersion]);
|
108
|
-
// Calculate counts for all revisions (SSR-safe)
|
109
|
-
const revisionsWithCounts = revisions.map(revision => ({
|
110
|
-
revision,
|
111
|
-
counts: calculateCounts(revision),
|
112
|
-
}));
|
113
|
-
// Track active revision based on URL hash
|
114
|
-
useEffect(() => {
|
115
|
-
const handleHashChange = () => {
|
116
|
-
const hash = window.location.hash.slice(1);
|
117
|
-
setActiveRevision(hash || null);
|
118
|
-
};
|
119
|
-
// Set initial active revision
|
120
|
-
handleHashChange();
|
121
|
-
// Listen for hash changes
|
122
|
-
window.addEventListener('hashchange', handleHashChange);
|
123
|
-
// Listen for pushState/replaceState (custom event we'll dispatch)
|
124
|
-
window.addEventListener('pushstate', handleHashChange);
|
125
|
-
return () => {
|
126
|
-
window.removeEventListener('hashchange', handleHashChange);
|
127
|
-
window.removeEventListener('pushstate', handleHashChange);
|
128
|
-
};
|
129
|
-
}, []);
|
130
|
-
return (_jsxs(Swiss.Body, { subgrid: true, children: [_jsxs(Swiss.Item, { cols: 4, style: {
|
131
|
-
position: 'sticky',
|
132
|
-
top: '2rem',
|
133
|
-
height: 'fit-content',
|
134
|
-
minWidth: '250px',
|
135
|
-
maxHeight: 'calc(100vh - 4rem)',
|
136
|
-
overflowY: 'auto',
|
137
|
-
}, children: [Catalog.Versioned.is(catalog) && availableVersions.length > 1 && urlVersion && (_jsx(Box, { mb: '3', children: _jsx(ChangelogVersionPicker, { versions: availableVersions, currentVersion: urlVersion }) })), _jsx(Text, { size: '2', weight: 'medium', mb: '3', style: { display: 'block' }, children: "Revisions" }), revisionsWithCounts.map(({ revision, counts }) => (_jsx(SidebarEntry, { revision: revision, counts: counts, isActive: activeRevision === revision.date }, revision.date)))] }), _jsx(Swiss.Item, { start: 6, cols: 7, children: _jsx(Changelog, { catalog: catalog }) })] }));
|
138
|
-
};
|
139
|
-
//
|
140
|
-
//
|
141
|
-
//
|
142
|
-
//
|
143
|
-
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ • Routes
|
144
|
-
//
|
145
|
-
//
|
146
|
-
export const changelog = !schemasCatalog
|
147
|
-
? null
|
148
|
-
: route({
|
149
|
-
schema,
|
150
|
-
path: `changelog`,
|
151
|
-
loader: changelogLoader,
|
152
|
-
Component,
|
153
|
-
children: [
|
154
|
-
// Support deep linking to specific version
|
155
|
-
route({
|
156
|
-
path: `version/:version`,
|
157
|
-
loader: changelogLoader,
|
158
|
-
Component,
|
159
|
-
}),
|
160
|
-
// Support deep linking to specific version/revision
|
161
|
-
route({
|
162
|
-
path: `version/:version/revision/:revision`,
|
163
|
-
loader: changelogLoader,
|
164
|
-
Component,
|
165
|
-
}),
|
166
|
-
],
|
167
|
-
});
|
168
|
-
//# sourceMappingURL=changelog.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"file":"changelog.js","sourceRoot":"","sources":["../../../src/template/routes/changelog.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AACtC,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACpC,OAAO,EAAE,KAAK,EAAE,MAAM,gCAAgC,CAAA;AACtD,OAAO,EAAE,aAAa,EAAE,MAAM,0CAA0C,CAAA;AACxE,OAAO,EAAE,QAAQ,EAAE,MAAM,eA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EAAC,GAAG,EAAC,MAAM,EAAC,QAAQ,EAAC,EAAE,EAAC,GAAG,EAAC,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,0BAE1D,EACN,mBAAmB,CAAC,GAAG,CAAC,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,CACjD,KAAC,YAAY,IAEX,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,cAAc,KAAK,QAAQ,CAAC,IAAI,IAHrC,QAAQ,CAAC,IAAI,CAIlB,CACH,CAAC,IACS,EAGb,KAAC,KAAK,CAAC,IAAI,IAAC,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,YAC3B,KAAC,SAAS,IAAC,OAAO,EAAE,OAAO,GAAI,GACpB,IACF,CACd,CAAA;AACH,CAAC,CAAA;AAED,EAAE;AACF,EAAE;AACF,EAAE;AACF,EAAE;AACF,sDAAsD;AACtD,EAAE;AACF,EAAE;AAEF,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,cAAc;IACtC,CAAC,CAAC,IAAI;IACN,CAAC,CAAC,KAAK,CAAC;QACN,MAAM;QACN,IAAI,EAAE,WAAW;QACjB,MAAM,EAAE,eAAe;QACvB,SAAS;QACT,QAAQ,EAAE;YACR,2CAA2C;YAC3C,KAAK,CAAC;gBACJ,IAAI,EAAE,kBAAkB;gBACxB,MAAM,EAAE,eAAe;gBACvB,SAAS;aACV,CAAC;YACF,oDAAoD;YACpD,KAAK,CAAC;gBACJ,IAAI,EAAE,qCAAqC;gBAC3C,MAAM,EAAE,eAAe;gBACvB,SAAS;aACV,CAAC;SACH;KACF,CAAC,CAAA"}
|
package/src/lib/graph/$$.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * from './graph.js'
|
package/src/lib/graph/$.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * as Graph from './$$.js'
|
package/src/lib/graph/graph.ts
DELETED
@@ -1,197 +0,0 @@
|
|
1
|
-
import { S } from '#lib/kit-temp/effect'
|
2
|
-
|
3
|
-
// ─── Schema ──────────────────────────────────────────────────────────────────
|
4
|
-
|
5
|
-
/**
|
6
|
-
* Dependency graph for tracking relationships between nodes
|
7
|
-
* Used to efficiently handle dependencies in various contexts
|
8
|
-
*/
|
9
|
-
export const DependencyGraph = S.Struct({
|
10
|
-
/**
|
11
|
-
* Map from parent ID to array of child IDs (parent depends on children)
|
12
|
-
*/
|
13
|
-
dependencies: S.Record({ key: S.String, value: S.Array(S.String) }),
|
14
|
-
|
15
|
-
/**
|
16
|
-
* Map from child ID to array of parent IDs (child is depended on by parents)
|
17
|
-
*/
|
18
|
-
dependents: S.Record({ key: S.String, value: S.Array(S.String) }),
|
19
|
-
}).annotations({
|
20
|
-
identifier: 'DependencyGraph',
|
21
|
-
description: 'A directed graph tracking dependencies between nodes',
|
22
|
-
})
|
23
|
-
|
24
|
-
export type DependencyGraph = typeof DependencyGraph.Type
|
25
|
-
|
26
|
-
// ─── Constructors ────────────────────────────────────────────────────────────
|
27
|
-
|
28
|
-
export const make = DependencyGraph.make
|
29
|
-
|
30
|
-
/**
|
31
|
-
* Create an empty dependency graph
|
32
|
-
*/
|
33
|
-
export const create = (): DependencyGraph =>
|
34
|
-
make({
|
35
|
-
dependencies: {},
|
36
|
-
dependents: {},
|
37
|
-
})
|
38
|
-
|
39
|
-
// ─── Domain Logic ────────────────────────────────────────────────────────────
|
40
|
-
|
41
|
-
/**
|
42
|
-
* Add a dependency relationship (immutable)
|
43
|
-
* @param graph - The dependency graph
|
44
|
-
* @param parent - The parent node ID
|
45
|
-
* @param child - The child node ID that the parent depends on
|
46
|
-
* @returns A new graph with the dependency added
|
47
|
-
*/
|
48
|
-
export const addDependency = (
|
49
|
-
graph: DependencyGraph,
|
50
|
-
parent: string,
|
51
|
-
child: string,
|
52
|
-
): DependencyGraph => {
|
53
|
-
// Get existing arrays or create empty ones
|
54
|
-
const children = graph.dependencies[parent] || []
|
55
|
-
const parents = graph.dependents[child] || []
|
56
|
-
|
57
|
-
// Add child if not already present
|
58
|
-
const newChildren = children.includes(child) ? children : [...children, child]
|
59
|
-
|
60
|
-
// Add parent if not already present
|
61
|
-
const newParents = parents.includes(parent) ? parents : [...parents, parent]
|
62
|
-
|
63
|
-
return make({
|
64
|
-
dependencies: {
|
65
|
-
...graph.dependencies,
|
66
|
-
[parent]: newChildren,
|
67
|
-
},
|
68
|
-
dependents: {
|
69
|
-
...graph.dependents,
|
70
|
-
[child]: newParents,
|
71
|
-
},
|
72
|
-
})
|
73
|
-
}
|
74
|
-
|
75
|
-
/**
|
76
|
-
* Add a dependency relationship (mutable)
|
77
|
-
* @param graph - The dependency graph to mutate
|
78
|
-
* @param parent - The parent node ID
|
79
|
-
* @param child - The child node ID that the parent depends on
|
80
|
-
*/
|
81
|
-
export const addDependencyMutable = (
|
82
|
-
graph: DependencyGraph,
|
83
|
-
parent: string,
|
84
|
-
child: string,
|
85
|
-
): void => {
|
86
|
-
// Cast to mutable for mutation
|
87
|
-
const mutableGraph = graph as {
|
88
|
-
dependencies: Record<string, string[]>
|
89
|
-
dependents: Record<string, string[]>
|
90
|
-
}
|
91
|
-
|
92
|
-
// Add to dependencies
|
93
|
-
if (!mutableGraph.dependencies[parent]) {
|
94
|
-
mutableGraph.dependencies[parent] = []
|
95
|
-
}
|
96
|
-
if (!mutableGraph.dependencies[parent].includes(child)) {
|
97
|
-
mutableGraph.dependencies[parent].push(child)
|
98
|
-
}
|
99
|
-
|
100
|
-
// Add to dependents
|
101
|
-
if (!mutableGraph.dependents[child]) {
|
102
|
-
mutableGraph.dependents[child] = []
|
103
|
-
}
|
104
|
-
if (!mutableGraph.dependents[child].includes(parent)) {
|
105
|
-
mutableGraph.dependents[child].push(parent)
|
106
|
-
}
|
107
|
-
}
|
108
|
-
|
109
|
-
/**
|
110
|
-
* Find all nodes that have no dependencies (leaf nodes)
|
111
|
-
*/
|
112
|
-
export const findLeafNodes = (graph: DependencyGraph): Set<string> => {
|
113
|
-
const leaves = new Set<string>()
|
114
|
-
|
115
|
-
// Check all nodes that appear as children
|
116
|
-
for (const child of Object.keys(graph.dependents)) {
|
117
|
-
const deps = graph.dependencies[child]
|
118
|
-
if (!deps || deps.length === 0) {
|
119
|
-
leaves.add(child)
|
120
|
-
}
|
121
|
-
}
|
122
|
-
|
123
|
-
return leaves
|
124
|
-
}
|
125
|
-
|
126
|
-
/**
|
127
|
-
* Check if all dependencies of a node have been processed
|
128
|
-
*/
|
129
|
-
export const areDependenciesReady = (
|
130
|
-
node: string,
|
131
|
-
graph: DependencyGraph,
|
132
|
-
processed: Set<string>,
|
133
|
-
): boolean => {
|
134
|
-
const deps = graph.dependencies[node]
|
135
|
-
if (!deps) return true
|
136
|
-
|
137
|
-
return deps.every(dep => processed.has(dep))
|
138
|
-
}
|
139
|
-
|
140
|
-
/**
|
141
|
-
* Get topological ordering of nodes (children before parents)
|
142
|
-
* This ensures we process dependencies before the nodes that depend on them
|
143
|
-
*
|
144
|
-
* @param graph - The dependency graph
|
145
|
-
* @returns Array of node IDs in topological order
|
146
|
-
*/
|
147
|
-
export const topologicalSort = (graph: DependencyGraph): string[] => {
|
148
|
-
const result: string[] = []
|
149
|
-
const visited = new Set<string>()
|
150
|
-
const visiting = new Set<string>() // For cycle detection
|
151
|
-
|
152
|
-
// Get all nodes
|
153
|
-
const allNodes = new Set<string>()
|
154
|
-
for (const parent of Object.keys(graph.dependencies)) {
|
155
|
-
allNodes.add(parent)
|
156
|
-
}
|
157
|
-
for (const child of Object.keys(graph.dependents)) {
|
158
|
-
allNodes.add(child)
|
159
|
-
}
|
160
|
-
|
161
|
-
const visit = (node: string): void => {
|
162
|
-
if (visited.has(node)) return
|
163
|
-
|
164
|
-
if (visiting.has(node)) {
|
165
|
-
// Cycle detected - just skip this node
|
166
|
-
return
|
167
|
-
}
|
168
|
-
|
169
|
-
visiting.add(node)
|
170
|
-
|
171
|
-
// Visit all children first
|
172
|
-
const children = graph.dependencies[node]
|
173
|
-
if (children) {
|
174
|
-
for (const child of children) {
|
175
|
-
visit(child)
|
176
|
-
}
|
177
|
-
}
|
178
|
-
|
179
|
-
visiting.delete(node)
|
180
|
-
visited.add(node)
|
181
|
-
result.push(node)
|
182
|
-
}
|
183
|
-
|
184
|
-
// Visit all nodes
|
185
|
-
for (const node of allNodes) {
|
186
|
-
visit(node)
|
187
|
-
}
|
188
|
-
|
189
|
-
return result
|
190
|
-
}
|
191
|
-
|
192
|
-
// ─── Codec ───────────────────────────────────────────────────────────────────
|
193
|
-
|
194
|
-
export const decode = S.decode(DependencyGraph)
|
195
|
-
export const decodeSync = S.decodeSync(DependencyGraph)
|
196
|
-
export const encode = S.encode(DependencyGraph)
|
197
|
-
export const encodeSync = S.encodeSync(DependencyGraph)
|
package/src/lib/mask/$$.ts
DELETED
package/src/lib/mask/$.test.ts
DELETED
@@ -1,226 +0,0 @@
|
|
1
|
-
import * as fc from 'fast-check'
|
2
|
-
import { describe, expect, test } from 'vitest'
|
3
|
-
import { Test } from '../../../tests/unit/helpers/test.js'
|
4
|
-
import { Mask } from './$.js'
|
5
|
-
|
6
|
-
// dprint-ignore
|
7
|
-
Test.suite<{ options: any; expectedType: 'binary' | 'properties'; expectedMode?: 'allow' | 'deny'; expectedShow?: boolean; expectedProperties?: string[] }>('Mask.create', [
|
8
|
-
{ name: 'boolean true creates binary show mask', options: true, expectedType: 'binary', expectedShow: true },
|
9
|
-
{ name: 'boolean false creates binary hide mask', options: false, expectedType: 'binary', expectedShow: false },
|
10
|
-
{ name: 'array creates allow mode properties mask', options: ['name', 'age'], expectedType: 'properties', expectedMode: 'allow', expectedProperties: ['name', 'age'] },
|
11
|
-
{ name: 'object with true values creates allow mode', options: { name: true, age: true, password: false }, expectedType: 'properties', expectedMode: 'allow', expectedProperties: ['name', 'age'] },
|
12
|
-
{ name: 'object with false values creates deny mode', options: { password: false, secret: false }, expectedType: 'properties', expectedMode: 'deny', expectedProperties: ['password', 'secret'] },
|
13
|
-
], ({ options, expectedType, expectedMode, expectedShow, expectedProperties }) => {
|
14
|
-
const mask = Mask.create(options)
|
15
|
-
expect(mask.type).toBe(expectedType)
|
16
|
-
|
17
|
-
if (expectedType === 'binary' && mask.type === 'binary') {
|
18
|
-
expect(mask.show).toBe(expectedShow)
|
19
|
-
}
|
20
|
-
|
21
|
-
if (expectedType === 'properties' && mask.type === 'properties') {
|
22
|
-
expect(mask.mode).toBe(expectedMode)
|
23
|
-
expect(mask.properties).toEqual(expectedProperties)
|
24
|
-
}
|
25
|
-
})
|
26
|
-
|
27
|
-
// dprint-ignore
|
28
|
-
Test.suite<{ data: any; maskOptions: any; shouldThrow?: boolean; expected?: any }>('Mask.apply', [
|
29
|
-
{ name: 'binary show mask returns data', data: { a: 1 }, maskOptions: true, expected: { a: 1 } },
|
30
|
-
{ name: 'binary hide mask returns undefined', data: { a: 1 }, maskOptions: false, expected: undefined },
|
31
|
-
{ name: 'allow mode filters properties', data: { name: 'John', age: 30, password: 'secret' }, maskOptions: ['name', 'age'], expected: { name: 'John', age: 30 } },
|
32
|
-
{ name: 'deny mode removes properties', data: { name: 'John', age: 30, password: 'secret' }, maskOptions: { password: false }, expected: { name: 'John', age: 30 } },
|
33
|
-
{ name: 'properties mask throws for string', data: 'string', maskOptions: ['name'], shouldThrow: true },
|
34
|
-
{ name: 'properties mask throws for number', data: 123, maskOptions: ['name'], shouldThrow: true },
|
35
|
-
{ name: 'properties mask throws for null', data: null, maskOptions: ['name'], shouldThrow: true },
|
36
|
-
], ({ data, maskOptions, shouldThrow, expected }) => {
|
37
|
-
const mask = Mask.create(maskOptions)
|
38
|
-
|
39
|
-
if (shouldThrow) {
|
40
|
-
expect(() => Mask.apply(data as any, mask)).toThrow()
|
41
|
-
} else {
|
42
|
-
const result = Mask.apply(data, mask)
|
43
|
-
if (expected === undefined) {
|
44
|
-
expect(result).toBe(undefined)
|
45
|
-
} else {
|
46
|
-
expect(result).toEqual(expected)
|
47
|
-
}
|
48
|
-
}
|
49
|
-
})
|
50
|
-
|
51
|
-
// dprint-ignore
|
52
|
-
Test.suite<{ method: 'applyPartial' | 'applyExact'; data: any; maskOptions: any; expected: any }>('apply variants', [
|
53
|
-
{ name: 'applyPartial allows missing properties', method: 'applyPartial', data: { name: 'John' }, maskOptions: ['name', 'age'], expected: { name: 'John' } },
|
54
|
-
{ name: 'applyPartial with empty object', method: 'applyPartial', data: {}, maskOptions: ['name', 'age'], expected: {} },
|
55
|
-
{ name: 'applyExact with binary show mask', method: 'applyExact', data: 'hello', maskOptions: true, expected: 'hello' },
|
56
|
-
{ name: 'applyExact with binary hide mask', method: 'applyExact', data: 'hello', maskOptions: false, expected: undefined },
|
57
|
-
], ({ method, data, maskOptions, expected }) => {
|
58
|
-
const mask = Mask.create(maskOptions)
|
59
|
-
|
60
|
-
const result = method === 'applyPartial'
|
61
|
-
? Mask.applyPartial(data, mask)
|
62
|
-
: Mask.applyExact(data as any, mask)
|
63
|
-
|
64
|
-
if (expected === undefined) {
|
65
|
-
expect(result).toBe(undefined)
|
66
|
-
} else {
|
67
|
-
expect(result).toEqual(expected)
|
68
|
-
}
|
69
|
-
})
|
70
|
-
|
71
|
-
describe('property-based tests', () => {
|
72
|
-
test('binary masks - invariants', () => {
|
73
|
-
fc.assert(
|
74
|
-
fc.property(fc.anything(), (data) => {
|
75
|
-
expect(Mask.apply(data, Mask.create(true))).toBe(data)
|
76
|
-
expect(Mask.apply(data, Mask.create(false))).toBe(undefined)
|
77
|
-
}),
|
78
|
-
)
|
79
|
-
})
|
80
|
-
|
81
|
-
test('properties mask - allow mode filters correctly', () => {
|
82
|
-
fc.assert(
|
83
|
-
fc.property(
|
84
|
-
fc.dictionary(fc.string(), fc.anything()),
|
85
|
-
fc.array(fc.string(), { minLength: 1 }),
|
86
|
-
(obj, keys) => {
|
87
|
-
const mask = Mask.create(keys)
|
88
|
-
const result = Mask.apply(obj as any, mask)
|
89
|
-
const resultKeys = Object.keys(result as any)
|
90
|
-
|
91
|
-
// Result contains only keys that were in both mask and object
|
92
|
-
expect(resultKeys.every(key => keys.includes(key))).toBe(true)
|
93
|
-
|
94
|
-
// All requested keys that are own properties of obj are in result
|
95
|
-
keys.forEach(key => {
|
96
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
97
|
-
expect(result).toHaveProperty(key, (obj as any)[key])
|
98
|
-
}
|
99
|
-
})
|
100
|
-
},
|
101
|
-
),
|
102
|
-
)
|
103
|
-
})
|
104
|
-
|
105
|
-
test('properties mask - deny mode filters correctly', () => {
|
106
|
-
fc.assert(
|
107
|
-
fc.property(
|
108
|
-
fc.dictionary(fc.string(), fc.anything()),
|
109
|
-
fc.uniqueArray(fc.string(), { minLength: 1 }),
|
110
|
-
(data, keysToRemove) => {
|
111
|
-
const maskSpec = Object.fromEntries(keysToRemove.map(k => [k, false]))
|
112
|
-
const mask = Mask.create(maskSpec)
|
113
|
-
|
114
|
-
expect(mask.type).toBe('properties')
|
115
|
-
if (mask.type !== 'properties') return
|
116
|
-
expect(mask.mode).toBe('deny')
|
117
|
-
|
118
|
-
const result = Mask.apply(data as any, mask)
|
119
|
-
|
120
|
-
// Result should not have any of the denied keys
|
121
|
-
keysToRemove.forEach(key => {
|
122
|
-
expect(Object.prototype.hasOwnProperty.call(result, key)).toBe(false)
|
123
|
-
})
|
124
|
-
|
125
|
-
// Result should have all other keys from data
|
126
|
-
Object.keys(data).forEach(key => {
|
127
|
-
if (!keysToRemove.includes(key)) {
|
128
|
-
expect(Object.prototype.hasOwnProperty.call(result, key)).toBe(true)
|
129
|
-
expect((result as any)[key]).toBe((data as any)[key])
|
130
|
-
}
|
131
|
-
})
|
132
|
-
},
|
133
|
-
),
|
134
|
-
)
|
135
|
-
})
|
136
|
-
|
137
|
-
test('undefined values are preserved', () => {
|
138
|
-
fc.assert(
|
139
|
-
fc.property(
|
140
|
-
fc.record({
|
141
|
-
a: fc.oneof(fc.anything(), fc.constant(undefined)),
|
142
|
-
b: fc.oneof(fc.anything(), fc.constant(undefined)),
|
143
|
-
c: fc.oneof(fc.anything(), fc.constant(undefined)),
|
144
|
-
}),
|
145
|
-
fc.shuffledSubarray(['a', 'b', 'c'], { minLength: 1 }),
|
146
|
-
(obj, keys) => {
|
147
|
-
const result = Mask.apply(obj as any, Mask.create(keys))
|
148
|
-
|
149
|
-
keys.forEach(key => {
|
150
|
-
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
151
|
-
expect(result).toHaveProperty(key)
|
152
|
-
expect((result as any)[key]).toBe((obj as any)[key])
|
153
|
-
}
|
154
|
-
})
|
155
|
-
},
|
156
|
-
),
|
157
|
-
)
|
158
|
-
})
|
159
|
-
|
160
|
-
test('apply and applyPartial are consistent for complete data', () => {
|
161
|
-
fc.assert(
|
162
|
-
fc.property(
|
163
|
-
fc.dictionary(fc.string(), fc.anything()),
|
164
|
-
fc.array(fc.string(), { minLength: 1 }),
|
165
|
-
(data, keys) => {
|
166
|
-
const mask = Mask.create(keys)
|
167
|
-
expect(Mask.apply(data as any, mask)).toEqual(Mask.applyPartial(data as any, mask))
|
168
|
-
},
|
169
|
-
),
|
170
|
-
)
|
171
|
-
})
|
172
|
-
|
173
|
-
test('non-objects throw with properties masks', () => {
|
174
|
-
fc.assert(
|
175
|
-
fc.property(
|
176
|
-
fc.oneof(
|
177
|
-
fc.string(),
|
178
|
-
fc.integer(),
|
179
|
-
fc.boolean(),
|
180
|
-
fc.constant(null),
|
181
|
-
fc.constant(undefined),
|
182
|
-
),
|
183
|
-
fc.array(fc.string(), { minLength: 1 }),
|
184
|
-
(nonObject, keys) => {
|
185
|
-
const mask = Mask.create(keys)
|
186
|
-
expect(() => Mask.apply(nonObject as any, mask)).toThrow('Cannot apply properties mask to non-object data')
|
187
|
-
},
|
188
|
-
),
|
189
|
-
)
|
190
|
-
})
|
191
|
-
|
192
|
-
test('immutability invariants', () => {
|
193
|
-
fc.assert(
|
194
|
-
fc.property(
|
195
|
-
fc.dictionary(
|
196
|
-
fc.string(),
|
197
|
-
fc.oneof(
|
198
|
-
fc.string(),
|
199
|
-
fc.integer(),
|
200
|
-
fc.boolean(),
|
201
|
-
fc.constant(null),
|
202
|
-
),
|
203
|
-
),
|
204
|
-
fc.oneof(
|
205
|
-
fc.boolean(),
|
206
|
-
fc.array(fc.string()),
|
207
|
-
fc.dictionary(fc.string(), fc.boolean()),
|
208
|
-
),
|
209
|
-
(data, maskOptions) => {
|
210
|
-
const mask = Mask.create(maskOptions as any)
|
211
|
-
const originalData = { ...data }
|
212
|
-
const originalMask = JSON.parse(JSON.stringify(mask))
|
213
|
-
|
214
|
-
try {
|
215
|
-
Mask.apply(data as any, mask)
|
216
|
-
} catch {
|
217
|
-
// Ignore errors for invalid combinations
|
218
|
-
}
|
219
|
-
|
220
|
-
expect(data).toEqual(originalData)
|
221
|
-
expect(mask).toEqual(originalMask)
|
222
|
-
},
|
223
|
-
),
|
224
|
-
)
|
225
|
-
})
|
226
|
-
})
|
package/src/lib/mask/$.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
export * as Mask from './$$.js'
|