shelving 1.254.0 → 1.255.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/README.md +1 -1
- package/api/cache/APICache.d.ts +9 -9
- package/api/cache/APICache.js +8 -8
- package/api/cache/EndpointCache.d.ts +10 -10
- package/api/cache/EndpointCache.js +10 -10
- package/api/endpoint/Endpoint.d.ts +20 -20
- package/api/endpoint/Endpoint.js +10 -10
- package/api/endpoint/util.d.ts +5 -5
- package/api/provider/APIProvider.d.ts +7 -7
- package/api/provider/APIProvider.js +2 -2
- package/api/provider/CachedAPIProvider.d.ts +7 -7
- package/api/provider/CachedAPIProvider.js +7 -7
- package/api/provider/ClientAPIProvider.d.ts +10 -10
- package/api/provider/ClientAPIProvider.js +9 -9
- package/api/provider/DebugAPIProvider.d.ts +4 -4
- package/api/provider/DebugAPIProvider.js +4 -4
- package/api/provider/JSONAPIProvider.d.ts +2 -2
- package/api/provider/JSONAPIProvider.js +2 -2
- package/api/provider/LoggingAPIProvider.d.ts +2 -2
- package/api/provider/LoggingAPIProvider.js +2 -2
- package/api/provider/MockAPIProvider.d.ts +11 -11
- package/api/provider/MockAPIProvider.js +8 -8
- package/api/provider/MockEndpointAPIProvider.d.ts +1 -1
- package/api/provider/MockEndpointAPIProvider.js +1 -1
- package/api/provider/ThroughAPIProvider.d.ts +8 -8
- package/api/provider/ThroughAPIProvider.js +8 -8
- package/api/provider/ValidationAPIProvider.d.ts +3 -3
- package/api/provider/ValidationAPIProvider.js +3 -3
- package/api/provider/XMLAPIProvider.d.ts +2 -2
- package/api/provider/XMLAPIProvider.js +2 -2
- package/api/store/EndpointStore.d.ts +3 -3
- package/api/store/EndpointStore.js +3 -3
- package/bun/BunPostgreSQLProvider.d.ts +4 -4
- package/bun/BunPostgreSQLProvider.js +4 -4
- package/cloudflare/CloudflareD1Provider.d.ts +3 -3
- package/cloudflare/CloudflareD1Provider.js +3 -3
- package/cloudflare/CloudflareKVProvider.d.ts +13 -13
- package/cloudflare/CloudflareKVProvider.js +13 -13
- package/cloudflare/types.d.ts +7 -7
- package/db/cache/CollectionCache.d.ts +11 -11
- package/db/cache/CollectionCache.js +11 -11
- package/db/cache/DBCache.d.ts +11 -11
- package/db/cache/DBCache.js +10 -10
- package/db/collection/Collection.d.ts +16 -16
- package/db/collection/Collection.js +7 -7
- package/db/migrate/DBMigrator.d.ts +3 -3
- package/db/migrate/DBMigrator.js +2 -2
- package/db/migrate/PostgreSQLMigrator.d.ts +1 -1
- package/db/migrate/PostgreSQLMigrator.js +1 -1
- package/db/migrate/SQLMigrator.d.ts +9 -9
- package/db/migrate/SQLMigrator.js +6 -6
- package/db/migrate/SQLiteMigrator.d.ts +1 -1
- package/db/migrate/SQLiteMigrator.js +1 -1
- package/db/provider/CacheDBProvider.d.ts +15 -15
- package/db/provider/CacheDBProvider.js +15 -15
- package/db/provider/ChangesDBProvider.d.ts +10 -10
- package/db/provider/ChangesDBProvider.js +9 -9
- package/db/provider/DBProvider.d.ts +16 -16
- package/db/provider/DBProvider.js +5 -5
- package/db/provider/DebugDBProvider.d.ts +13 -13
- package/db/provider/DebugDBProvider.js +13 -13
- package/db/provider/MemoryDBProvider.d.ts +31 -31
- package/db/provider/MemoryDBProvider.js +31 -31
- package/db/provider/MockDBProvider.d.ts +13 -13
- package/db/provider/MockDBProvider.js +12 -12
- package/db/provider/PostgreSQLProvider.d.ts +4 -4
- package/db/provider/PostgreSQLProvider.js +4 -4
- package/db/provider/SQLProvider.d.ts +29 -29
- package/db/provider/SQLProvider.js +27 -27
- package/db/provider/SQLiteProvider.d.ts +5 -5
- package/db/provider/SQLiteProvider.js +5 -5
- package/db/provider/ThroughDBProvider.d.ts +17 -17
- package/db/provider/ThroughDBProvider.js +17 -17
- package/db/provider/ValidationDBProvider.d.ts +12 -12
- package/db/provider/ValidationDBProvider.js +12 -12
- package/db/store/ItemStore.d.ts +5 -5
- package/db/store/ItemStore.js +5 -5
- package/db/store/QueryStore.d.ts +10 -10
- package/db/store/QueryStore.js +10 -10
- package/error/BaseError.d.ts +3 -3
- package/error/BaseError.js +1 -1
- package/error/Errors.d.ts +1 -1
- package/error/Errors.js +1 -1
- package/error/NetworkError.d.ts +1 -1
- package/error/NetworkError.js +1 -1
- package/error/RequestError.d.ts +7 -7
- package/error/RequestError.js +7 -7
- package/error/RequiredError.d.ts +1 -1
- package/error/RequiredError.js +1 -1
- package/error/ResponseError.d.ts +2 -2
- package/error/ResponseError.js +2 -2
- package/error/UnexpectedError.d.ts +1 -1
- package/error/UnexpectedError.js +1 -1
- package/error/UnimplementedError.d.ts +1 -1
- package/error/UnimplementedError.js +1 -1
- package/error/ValueError.d.ts +1 -1
- package/error/ValueError.js +1 -1
- package/extract/DirectoryExtractor.d.ts +3 -3
- package/extract/DirectoryExtractor.js +2 -2
- package/extract/Extractor.d.ts +3 -3
- package/extract/Extractor.js +1 -1
- package/extract/FileExtractor.d.ts +3 -3
- package/extract/FileExtractor.js +3 -3
- package/extract/IndexExtractor.d.ts +3 -3
- package/extract/IndexExtractor.js +2 -2
- package/extract/MarkupExtractor.d.ts +3 -3
- package/extract/MarkupExtractor.js +3 -3
- package/extract/MergingExtractor.d.ts +3 -3
- package/extract/MergingExtractor.js +2 -2
- package/extract/ModuleExtractor.d.ts +3 -3
- package/extract/ModuleExtractor.js +2 -2
- package/extract/PackageExtractor.d.ts +3 -3
- package/extract/PackageExtractor.js +2 -2
- package/extract/ThroughExtractor.d.ts +4 -4
- package/extract/ThroughExtractor.js +4 -4
- package/extract/TypescriptExtractor.d.ts +2 -2
- package/extract/TypescriptExtractor.js +2 -2
- package/firestore/client/FirestoreClientProvider.d.ts +14 -14
- package/firestore/client/FirestoreClientProvider.js +14 -14
- package/firestore/lite/FirestoreLiteProvider.d.ts +14 -14
- package/firestore/lite/FirestoreLiteProvider.js +14 -14
- package/firestore/server/FirestoreServerProvider.d.ts +14 -14
- package/firestore/server/FirestoreServerProvider.js +14 -14
- package/markup/MarkupParser.d.ts +14 -14
- package/markup/MarkupParser.js +13 -13
- package/markup/MarkupRule.d.ts +4 -4
- package/markup/Parser.d.ts +2 -2
- package/markup/Parser.js +1 -1
- package/markup/rule/blockquote.d.ts +1 -1
- package/markup/rule/blockquote.js +1 -1
- package/markup/rule/code.d.ts +1 -1
- package/markup/rule/code.js +1 -1
- package/markup/rule/fenced.d.ts +1 -1
- package/markup/rule/fenced.js +1 -1
- package/markup/rule/heading.d.ts +1 -1
- package/markup/rule/heading.js +1 -1
- package/markup/rule/index.d.ts +3 -3
- package/markup/rule/index.js +3 -3
- package/markup/rule/inline.d.ts +1 -1
- package/markup/rule/inline.js +1 -1
- package/markup/rule/linebreak.d.ts +1 -1
- package/markup/rule/linebreak.js +1 -1
- package/markup/rule/link.d.ts +2 -2
- package/markup/rule/link.js +2 -2
- package/markup/rule/ordered.d.ts +1 -1
- package/markup/rule/ordered.js +1 -1
- package/markup/rule/paragraph.d.ts +1 -1
- package/markup/rule/paragraph.js +1 -1
- package/markup/rule/separator.d.ts +1 -1
- package/markup/rule/separator.js +1 -1
- package/markup/rule/table.d.ts +1 -1
- package/markup/rule/table.js +1 -1
- package/markup/rule/unordered.d.ts +1 -1
- package/markup/rule/unordered.js +1 -1
- package/markup/util/regexp.d.ts +14 -14
- package/markup/util/regexp.js +11 -11
- package/package.json +1 -1
- package/react/createAPIContext.d.ts +2 -2
- package/react/createAPIContext.js +1 -1
- package/react/createDBContext.d.ts +2 -2
- package/react/createDBContext.js +1 -1
- package/react/useInstance.d.ts +1 -1
- package/react/useInstance.js +1 -1
- package/react/useLazy.d.ts +1 -1
- package/react/useMap.d.ts +1 -1
- package/react/useMap.js +1 -1
- package/react/useReduce.d.ts +1 -1
- package/react/useSequence.d.ts +1 -1
- package/react/useSequence.js +1 -1
- package/react/useStore.d.ts +1 -1
- package/schema/AddressSchema.d.ts +5 -5
- package/schema/AddressSchema.js +4 -4
- package/schema/ArraySchema.d.ts +5 -5
- package/schema/ArraySchema.js +4 -4
- package/schema/BooleanSchema.d.ts +5 -5
- package/schema/BooleanSchema.js +4 -4
- package/schema/ChoiceSchema.d.ts +7 -7
- package/schema/ChoiceSchema.js +4 -4
- package/schema/ColorSchema.d.ts +5 -5
- package/schema/ColorSchema.js +4 -4
- package/schema/CountrySchema.d.ts +6 -6
- package/schema/CountrySchema.js +5 -5
- package/schema/CurrencyAmountSchema.d.ts +14 -14
- package/schema/CurrencyAmountSchema.js +12 -12
- package/schema/CurrencyCodeSchema.d.ts +8 -8
- package/schema/CurrencyCodeSchema.js +7 -7
- package/schema/DataSchema.d.ts +10 -10
- package/schema/DataSchema.js +8 -8
- package/schema/DateSchema.d.ts +8 -8
- package/schema/DateSchema.js +6 -6
- package/schema/DateTimeSchema.d.ts +5 -5
- package/schema/DateTimeSchema.js +5 -5
- package/schema/DictionarySchema.d.ts +5 -5
- package/schema/DictionarySchema.js +4 -4
- package/schema/EmailSchema.d.ts +5 -5
- package/schema/EmailSchema.js +4 -4
- package/schema/EntitySchema.d.ts +5 -5
- package/schema/EntitySchema.js +4 -4
- package/schema/FileSchema.d.ts +5 -5
- package/schema/FileSchema.js +4 -4
- package/schema/KeySchema.d.ts +4 -4
- package/schema/KeySchema.js +4 -4
- package/schema/NullableSchema.d.ts +5 -5
- package/schema/NullableSchema.js +4 -4
- package/schema/NumberSchema.d.ts +14 -14
- package/schema/NumberSchema.js +13 -13
- package/schema/OptionalSchema.d.ts +5 -5
- package/schema/OptionalSchema.js +4 -4
- package/schema/PasswordSchema.d.ts +3 -3
- package/schema/PasswordSchema.js +3 -3
- package/schema/PhoneSchema.d.ts +5 -5
- package/schema/PhoneSchema.js +4 -4
- package/schema/RequiredSchema.d.ts +3 -3
- package/schema/RequiredSchema.js +3 -3
- package/schema/Schema.d.ts +9 -9
- package/schema/Schema.js +5 -5
- package/schema/SlugSchema.d.ts +5 -5
- package/schema/SlugSchema.js +4 -4
- package/schema/StringSchema.d.ts +12 -12
- package/schema/StringSchema.js +10 -10
- package/schema/ThroughSchema.d.ts +4 -4
- package/schema/ThroughSchema.js +3 -3
- package/schema/TimeSchema.d.ts +5 -5
- package/schema/TimeSchema.js +5 -5
- package/schema/URISchema.d.ts +7 -7
- package/schema/URISchema.js +6 -6
- package/schema/URLSchema.d.ts +7 -7
- package/schema/URLSchema.js +6 -6
- package/schema/UUIDSchema.d.ts +5 -5
- package/schema/UUIDSchema.js +4 -4
- package/sequence/DeferredSequence.d.ts +9 -9
- package/sequence/DeferredSequence.js +7 -7
- package/sequence/InspectSequence.d.ts +9 -9
- package/sequence/InspectSequence.js +9 -9
- package/sequence/LazySequence.d.ts +4 -4
- package/sequence/LazySequence.js +4 -4
- package/sequence/Sequence.d.ts +4 -4
- package/sequence/Sequence.js +3 -3
- package/sequence/ThroughSequence.d.ts +2 -2
- package/sequence/ThroughSequence.js +2 -2
- package/store/ArrayStore.d.ts +11 -11
- package/store/ArrayStore.js +11 -11
- package/store/BooleanStore.d.ts +2 -2
- package/store/BooleanStore.js +2 -2
- package/store/BusyStore.d.ts +2 -2
- package/store/BusyStore.js +2 -2
- package/store/DataStore.d.ts +15 -15
- package/store/DataStore.js +15 -15
- package/store/DictionaryStore.d.ts +8 -8
- package/store/DictionaryStore.js +8 -8
- package/store/FetchStore.d.ts +8 -8
- package/store/FetchStore.js +7 -7
- package/store/PathStore.d.ts +6 -6
- package/store/PathStore.js +6 -6
- package/store/PayloadFetchStore.d.ts +3 -3
- package/store/PayloadFetchStore.js +2 -2
- package/store/Store.d.ts +16 -16
- package/store/Store.js +10 -10
- package/store/URLStore.d.ts +25 -25
- package/store/URLStore.js +25 -25
- package/test/basics.d.ts +14 -14
- package/test/basics.js +12 -12
- package/test/people.d.ts +9 -9
- package/test/people.js +7 -7
- package/test/util.d.ts +3 -3
- package/test/util.js +3 -3
- package/ui/README.md +1 -1
- package/ui/app/App.d.ts +2 -2
- package/ui/app/App.js +1 -1
- package/ui/app/App.tsx +2 -2
- package/ui/block/Address.d.ts +6 -6
- package/ui/block/Address.js +3 -3
- package/ui/block/Address.tsx +6 -6
- package/ui/block/Block.d.ts +6 -5
- package/ui/block/Block.js +4 -3
- package/ui/block/Block.module.css +1 -0
- package/ui/block/Block.tsx +7 -5
- package/ui/block/Blockquote.d.ts +2 -2
- package/ui/block/Blockquote.js +1 -1
- package/ui/block/Blockquote.tsx +2 -2
- package/ui/block/Caption.d.ts +2 -2
- package/ui/block/Caption.js +1 -1
- package/ui/block/Caption.tsx +2 -2
- package/ui/block/Card.d.ts +2 -2
- package/ui/block/Card.js +1 -1
- package/ui/block/Card.module.css +1 -0
- package/ui/block/Card.tsx +2 -2
- package/ui/block/Definitions.d.ts +2 -2
- package/ui/block/Definitions.js +1 -1
- package/ui/block/Definitions.tsx +2 -2
- package/ui/block/Divider.d.ts +2 -2
- package/ui/block/Divider.js +1 -1
- package/ui/block/Divider.tsx +2 -2
- package/ui/block/Heading.d.ts +2 -2
- package/ui/block/Heading.js +1 -1
- package/ui/block/Heading.tsx +2 -2
- package/ui/block/Image.d.ts +2 -2
- package/ui/block/Image.js +1 -1
- package/ui/block/Image.tsx +2 -2
- package/ui/block/Label.d.ts +2 -2
- package/ui/block/Label.js +1 -1
- package/ui/block/Label.tsx +2 -2
- package/ui/block/List.d.ts +2 -2
- package/ui/block/List.js +1 -1
- package/ui/block/List.tsx +2 -2
- package/ui/block/Panel.d.ts +4 -3
- package/ui/block/Panel.js +3 -2
- package/ui/block/Panel.md +4 -2
- package/ui/block/Panel.module.css +7 -1
- package/ui/block/Panel.tsx +5 -3
- package/ui/block/Paragraph.d.ts +3 -3
- package/ui/block/Paragraph.js +2 -2
- package/ui/block/Paragraph.tsx +3 -3
- package/ui/block/Preformatted.d.ts +2 -2
- package/ui/block/Preformatted.js +1 -1
- package/ui/block/Preformatted.tsx +2 -2
- package/ui/block/Prose.d.ts +2 -2
- package/ui/block/Prose.js +1 -1
- package/ui/block/Prose.tsx +2 -2
- package/ui/block/Section.d.ts +9 -8
- package/ui/block/Section.js +8 -7
- package/ui/block/Section.md +3 -4
- package/ui/block/Section.module.css +3 -7
- package/ui/block/Section.tsx +10 -8
- package/ui/block/Subheading.d.ts +2 -2
- package/ui/block/Subheading.js +1 -1
- package/ui/block/Subheading.tsx +2 -2
- package/ui/block/Title.d.ts +2 -2
- package/ui/block/Title.js +1 -1
- package/ui/block/Title.tsx +2 -2
- package/ui/block/Video.d.ts +8 -8
- package/ui/block/Video.js +4 -4
- package/ui/block/Video.tsx +8 -8
- package/ui/dialog/Dialog.d.ts +4 -4
- package/ui/dialog/Dialog.js +2 -2
- package/ui/dialog/Dialog.tsx +4 -4
- package/ui/dialog/Dialogs.d.ts +8 -8
- package/ui/dialog/Dialogs.js +6 -6
- package/ui/dialog/Dialogs.tsx +8 -8
- package/ui/dialog/Modal.d.ts +2 -2
- package/ui/dialog/Modal.js +1 -1
- package/ui/dialog/Modal.tsx +2 -2
- package/ui/docs/DocumentationButtons.d.ts +1 -1
- package/ui/docs/DocumentationButtons.tsx +1 -1
- package/ui/docs/DocumentationCard.d.ts +1 -1
- package/ui/docs/DocumentationCard.js +1 -1
- package/ui/docs/DocumentationCard.tsx +1 -1
- package/ui/docs/DocumentationDescription.d.ts +2 -2
- package/ui/docs/DocumentationDescription.js +1 -1
- package/ui/docs/DocumentationDescription.tsx +2 -2
- package/ui/docs/DocumentationHomePage.d.ts +1 -1
- package/ui/docs/DocumentationHomePage.js +2 -2
- package/ui/docs/DocumentationHomePage.tsx +11 -9
- package/ui/docs/DocumentationKind.d.ts +3 -3
- package/ui/docs/DocumentationKind.js +2 -2
- package/ui/docs/DocumentationKind.tsx +3 -3
- package/ui/docs/DocumentationPage.d.ts +1 -1
- package/ui/docs/DocumentationPage.js +2 -2
- package/ui/docs/DocumentationPage.tsx +29 -27
- package/ui/docs/DocumentationParams.d.ts +2 -2
- package/ui/docs/DocumentationParams.js +1 -1
- package/ui/docs/DocumentationParams.tsx +2 -2
- package/ui/docs/DocumentationProperties.d.ts +2 -2
- package/ui/docs/DocumentationProperties.js +1 -1
- package/ui/docs/DocumentationProperties.tsx +2 -2
- package/ui/docs/DocumentationReferences.d.ts +2 -2
- package/ui/docs/DocumentationReferences.js +1 -1
- package/ui/docs/DocumentationReferences.tsx +2 -2
- package/ui/docs/DocumentationReturns.d.ts +2 -2
- package/ui/docs/DocumentationReturns.js +1 -1
- package/ui/docs/DocumentationReturns.tsx +2 -2
- package/ui/docs/DocumentationSignatures.d.ts +2 -2
- package/ui/docs/DocumentationSignatures.js +1 -1
- package/ui/docs/DocumentationSignatures.tsx +2 -2
- package/ui/docs/DocumentationThrows.d.ts +2 -2
- package/ui/docs/DocumentationThrows.js +1 -1
- package/ui/docs/DocumentationThrows.tsx +2 -2
- package/ui/docs/DocumentationType.d.ts +3 -3
- package/ui/docs/DocumentationType.js +2 -2
- package/ui/docs/DocumentationType.tsx +3 -3
- package/ui/form/ArrayInput.d.ts +2 -2
- package/ui/form/ArrayInput.tsx +2 -2
- package/ui/form/ArrayRadioInputs.d.ts +2 -2
- package/ui/form/ArrayRadioInputs.js +1 -1
- package/ui/form/ArrayRadioInputs.tsx +2 -2
- package/ui/form/Button.d.ts +3 -3
- package/ui/form/Button.js +2 -2
- package/ui/form/Button.module.css +1 -0
- package/ui/form/Button.tsx +3 -3
- package/ui/form/ButtonInput.d.ts +2 -2
- package/ui/form/ButtonInput.js +1 -1
- package/ui/form/ButtonInput.tsx +2 -2
- package/ui/form/ButtonInputPopover.d.ts +2 -2
- package/ui/form/ButtonInputPopover.js +1 -1
- package/ui/form/ButtonInputPopover.tsx +2 -2
- package/ui/form/ButtonPopover.d.ts +2 -2
- package/ui/form/ButtonPopover.js +1 -1
- package/ui/form/ButtonPopover.tsx +2 -2
- package/ui/form/CheckboxInput.d.ts +2 -2
- package/ui/form/CheckboxInput.js +1 -1
- package/ui/form/CheckboxInput.tsx +2 -2
- package/ui/form/ChoiceRadioInputs.d.ts +2 -2
- package/ui/form/ChoiceRadioInputs.tsx +2 -2
- package/ui/form/Clickable.d.ts +7 -7
- package/ui/form/Clickable.js +4 -4
- package/ui/form/Clickable.tsx +7 -7
- package/ui/form/DataInput.d.ts +2 -2
- package/ui/form/DataInput.tsx +2 -2
- package/ui/form/DateInput.d.ts +2 -2
- package/ui/form/DateInput.js +1 -1
- package/ui/form/DateInput.tsx +2 -2
- package/ui/form/DictionaryInput.d.ts +2 -2
- package/ui/form/DictionaryInput.tsx +2 -2
- package/ui/form/Field.d.ts +2 -2
- package/ui/form/Field.js +1 -1
- package/ui/form/Field.tsx +2 -2
- package/ui/form/FileInput.d.ts +2 -2
- package/ui/form/FileInput.js +1 -1
- package/ui/form/FileInput.tsx +2 -2
- package/ui/form/Form.d.ts +8 -7
- package/ui/form/Form.js +10 -7
- package/ui/form/Form.md +1 -1
- package/ui/form/Form.module.css +4 -0
- package/ui/form/Form.tsx +16 -11
- package/ui/form/FormContext.d.ts +3 -3
- package/ui/form/FormContext.js +1 -1
- package/ui/form/FormContext.tsx +3 -3
- package/ui/form/FormFields.d.ts +2 -2
- package/ui/form/FormFields.js +2 -2
- package/ui/form/FormFields.tsx +2 -2
- package/ui/form/FormFooter.d.ts +2 -2
- package/ui/form/FormFooter.js +1 -1
- package/ui/form/FormFooter.tsx +2 -2
- package/ui/form/FormInput.d.ts +3 -3
- package/ui/form/FormInput.js +2 -2
- package/ui/form/FormInput.tsx +3 -3
- package/ui/form/FormMessage.d.ts +1 -1
- package/ui/form/FormMessage.js +1 -1
- package/ui/form/FormMessage.tsx +1 -1
- package/ui/form/FormNotice.d.ts +1 -1
- package/ui/form/FormNotice.js +1 -1
- package/ui/form/FormNotice.tsx +1 -1
- package/ui/form/FormNotify.d.ts +1 -1
- package/ui/form/FormNotify.js +1 -1
- package/ui/form/FormNotify.tsx +1 -1
- package/ui/form/FormStore.d.ts +6 -6
- package/ui/form/FormStore.js +6 -6
- package/ui/form/FormStore.tsx +6 -6
- package/ui/form/Input.d.ts +3 -3
- package/ui/form/Input.js +1 -1
- package/ui/form/Input.tsx +3 -3
- package/ui/form/NumberInput.d.ts +2 -2
- package/ui/form/NumberInput.js +1 -1
- package/ui/form/NumberInput.tsx +2 -2
- package/ui/form/OutputInput.d.ts +2 -2
- package/ui/form/OutputInput.js +1 -1
- package/ui/form/OutputInput.tsx +2 -2
- package/ui/form/Popover.d.ts +3 -3
- package/ui/form/Popover.js +1 -1
- package/ui/form/Popover.tsx +3 -3
- package/ui/form/Progress.d.ts +4 -4
- package/ui/form/Progress.js +2 -2
- package/ui/form/Progress.tsx +4 -4
- package/ui/form/QueryInput.d.ts +2 -2
- package/ui/form/QueryInput.js +1 -1
- package/ui/form/QueryInput.tsx +2 -2
- package/ui/form/RadioInput.d.ts +2 -2
- package/ui/form/RadioInput.js +1 -1
- package/ui/form/RadioInput.tsx +2 -2
- package/ui/form/SchemaInput.d.ts +21 -21
- package/ui/form/SchemaInput.js +10 -10
- package/ui/form/SchemaInput.tsx +21 -21
- package/ui/form/SelectInput.d.ts +2 -2
- package/ui/form/SelectInput.tsx +2 -2
- package/ui/form/SubmitButton.d.ts +2 -2
- package/ui/form/SubmitButton.js +1 -1
- package/ui/form/SubmitButton.tsx +2 -2
- package/ui/form/TextInput.d.ts +2 -2
- package/ui/form/TextInput.js +1 -1
- package/ui/form/TextInput.tsx +2 -2
- package/ui/inline/Code.d.ts +2 -2
- package/ui/inline/Code.js +1 -1
- package/ui/inline/Code.tsx +2 -2
- package/ui/inline/Deleted.d.ts +2 -2
- package/ui/inline/Deleted.js +1 -1
- package/ui/inline/Deleted.tsx +2 -2
- package/ui/inline/Emphasis.d.ts +2 -2
- package/ui/inline/Emphasis.js +1 -1
- package/ui/inline/Emphasis.tsx +2 -2
- package/ui/inline/Inserted.d.ts +2 -2
- package/ui/inline/Inserted.js +1 -1
- package/ui/inline/Inserted.tsx +2 -2
- package/ui/inline/Link.d.ts +2 -2
- package/ui/inline/Link.js +1 -1
- package/ui/inline/Link.tsx +2 -2
- package/ui/inline/Mark.d.ts +2 -2
- package/ui/inline/Mark.js +1 -1
- package/ui/inline/Mark.tsx +2 -2
- package/ui/inline/Small.d.ts +2 -2
- package/ui/inline/Small.js +1 -1
- package/ui/inline/Small.tsx +2 -2
- package/ui/inline/Strong.d.ts +2 -2
- package/ui/inline/Strong.js +1 -1
- package/ui/inline/Strong.tsx +2 -2
- package/ui/inline/Subscript.d.ts +2 -2
- package/ui/inline/Subscript.js +1 -1
- package/ui/inline/Subscript.tsx +2 -2
- package/ui/inline/Superscript.d.ts +2 -2
- package/ui/inline/Superscript.js +1 -1
- package/ui/inline/Superscript.tsx +2 -2
- package/ui/inline/When.d.ts +6 -6
- package/ui/inline/When.js +3 -3
- package/ui/inline/When.tsx +6 -6
- package/ui/layout/CenteredLayout.d.ts +2 -2
- package/ui/layout/CenteredLayout.js +1 -1
- package/ui/layout/CenteredLayout.tsx +2 -2
- package/ui/layout/Layout.d.ts +1 -1
- package/ui/layout/Layout.js +1 -1
- package/ui/layout/Layout.ts +1 -1
- package/ui/layout/SidebarLayout.d.ts +2 -2
- package/ui/layout/SidebarLayout.js +1 -1
- package/ui/layout/SidebarLayout.tsx +2 -2
- package/ui/menu/Menu.d.ts +4 -4
- package/ui/menu/Menu.js +2 -2
- package/ui/menu/Menu.tsx +4 -4
- package/ui/misc/Catcher.d.ts +11 -11
- package/ui/misc/Catcher.js +5 -5
- package/ui/misc/Catcher.tsx +11 -11
- package/ui/misc/Icon.d.ts +4 -4
- package/ui/misc/Icon.js +2 -2
- package/ui/misc/Icon.tsx +4 -4
- package/ui/misc/Loading.d.ts +3 -3
- package/ui/misc/Loading.js +2 -2
- package/ui/misc/Loading.tsx +3 -3
- package/ui/misc/Mapper.d.ts +4 -4
- package/ui/misc/Mapper.js +1 -1
- package/ui/misc/Mapper.tsx +4 -4
- package/ui/misc/Markup.d.ts +2 -2
- package/ui/misc/Markup.js +1 -1
- package/ui/misc/Markup.tsx +2 -2
- package/ui/misc/MetaContext.d.ts +4 -4
- package/ui/misc/MetaContext.js +3 -3
- package/ui/misc/MetaContext.tsx +4 -4
- package/ui/misc/Tag.d.ts +4 -4
- package/ui/misc/Tag.js +2 -2
- package/ui/misc/Tag.tsx +4 -4
- package/ui/notice/Message.d.ts +3 -3
- package/ui/notice/Message.js +2 -2
- package/ui/notice/Message.tsx +3 -3
- package/ui/notice/Notice.d.ts +3 -3
- package/ui/notice/Notice.js +2 -2
- package/ui/notice/Notice.tsx +3 -3
- package/ui/notice/NoticeStore.d.ts +3 -3
- package/ui/notice/NoticeStore.js +3 -3
- package/ui/notice/NoticeStore.ts +3 -3
- package/ui/notice/Notices.d.ts +2 -2
- package/ui/notice/Notices.js +1 -1
- package/ui/notice/Notices.tsx +2 -2
- package/ui/notice/NoticesStore.d.ts +3 -3
- package/ui/notice/NoticesStore.js +3 -3
- package/ui/notice/NoticesStore.ts +3 -3
- package/ui/page/HTML.d.ts +2 -2
- package/ui/page/HTML.js +1 -1
- package/ui/page/HTML.tsx +2 -2
- package/ui/page/Head.d.ts +1 -1
- package/ui/page/Head.js +1 -1
- package/ui/page/Head.tsx +1 -1
- package/ui/page/Page.d.ts +2 -2
- package/ui/page/Page.js +1 -1
- package/ui/page/Page.tsx +2 -2
- package/ui/router/Navigation.d.ts +2 -2
- package/ui/router/Navigation.js +1 -1
- package/ui/router/Navigation.tsx +2 -2
- package/ui/router/NavigationContext.d.ts +2 -2
- package/ui/router/NavigationContext.js +2 -2
- package/ui/router/NavigationContext.tsx +2 -2
- package/ui/router/NavigationStore.d.ts +3 -3
- package/ui/router/NavigationStore.js +3 -3
- package/ui/router/NavigationStore.tsx +3 -3
- package/ui/router/RouteCache.d.ts +2 -2
- package/ui/router/RouteCache.js +1 -1
- package/ui/router/RouteCache.tsx +2 -2
- package/ui/router/Router.d.ts +2 -2
- package/ui/router/Router.js +1 -1
- package/ui/router/Router.tsx +2 -2
- package/ui/router/Routes.d.ts +4 -4
- package/ui/router/Routes.tsx +4 -4
- package/ui/style/Color.d.ts +3 -3
- package/ui/style/Color.js +1 -1
- package/ui/style/Color.tsx +3 -3
- package/ui/style/Duration.d.ts +3 -3
- package/ui/style/Duration.js +1 -1
- package/ui/style/Duration.tsx +3 -3
- package/ui/style/Flex.d.ts +6 -6
- package/ui/style/Flex.js +3 -3
- package/ui/style/Flex.tsx +6 -6
- package/ui/style/Gap.d.ts +3 -3
- package/ui/style/Gap.js +1 -1
- package/ui/style/Gap.tsx +3 -3
- package/ui/style/Indent.d.ts +24 -0
- package/ui/style/Indent.js +13 -0
- package/ui/style/Indent.module.css +62 -0
- package/ui/style/Indent.tsx +49 -0
- package/ui/style/Padding.d.ts +3 -3
- package/ui/style/Padding.js +1 -1
- package/ui/style/Padding.tsx +3 -3
- package/ui/style/Radius.d.ts +3 -3
- package/ui/style/Radius.js +1 -1
- package/ui/style/Radius.tsx +3 -3
- package/ui/style/Scroll.d.ts +4 -4
- package/ui/style/Scroll.js +2 -2
- package/ui/style/Scroll.tsx +4 -4
- package/ui/style/Shadow.d.ts +3 -3
- package/ui/style/Shadow.js +1 -1
- package/ui/style/Shadow.tsx +3 -3
- package/ui/style/Space.d.ts +3 -3
- package/ui/style/Space.js +1 -1
- package/ui/style/Space.tsx +3 -3
- package/ui/style/Status.d.ts +4 -4
- package/ui/style/Status.js +2 -2
- package/ui/style/Status.tsx +4 -4
- package/ui/style/Stroke.d.ts +3 -3
- package/ui/style/Stroke.js +1 -1
- package/ui/style/Stroke.tsx +3 -3
- package/ui/style/Tint.d.ts +2 -2
- package/ui/style/Tint.js +1 -1
- package/ui/style/Tint.tsx +2 -2
- package/ui/style/Typography.d.ts +6 -6
- package/ui/style/Typography.js +1 -1
- package/ui/style/Typography.tsx +6 -6
- package/ui/style/Width.d.ts +3 -3
- package/ui/style/Width.js +1 -1
- package/ui/style/Width.tsx +3 -3
- package/ui/style/getSpaceClass.md +2 -2
- package/ui/style/index.d.ts +1 -0
- package/ui/style/index.js +1 -0
- package/ui/style/index.tsx +1 -0
- package/ui/table/Cell.d.ts +2 -2
- package/ui/table/Cell.js +1 -1
- package/ui/table/Cell.tsx +2 -2
- package/ui/table/Table.d.ts +2 -2
- package/ui/table/Table.js +1 -1
- package/ui/table/Table.tsx +2 -2
- package/ui/transition/CollapseTransition.d.ts +2 -2
- package/ui/transition/CollapseTransition.js +1 -1
- package/ui/transition/CollapseTransition.tsx +2 -2
- package/ui/transition/FadeTransition.d.ts +2 -2
- package/ui/transition/FadeTransition.js +1 -1
- package/ui/transition/FadeTransition.tsx +2 -2
- package/ui/transition/HorizontalTransition.d.ts +2 -2
- package/ui/transition/HorizontalTransition.js +1 -1
- package/ui/transition/HorizontalTransition.tsx +2 -2
- package/ui/transition/Transition.d.ts +2 -2
- package/ui/transition/Transition.js +1 -1
- package/ui/transition/Transition.tsx +2 -2
- package/ui/transition/VerticalTransition.d.ts +2 -2
- package/ui/transition/VerticalTransition.js +1 -1
- package/ui/transition/VerticalTransition.tsx +2 -2
- package/ui/transition/util.d.ts +3 -3
- package/ui/transition/util.js +1 -1
- package/ui/transition/util.tsx +3 -3
- package/ui/tree/TreeApp.d.ts +2 -2
- package/ui/tree/TreeApp.js +1 -1
- package/ui/tree/TreeApp.tsx +2 -2
- package/ui/tree/TreeBreadcrumbs.d.ts +2 -2
- package/ui/tree/TreeBreadcrumbs.js +1 -1
- package/ui/tree/TreeBreadcrumbs.tsx +2 -2
- package/ui/tree/TreeButton.d.ts +2 -2
- package/ui/tree/TreeButton.js +1 -1
- package/ui/tree/TreeButton.tsx +2 -2
- package/ui/tree/TreeCard.d.ts +1 -1
- package/ui/tree/TreeCard.js +1 -1
- package/ui/tree/TreeCard.tsx +1 -1
- package/ui/tree/TreeCards.d.ts +3 -3
- package/ui/tree/TreeCards.js +2 -2
- package/ui/tree/TreeCards.tsx +3 -3
- package/ui/tree/TreeContext.d.ts +4 -4
- package/ui/tree/TreeContext.js +4 -4
- package/ui/tree/TreeContext.tsx +4 -4
- package/ui/tree/TreeIndexPage.d.ts +1 -1
- package/ui/tree/TreeIndexPage.js +3 -2
- package/ui/tree/TreeIndexPage.tsx +28 -25
- package/ui/tree/TreeLink.d.ts +2 -2
- package/ui/tree/TreeLink.js +1 -1
- package/ui/tree/TreeLink.tsx +2 -2
- package/ui/tree/TreeMarkup.d.ts +3 -3
- package/ui/tree/TreeMarkup.js +3 -3
- package/ui/tree/TreeMarkup.tsx +3 -3
- package/ui/tree/TreeMenu.d.ts +5 -5
- package/ui/tree/TreeMenu.js +4 -4
- package/ui/tree/TreeMenu.tsx +5 -5
- package/ui/tree/TreePage.d.ts +1 -1
- package/ui/tree/TreePage.js +3 -2
- package/ui/tree/TreePage.tsx +17 -14
- package/ui/tree/TreeRouter.d.ts +3 -3
- package/ui/tree/TreeRouter.js +2 -2
- package/ui/tree/TreeRouter.tsx +3 -3
- package/ui/tree/TreeSidebar.d.ts +2 -2
- package/ui/tree/TreeSidebar.js +1 -1
- package/ui/tree/TreeSidebar.tsx +2 -2
- package/ui/util/context.d.ts +1 -1
- package/ui/util/context.ts +1 -1
- package/ui/util/css.d.ts +5 -5
- package/ui/util/css.js +2 -2
- package/ui/util/css.ts +5 -5
- package/ui/util/event.d.ts +1 -1
- package/ui/util/event.js +1 -1
- package/ui/util/event.ts +1 -1
- package/ui/util/focus.d.ts +3 -3
- package/ui/util/focus.js +3 -3
- package/ui/util/focus.ts +3 -3
- package/ui/util/meta.d.ts +16 -16
- package/ui/util/meta.js +8 -8
- package/ui/util/meta.ts +16 -16
- package/ui/util/notice.d.ts +10 -10
- package/ui/util/notice.js +9 -9
- package/ui/util/notice.ts +10 -10
- package/ui/util/props.d.ts +2 -2
- package/ui/util/props.ts +2 -2
- package/ui/util/refresh.d.ts +1 -1
- package/ui/util/refresh.js +1 -1
- package/ui/util/refresh.ts +1 -1
- package/ui/util/scroll.d.ts +2 -2
- package/ui/util/scroll.js +2 -2
- package/ui/util/scroll.ts +2 -2
- package/ui/util/state.d.ts +2 -2
- package/ui/util/state.js +2 -2
- package/ui/util/state.ts +2 -2
- package/util/ansi.d.ts +24 -24
- package/util/ansi.js +23 -23
- package/util/array.d.ts +37 -37
- package/util/array.js +29 -29
- package/util/async.d.ts +15 -15
- package/util/async.js +13 -13
- package/util/base64.d.ts +6 -6
- package/util/base64.js +6 -6
- package/util/boolean.d.ts +10 -10
- package/util/boolean.js +10 -10
- package/util/buffer.d.ts +4 -4
- package/util/buffer.js +3 -3
- package/util/bytes.d.ts +6 -6
- package/util/bytes.js +4 -4
- package/util/class.d.ts +8 -8
- package/util/class.js +5 -5
- package/util/color.d.ts +21 -21
- package/util/color.js +20 -20
- package/util/constants.d.ts +26 -26
- package/util/constants.js +26 -26
- package/util/crypto.d.ts +3 -3
- package/util/crypto.js +3 -3
- package/util/currency.d.ts +6 -6
- package/util/currency.js +5 -5
- package/util/data.d.ts +26 -26
- package/util/data.js +4 -4
- package/util/date.d.ts +19 -19
- package/util/date.js +18 -18
- package/util/debug.d.ts +12 -12
- package/util/debug.js +12 -12
- package/util/dictionary.d.ts +24 -24
- package/util/dictionary.js +17 -17
- package/util/diff.d.ts +4 -4
- package/util/diff.js +2 -2
- package/util/dispose.d.ts +13 -13
- package/util/dispose.js +13 -13
- package/util/duration.d.ts +31 -31
- package/util/duration.js +29 -29
- package/util/element.d.ts +10 -10
- package/util/element.js +5 -5
- package/util/entity.d.ts +6 -6
- package/util/entity.js +1 -1
- package/util/entry.d.ts +9 -9
- package/util/entry.js +4 -4
- package/util/env.d.ts +4 -4
- package/util/env.js +4 -4
- package/util/equal.d.ts +22 -22
- package/util/equal.js +22 -22
- package/util/error.d.ts +8 -8
- package/util/error.js +7 -7
- package/util/file.d.ts +4 -4
- package/util/file.js +3 -3
- package/util/filter.d.ts +4 -4
- package/util/filter.js +3 -3
- package/util/focus.d.ts +1 -1
- package/util/focus.js +1 -1
- package/util/format.d.ts +27 -27
- package/util/format.js +15 -15
- package/util/function.d.ts +11 -11
- package/util/function.js +4 -4
- package/util/geo.d.ts +8 -8
- package/util/geo.js +5 -5
- package/util/hash.d.ts +2 -2
- package/util/hash.js +2 -2
- package/util/http.d.ts +26 -26
- package/util/http.js +18 -18
- package/util/hydrate.d.ts +4 -4
- package/util/hydrate.js +2 -2
- package/util/item.d.ts +11 -11
- package/util/item.js +4 -4
- package/util/iterate.d.ts +13 -13
- package/util/iterate.js +10 -10
- package/util/jwt.d.ts +9 -9
- package/util/jwt.js +7 -7
- package/util/lazy.d.ts +2 -2
- package/util/link.d.ts +3 -3
- package/util/link.js +2 -2
- package/util/log.d.ts +3 -3
- package/util/log.js +3 -3
- package/util/map.d.ts +19 -19
- package/util/map.js +11 -11
- package/util/merge.d.ts +5 -5
- package/util/merge.js +1 -1
- package/util/null.d.ts +13 -13
- package/util/null.js +11 -11
- package/util/number.d.ts +18 -18
- package/util/number.js +17 -17
- package/util/object.d.ts +35 -35
- package/util/object.js +17 -17
- package/util/path.d.ts +14 -14
- package/util/path.js +8 -8
- package/util/query.d.ts +10 -10
- package/util/query.js +7 -7
- package/util/random.d.ts +5 -5
- package/util/random.js +5 -5
- package/util/regexp.d.ts +26 -26
- package/util/regexp.js +13 -13
- package/util/sequence.d.ts +8 -8
- package/util/sequence.js +6 -6
- package/util/serialise.d.ts +1 -1
- package/util/serialise.js +1 -1
- package/util/set.d.ts +13 -13
- package/util/set.js +9 -9
- package/util/sort.d.ts +4 -4
- package/util/sort.js +3 -3
- package/util/source.d.ts +3 -3
- package/util/source.js +2 -2
- package/util/start.d.ts +8 -8
- package/util/start.js +5 -5
- package/util/string.d.ts +28 -28
- package/util/string.js +24 -24
- package/util/template.d.ts +10 -10
- package/util/template.js +7 -7
- package/util/timeout.d.ts +5 -5
- package/util/timeout.js +5 -5
- package/util/transform.d.ts +9 -9
- package/util/transform.js +7 -7
- package/util/tree.d.ts +12 -12
- package/util/tree.js +2 -2
- package/util/types.d.ts +2 -2
- package/util/undefined.d.ts +6 -6
- package/util/undefined.js +6 -6
- package/util/units.d.ts +16 -16
- package/util/units.js +14 -14
- package/util/update.d.ts +4 -4
- package/util/update.js +2 -2
- package/util/uri.d.ts +26 -26
- package/util/uri.js +6 -6
- package/util/url.d.ts +16 -16
- package/util/url.js +11 -11
- package/util/uuid.d.ts +3 -3
- package/util/uuid.js +3 -3
- package/util/validate.d.ts +11 -11
- package/util/validate.js +6 -6
- package/util/xml.d.ts +2 -2
- package/util/xml.js +2 -2
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ TypeScript data toolkit — schema validation, database and API providers, obser
|
|
|
6
6
|
|
|
7
7
|
## Documentation
|
|
8
8
|
|
|
9
|
-
Full documentation is published at **<https://
|
|
9
|
+
Full documentation is published at **<https://shelving.cc/>**.
|
|
10
10
|
|
|
11
11
|
```sh
|
|
12
12
|
npm install shelving
|
package/api/cache/APICache.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ import { EndpointCache } from "./EndpointCache.js";
|
|
|
11
11
|
* const cache = new APICache(provider);
|
|
12
12
|
* const user = await cache.call(getUser, { id: "abc" });
|
|
13
13
|
*
|
|
14
|
-
* @see https://
|
|
14
|
+
* @see https://shelving.cc/api/APICache
|
|
15
15
|
*/
|
|
16
16
|
export declare class APICache<P, R> implements AsyncDisposable {
|
|
17
17
|
private readonly _endpoints;
|
|
18
18
|
/**
|
|
19
19
|
* The underlying `APIProvider` that backs every cached endpoint.
|
|
20
20
|
*
|
|
21
|
-
* @see https://
|
|
21
|
+
* @see https://shelving.cc/api/APICache/provider
|
|
22
22
|
*/
|
|
23
23
|
readonly provider: APIProvider<P, R>;
|
|
24
24
|
/**
|
|
@@ -26,7 +26,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
26
26
|
*
|
|
27
27
|
* @param provider The `APIProvider` used to fetch results for every cached endpoint.
|
|
28
28
|
* @example new APICache(provider)
|
|
29
|
-
* @see https://
|
|
29
|
+
* @see https://shelving.cc/api/APICache
|
|
30
30
|
*/
|
|
31
31
|
constructor(provider: APIProvider<P, R>);
|
|
32
32
|
private _get;
|
|
@@ -36,7 +36,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
36
36
|
* @param endpoint The endpoint whose `EndpointCache` should be returned.
|
|
37
37
|
* @returns The existing `EndpointCache` for `endpoint`, or a newly created one.
|
|
38
38
|
* @example cache.get(getUser).get({ id: "abc" })
|
|
39
|
-
* @see https://
|
|
39
|
+
* @see https://shelving.cc/api/APICache/get
|
|
40
40
|
*/
|
|
41
41
|
get<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): EndpointCache<PP, RR>;
|
|
42
42
|
/**
|
|
@@ -52,7 +52,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
52
52
|
* @returns The cached or freshly fetched result.
|
|
53
53
|
* @throws Whatever `APIProvider.call` throws if the fetch fails.
|
|
54
54
|
* @example await cache.call(getUser, { id: "abc" })
|
|
55
|
-
* @see https://
|
|
55
|
+
* @see https://shelving.cc/api/APICache/call
|
|
56
56
|
*/
|
|
57
57
|
call<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, maxAge?: number, caller?: AnyCaller): Promise<RR>;
|
|
58
58
|
/**
|
|
@@ -61,7 +61,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
61
61
|
* @param endpoint The endpoint whose cached payload should be invalidated.
|
|
62
62
|
* @param payload The payload identifying the specific store to invalidate.
|
|
63
63
|
* @example cache.invalidate(getUser, { id: "abc" })
|
|
64
|
-
* @see https://
|
|
64
|
+
* @see https://shelving.cc/api/APICache/invalidate
|
|
65
65
|
*/
|
|
66
66
|
invalidate<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP): void;
|
|
67
67
|
/**
|
|
@@ -69,7 +69,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
69
69
|
*
|
|
70
70
|
* @param endpoint The endpoint whose stores should all be invalidated.
|
|
71
71
|
* @example cache.invalidateAll(getUser)
|
|
72
|
-
* @see https://
|
|
72
|
+
* @see https://shelving.cc/api/APICache/invalidateAll
|
|
73
73
|
*/
|
|
74
74
|
invalidateAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>): void;
|
|
75
75
|
/**
|
|
@@ -79,7 +79,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
79
79
|
* @param payload The payload identifying the specific store to refresh.
|
|
80
80
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
81
81
|
* @example cache.refresh(getUser, { id: "abc" })
|
|
82
|
-
* @see https://
|
|
82
|
+
* @see https://shelving.cc/api/APICache/refresh
|
|
83
83
|
*/
|
|
84
84
|
refresh<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, maxAge?: number): void;
|
|
85
85
|
/**
|
|
@@ -88,7 +88,7 @@ export declare class APICache<P, R> implements AsyncDisposable {
|
|
|
88
88
|
* @param endpoint The endpoint whose stores should all be refreshed.
|
|
89
89
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
90
90
|
* @example cache.refreshAll(getUser)
|
|
91
|
-
* @see https://
|
|
91
|
+
* @see https://shelving.cc/api/APICache/refreshAll
|
|
92
92
|
*/
|
|
93
93
|
refreshAll<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, maxAge?: number): void;
|
|
94
94
|
[Symbol.asyncDispose](): Promise<void>;
|
package/api/cache/APICache.js
CHANGED
|
@@ -11,14 +11,14 @@ import { EndpointCache } from "./EndpointCache.js";
|
|
|
11
11
|
* const cache = new APICache(provider);
|
|
12
12
|
* const user = await cache.call(getUser, { id: "abc" });
|
|
13
13
|
*
|
|
14
|
-
* @see https://
|
|
14
|
+
* @see https://shelving.cc/api/APICache
|
|
15
15
|
*/
|
|
16
16
|
export class APICache {
|
|
17
17
|
_endpoints = new Map();
|
|
18
18
|
/**
|
|
19
19
|
* The underlying `APIProvider` that backs every cached endpoint.
|
|
20
20
|
*
|
|
21
|
-
* @see https://
|
|
21
|
+
* @see https://shelving.cc/api/APICache/provider
|
|
22
22
|
*/
|
|
23
23
|
provider;
|
|
24
24
|
/**
|
|
@@ -26,7 +26,7 @@ export class APICache {
|
|
|
26
26
|
*
|
|
27
27
|
* @param provider The `APIProvider` used to fetch results for every cached endpoint.
|
|
28
28
|
* @example new APICache(provider)
|
|
29
|
-
* @see https://
|
|
29
|
+
* @see https://shelving.cc/api/APICache
|
|
30
30
|
*/
|
|
31
31
|
constructor(provider) {
|
|
32
32
|
this.provider = provider;
|
|
@@ -50,7 +50,7 @@ export class APICache {
|
|
|
50
50
|
* @returns The cached or freshly fetched result.
|
|
51
51
|
* @throws Whatever `APIProvider.call` throws if the fetch fails.
|
|
52
52
|
* @example await cache.call(getUser, { id: "abc" })
|
|
53
|
-
* @see https://
|
|
53
|
+
* @see https://shelving.cc/api/APICache/call
|
|
54
54
|
*/
|
|
55
55
|
async call(endpoint, payload, maxAge = AVOID_REFRESH, caller = this.call) {
|
|
56
56
|
return this.get(endpoint).call(payload, maxAge, caller);
|
|
@@ -61,7 +61,7 @@ export class APICache {
|
|
|
61
61
|
* @param endpoint The endpoint whose cached payload should be invalidated.
|
|
62
62
|
* @param payload The payload identifying the specific store to invalidate.
|
|
63
63
|
* @example cache.invalidate(getUser, { id: "abc" })
|
|
64
|
-
* @see https://
|
|
64
|
+
* @see https://shelving.cc/api/APICache/invalidate
|
|
65
65
|
*/
|
|
66
66
|
invalidate(endpoint, payload) {
|
|
67
67
|
this._get(endpoint)?.invalidate(payload);
|
|
@@ -71,7 +71,7 @@ export class APICache {
|
|
|
71
71
|
*
|
|
72
72
|
* @param endpoint The endpoint whose stores should all be invalidated.
|
|
73
73
|
* @example cache.invalidateAll(getUser)
|
|
74
|
-
* @see https://
|
|
74
|
+
* @see https://shelving.cc/api/APICache/invalidateAll
|
|
75
75
|
*/
|
|
76
76
|
invalidateAll(endpoint) {
|
|
77
77
|
this._get(endpoint)?.invalidateAll();
|
|
@@ -83,7 +83,7 @@ export class APICache {
|
|
|
83
83
|
* @param payload The payload identifying the specific store to refresh.
|
|
84
84
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
85
85
|
* @example cache.refresh(getUser, { id: "abc" })
|
|
86
|
-
* @see https://
|
|
86
|
+
* @see https://shelving.cc/api/APICache/refresh
|
|
87
87
|
*/
|
|
88
88
|
refresh(endpoint, payload, maxAge) {
|
|
89
89
|
this._get(endpoint)?.refresh(payload, maxAge);
|
|
@@ -94,7 +94,7 @@ export class APICache {
|
|
|
94
94
|
* @param endpoint The endpoint whose stores should all be refreshed.
|
|
95
95
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
96
96
|
* @example cache.refreshAll(getUser)
|
|
97
|
-
* @see https://
|
|
97
|
+
* @see https://shelving.cc/api/APICache/refreshAll
|
|
98
98
|
*/
|
|
99
99
|
refreshAll(endpoint, maxAge) {
|
|
100
100
|
this._get(endpoint)?.refreshAll(maxAge);
|
|
@@ -11,20 +11,20 @@ import { EndpointStore } from "../store/EndpointStore.js";
|
|
|
11
11
|
* const cache = new EndpointCache(getUser, provider);
|
|
12
12
|
* const user = await cache.call({ id: "abc" });
|
|
13
13
|
*
|
|
14
|
-
* @see https://
|
|
14
|
+
* @see https://shelving.cc/api/EndpointCache
|
|
15
15
|
*/
|
|
16
16
|
export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDisposable {
|
|
17
17
|
private readonly _endpoints;
|
|
18
18
|
/**
|
|
19
19
|
* The endpoint that every store in this cache fetches from.
|
|
20
20
|
*
|
|
21
|
-
* @see https://
|
|
21
|
+
* @see https://shelving.cc/api/EndpointCache/endpoint
|
|
22
22
|
*/
|
|
23
23
|
readonly endpoint: Endpoint<P, R>;
|
|
24
24
|
/**
|
|
25
25
|
* The `APIProvider` used to render URLs and fetch results for this endpoint.
|
|
26
26
|
*
|
|
27
|
-
* @see https://
|
|
27
|
+
* @see https://shelving.cc/api/EndpointCache/provider
|
|
28
28
|
*/
|
|
29
29
|
readonly provider: APIProvider<P, R>;
|
|
30
30
|
/**
|
|
@@ -33,7 +33,7 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
33
33
|
* @param endpoint The endpoint that every cached store fetches from.
|
|
34
34
|
* @param provider The `APIProvider` used to render URLs and fetch results.
|
|
35
35
|
* @example new EndpointCache(getUser, provider)
|
|
36
|
-
* @see https://
|
|
36
|
+
* @see https://shelving.cc/api/EndpointCache
|
|
37
37
|
*/
|
|
38
38
|
constructor(endpoint: Endpoint<P, R>, provider: APIProvider<P, R>);
|
|
39
39
|
/**
|
|
@@ -44,7 +44,7 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
44
44
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
45
45
|
* @returns The existing `EndpointStore` for `payload`, or a newly created one.
|
|
46
46
|
* @example cache.get({ id: "abc" })
|
|
47
|
-
* @see https://
|
|
47
|
+
* @see https://shelving.cc/api/EndpointCache/get
|
|
48
48
|
*/
|
|
49
49
|
get(payload: P, caller?: AnyCaller): EndpointStore<P, R>;
|
|
50
50
|
/**
|
|
@@ -59,7 +59,7 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
59
59
|
* @returns The cached or freshly fetched result.
|
|
60
60
|
* @throws Whatever `APIProvider.call` throws if the fetch fails.
|
|
61
61
|
* @example await cache.call({ id: "abc" })
|
|
62
|
-
* @see https://
|
|
62
|
+
* @see https://shelving.cc/api/EndpointCache/call
|
|
63
63
|
*/
|
|
64
64
|
call(payload: P, maxAge?: number, caller?: AnyCaller): Promise<R>;
|
|
65
65
|
/**
|
|
@@ -68,14 +68,14 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
68
68
|
* @param payload The payload identifying the store to invalidate.
|
|
69
69
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
70
70
|
* @example cache.invalidate({ id: "abc" })
|
|
71
|
-
* @see https://
|
|
71
|
+
* @see https://shelving.cc/api/EndpointCache/invalidate
|
|
72
72
|
*/
|
|
73
73
|
invalidate(payload: P, caller?: AnyCaller): void;
|
|
74
74
|
/**
|
|
75
75
|
* Invalidate all stores so the next read of any payload refetches.
|
|
76
76
|
*
|
|
77
77
|
* @example cache.invalidateAll()
|
|
78
|
-
* @see https://
|
|
78
|
+
* @see https://shelving.cc/api/EndpointCache/invalidateAll
|
|
79
79
|
*/
|
|
80
80
|
invalidateAll(): void;
|
|
81
81
|
/**
|
|
@@ -86,7 +86,7 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
86
86
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
87
87
|
* @returns A promise that resolves when the refetch settles.
|
|
88
88
|
* @example await cache.refresh({ id: "abc" })
|
|
89
|
-
* @see https://
|
|
89
|
+
* @see https://shelving.cc/api/EndpointCache/refresh
|
|
90
90
|
*/
|
|
91
91
|
refresh(payload: P, maxAge?: number, caller?: AnyCaller): Promise<void>;
|
|
92
92
|
/**
|
|
@@ -95,7 +95,7 @@ export declare class EndpointCache<P = unknown, R = unknown> implements AsyncDis
|
|
|
95
95
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
96
96
|
* @returns A promise that resolves when every refetch settles.
|
|
97
97
|
* @example await cache.refreshAll()
|
|
98
|
-
* @see https://
|
|
98
|
+
* @see https://shelving.cc/api/EndpointCache/refreshAll
|
|
99
99
|
*/
|
|
100
100
|
refreshAll(maxAge?: number): Promise<void>;
|
|
101
101
|
[Symbol.asyncDispose](): Promise<void>;
|
|
@@ -12,20 +12,20 @@ import { EndpointStore } from "../store/EndpointStore.js";
|
|
|
12
12
|
* const cache = new EndpointCache(getUser, provider);
|
|
13
13
|
* const user = await cache.call({ id: "abc" });
|
|
14
14
|
*
|
|
15
|
-
* @see https://
|
|
15
|
+
* @see https://shelving.cc/api/EndpointCache
|
|
16
16
|
*/
|
|
17
17
|
export class EndpointCache {
|
|
18
18
|
_endpoints = new Map();
|
|
19
19
|
/**
|
|
20
20
|
* The endpoint that every store in this cache fetches from.
|
|
21
21
|
*
|
|
22
|
-
* @see https://
|
|
22
|
+
* @see https://shelving.cc/api/EndpointCache/endpoint
|
|
23
23
|
*/
|
|
24
24
|
endpoint;
|
|
25
25
|
/**
|
|
26
26
|
* The `APIProvider` used to render URLs and fetch results for this endpoint.
|
|
27
27
|
*
|
|
28
|
-
* @see https://
|
|
28
|
+
* @see https://shelving.cc/api/EndpointCache/provider
|
|
29
29
|
*/
|
|
30
30
|
provider;
|
|
31
31
|
/**
|
|
@@ -34,7 +34,7 @@ export class EndpointCache {
|
|
|
34
34
|
* @param endpoint The endpoint that every cached store fetches from.
|
|
35
35
|
* @param provider The `APIProvider` used to render URLs and fetch results.
|
|
36
36
|
* @example new EndpointCache(getUser, provider)
|
|
37
|
-
* @see https://
|
|
37
|
+
* @see https://shelving.cc/api/EndpointCache
|
|
38
38
|
*/
|
|
39
39
|
constructor(endpoint, provider) {
|
|
40
40
|
this.endpoint = endpoint;
|
|
@@ -48,7 +48,7 @@ export class EndpointCache {
|
|
|
48
48
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
49
49
|
* @returns The existing `EndpointStore` for `payload`, or a newly created one.
|
|
50
50
|
* @example cache.get({ id: "abc" })
|
|
51
|
-
* @see https://
|
|
51
|
+
* @see https://shelving.cc/api/EndpointCache/get
|
|
52
52
|
*/
|
|
53
53
|
get(payload, caller = this.get) {
|
|
54
54
|
const url = this.provider.renderURL(this.endpoint, payload, caller).href;
|
|
@@ -66,7 +66,7 @@ export class EndpointCache {
|
|
|
66
66
|
* @returns The cached or freshly fetched result.
|
|
67
67
|
* @throws Whatever `APIProvider.call` throws if the fetch fails.
|
|
68
68
|
* @example await cache.call({ id: "abc" })
|
|
69
|
-
* @see https://
|
|
69
|
+
* @see https://shelving.cc/api/EndpointCache/call
|
|
70
70
|
*/
|
|
71
71
|
async call(payload, maxAge = AVOID_REFRESH, caller = this.call) {
|
|
72
72
|
const store = this.get(payload, caller);
|
|
@@ -79,7 +79,7 @@ export class EndpointCache {
|
|
|
79
79
|
* @param payload The payload identifying the store to invalidate.
|
|
80
80
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
81
81
|
* @example cache.invalidate({ id: "abc" })
|
|
82
|
-
* @see https://
|
|
82
|
+
* @see https://shelving.cc/api/EndpointCache/invalidate
|
|
83
83
|
*/
|
|
84
84
|
invalidate(payload, caller = this.invalidate) {
|
|
85
85
|
this.get(payload, caller)?.invalidate();
|
|
@@ -88,7 +88,7 @@ export class EndpointCache {
|
|
|
88
88
|
* Invalidate all stores so the next read of any payload refetches.
|
|
89
89
|
*
|
|
90
90
|
* @example cache.invalidateAll()
|
|
91
|
-
* @see https://
|
|
91
|
+
* @see https://shelving.cc/api/EndpointCache/invalidateAll
|
|
92
92
|
*/
|
|
93
93
|
invalidateAll() {
|
|
94
94
|
for (const store of this._endpoints.values())
|
|
@@ -102,7 +102,7 @@ export class EndpointCache {
|
|
|
102
102
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
103
103
|
* @returns A promise that resolves when the refetch settles.
|
|
104
104
|
* @example await cache.refresh({ id: "abc" })
|
|
105
|
-
* @see https://
|
|
105
|
+
* @see https://shelving.cc/api/EndpointCache/refresh
|
|
106
106
|
*/
|
|
107
107
|
async refresh(payload, maxAge, caller = this.invalidate) {
|
|
108
108
|
await this.get(payload, caller)?.refresh(maxAge);
|
|
@@ -113,7 +113,7 @@ export class EndpointCache {
|
|
|
113
113
|
* @param maxAge The maximum age in milliseconds before a refetch is triggered.
|
|
114
114
|
* @returns A promise that resolves when every refetch settles.
|
|
115
115
|
* @example await cache.refreshAll()
|
|
116
|
-
* @see https://
|
|
116
|
+
* @see https://shelving.cc/api/EndpointCache/refreshAll
|
|
117
117
|
*/
|
|
118
118
|
async refreshAll(maxAge) {
|
|
119
119
|
await awaitValues(...this._endpoints.values().map(store => store.refresh(maxAge)));
|
|
@@ -19,37 +19,37 @@ import type { EndpointCallback, EndpointHandler } from "./util.js";
|
|
|
19
19
|
* @example
|
|
20
20
|
* const getUser = new Endpoint("GET", "/users/{id}", USER_PAYLOAD, USER_RESULT);
|
|
21
21
|
*
|
|
22
|
-
* @see https://
|
|
22
|
+
* @see https://shelving.cc/api/Endpoint
|
|
23
23
|
*/
|
|
24
24
|
export declare class Endpoint<P = unknown, R = unknown> {
|
|
25
25
|
/**
|
|
26
26
|
* The HTTP method this endpoint responds to, e.g. `GET`
|
|
27
27
|
*
|
|
28
|
-
* @see https://
|
|
28
|
+
* @see https://shelving.cc/api/Endpoint/method
|
|
29
29
|
*/
|
|
30
30
|
readonly method: RequestMethod;
|
|
31
31
|
/**
|
|
32
32
|
* Endpoint path, possibly including placeholders e.g. `/users/{id}`
|
|
33
33
|
*
|
|
34
|
-
* @see https://
|
|
34
|
+
* @see https://shelving.cc/api/Endpoint/path
|
|
35
35
|
*/
|
|
36
36
|
readonly path: AbsolutePath;
|
|
37
37
|
/**
|
|
38
38
|
* The `{placeholder}` segments extracted from `path`, used to render and match URLs.
|
|
39
39
|
*
|
|
40
|
-
* @see https://
|
|
40
|
+
* @see https://shelving.cc/api/Endpoint/placeholders
|
|
41
41
|
*/
|
|
42
42
|
readonly placeholders: TemplatePlaceholders;
|
|
43
43
|
/**
|
|
44
44
|
* The `Schema` that request payloads are validated against.
|
|
45
45
|
*
|
|
46
|
-
* @see https://
|
|
46
|
+
* @see https://shelving.cc/api/Endpoint/payload
|
|
47
47
|
*/
|
|
48
48
|
readonly payload: Schema<P>;
|
|
49
49
|
/**
|
|
50
50
|
* The `Schema` that response results are validated against.
|
|
51
51
|
*
|
|
52
|
-
* @see https://
|
|
52
|
+
* @see https://shelving.cc/api/Endpoint/result
|
|
53
53
|
*/
|
|
54
54
|
readonly result: Schema<R>;
|
|
55
55
|
constructor(method: RequestMethod, path: AbsolutePath, payload: Schema<P>, result: Schema<R>);
|
|
@@ -62,7 +62,7 @@ export declare class Endpoint<P = unknown, R = unknown> {
|
|
|
62
62
|
* @returns The rendered absolute path, with any `{placeholders}` filled from `payload`.
|
|
63
63
|
* @throws {RequiredError} if this endpoint's path has `{placeholders}` but `payload` is not a data object.
|
|
64
64
|
* @example endpoint.renderPath({ id: "abc" }) // "/users/abc"
|
|
65
|
-
* @see https://
|
|
65
|
+
* @see https://shelving.cc/api/Endpoint/renderPath
|
|
66
66
|
*/
|
|
67
67
|
renderPath(payload: P, caller?: AnyCaller): AbsolutePath;
|
|
68
68
|
/**
|
|
@@ -73,7 +73,7 @@ export declare class Endpoint<P = unknown, R = unknown> {
|
|
|
73
73
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
74
74
|
* @returns A dictionary of matched `{placeholder}` params, or `undefined` if the method or path doesn't match.
|
|
75
75
|
* @example endpoint.match("GET", "/users/abc") // { id: "abc" }
|
|
76
|
-
* @see https://
|
|
76
|
+
* @see https://shelving.cc/api/Endpoint/match
|
|
77
77
|
*/
|
|
78
78
|
match(method: RequestMethod, path: AbsolutePath, caller?: AnyCaller): RequestParams | undefined;
|
|
79
79
|
/**
|
|
@@ -82,7 +82,7 @@ export declare class Endpoint<P = unknown, R = unknown> {
|
|
|
82
82
|
* @param callback The callback function that implements the logic for this endpoint by receiving the payload and returning the response.
|
|
83
83
|
* @returns An `EndpointHandler` object combining this endpoint and the callback into a single typed object.
|
|
84
84
|
* @example endpoint.handler((payload, request) => ({ ...payload }))
|
|
85
|
-
* @see https://
|
|
85
|
+
* @see https://shelving.cc/api/Endpoint/handler
|
|
86
86
|
*/
|
|
87
87
|
handler<C>(callback: EndpointCallback<P, R, C>): EndpointHandler<P, R, C>;
|
|
88
88
|
/**
|
|
@@ -90,32 +90,32 @@ export declare class Endpoint<P = unknown, R = unknown> {
|
|
|
90
90
|
*
|
|
91
91
|
* @returns The method and path joined with a space, e.g. `GET /user/{id}`
|
|
92
92
|
* @example endpoint.toString() // "GET /users/{id}"
|
|
93
|
-
* @see https://
|
|
93
|
+
* @see https://shelving.cc/api/Endpoint/toString
|
|
94
94
|
*/
|
|
95
95
|
toString(): string;
|
|
96
96
|
}
|
|
97
97
|
/**
|
|
98
98
|
* An `Endpoint` with any payload and result type, for use where the specific types don't matter.
|
|
99
99
|
*
|
|
100
|
-
* @see https://
|
|
100
|
+
* @see https://shelving.cc/api/AnyEndpoint
|
|
101
101
|
*/
|
|
102
102
|
export type AnyEndpoint = Endpoint<any, any>;
|
|
103
103
|
/**
|
|
104
104
|
* An immutable list of endpoints.
|
|
105
105
|
*
|
|
106
|
-
* @see https://
|
|
106
|
+
* @see https://shelving.cc/api/Endpoints
|
|
107
107
|
*/
|
|
108
108
|
export type Endpoints = ImmutableArray<AnyEndpoint>;
|
|
109
109
|
/**
|
|
110
110
|
* Extract the payload type from an `Endpoint`.
|
|
111
111
|
*
|
|
112
|
-
* @see https://
|
|
112
|
+
* @see https://shelving.cc/api/PayloadType
|
|
113
113
|
*/
|
|
114
114
|
export type PayloadType<X extends Endpoint<unknown, unknown>> = X extends Endpoint<infer Y, unknown> ? Y : never;
|
|
115
115
|
/**
|
|
116
116
|
* Extract the result type from an `Endpoint`.
|
|
117
117
|
*
|
|
118
|
-
* @see https://
|
|
118
|
+
* @see https://shelving.cc/api/EndpointType
|
|
119
119
|
*/
|
|
120
120
|
export type EndpointType<X extends Endpoint<unknown, unknown>> = X extends Endpoint<unknown, infer Y> ? Y : never;
|
|
121
121
|
/**
|
|
@@ -129,7 +129,7 @@ export type EndpointType<X extends Endpoint<unknown, unknown>> = X extends Endpo
|
|
|
129
129
|
* @param result An optional `Schema` validating the response result.
|
|
130
130
|
* @returns An `Endpoint` configured for the `HEAD` method.
|
|
131
131
|
* @example HEAD("/users/{id}")
|
|
132
|
-
* @see https://
|
|
132
|
+
* @see https://shelving.cc/api/HEAD
|
|
133
133
|
*/
|
|
134
134
|
export declare function HEAD<P extends Data, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
135
135
|
export declare function HEAD<P extends Data>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
|
@@ -145,7 +145,7 @@ export declare function HEAD<R>(path: AbsolutePath, payload: undefined, result:
|
|
|
145
145
|
* @param result An optional `Schema` validating the response result.
|
|
146
146
|
* @returns An `Endpoint` configured for the `GET` method.
|
|
147
147
|
* @example GET("/users/{id}", undefined, USER)
|
|
148
|
-
* @see https://
|
|
148
|
+
* @see https://shelving.cc/api/GET
|
|
149
149
|
*/
|
|
150
150
|
export declare function GET<P extends Data, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
151
151
|
export declare function GET<P extends Data>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
|
@@ -161,7 +161,7 @@ export declare function GET<R>(path: AbsolutePath, payload: undefined, result: S
|
|
|
161
161
|
* @param result An optional `Schema` validating the response result.
|
|
162
162
|
* @returns An `Endpoint` configured for the `POST` method.
|
|
163
163
|
* @example POST("/users", USER, USER_RESULT)
|
|
164
|
-
* @see https://
|
|
164
|
+
* @see https://shelving.cc/api/POST
|
|
165
165
|
*/
|
|
166
166
|
export declare function POST<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
167
167
|
export declare function POST<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
|
@@ -177,7 +177,7 @@ export declare function POST<R>(path: AbsolutePath, payload: undefined, result:
|
|
|
177
177
|
* @param result An optional `Schema` validating the response result.
|
|
178
178
|
* @returns An `Endpoint` configured for the `PUT` method.
|
|
179
179
|
* @example PUT("/users/{id}", USER)
|
|
180
|
-
* @see https://
|
|
180
|
+
* @see https://shelving.cc/api/PUT
|
|
181
181
|
*/
|
|
182
182
|
export declare function PUT<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
183
183
|
export declare function PUT<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
|
@@ -193,7 +193,7 @@ export declare function PUT<R>(path: AbsolutePath, payload: undefined, result: S
|
|
|
193
193
|
* @param result An optional `Schema` validating the response result.
|
|
194
194
|
* @returns An `Endpoint` configured for the `PATCH` method.
|
|
195
195
|
* @example PATCH("/users/{id}", PARTIAL_USER)
|
|
196
|
-
* @see https://
|
|
196
|
+
* @see https://shelving.cc/api/PATCH
|
|
197
197
|
*/
|
|
198
198
|
export declare function PATCH<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
199
199
|
export declare function PATCH<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
|
@@ -209,7 +209,7 @@ export declare function PATCH<R>(path: AbsolutePath, payload: undefined, result:
|
|
|
209
209
|
* @param result An optional `Schema` validating the response result.
|
|
210
210
|
* @returns An `Endpoint` configured for the `DELETE` method.
|
|
211
211
|
* @example DELETE("/users/{id}")
|
|
212
|
-
* @see https://
|
|
212
|
+
* @see https://shelving.cc/api/DELETE
|
|
213
213
|
*/
|
|
214
214
|
export declare function DELETE<P, R>(path: AbsolutePath, payload?: Schema<P>, result?: Schema<R>): Endpoint<P, R>;
|
|
215
215
|
export declare function DELETE<P>(path: AbsolutePath, payload: Schema<P>): Endpoint<P, undefined>;
|
package/api/endpoint/Endpoint.js
CHANGED
|
@@ -15,37 +15,37 @@ import { getPlaceholders, matchPathTemplate, renderPathTemplate } from "../../ut
|
|
|
15
15
|
* @example
|
|
16
16
|
* const getUser = new Endpoint("GET", "/users/{id}", USER_PAYLOAD, USER_RESULT);
|
|
17
17
|
*
|
|
18
|
-
* @see https://
|
|
18
|
+
* @see https://shelving.cc/api/Endpoint
|
|
19
19
|
*/
|
|
20
20
|
export class Endpoint {
|
|
21
21
|
/**
|
|
22
22
|
* The HTTP method this endpoint responds to, e.g. `GET`
|
|
23
23
|
*
|
|
24
|
-
* @see https://
|
|
24
|
+
* @see https://shelving.cc/api/Endpoint/method
|
|
25
25
|
*/
|
|
26
26
|
method;
|
|
27
27
|
/**
|
|
28
28
|
* Endpoint path, possibly including placeholders e.g. `/users/{id}`
|
|
29
29
|
*
|
|
30
|
-
* @see https://
|
|
30
|
+
* @see https://shelving.cc/api/Endpoint/path
|
|
31
31
|
*/
|
|
32
32
|
path;
|
|
33
33
|
/**
|
|
34
34
|
* The `{placeholder}` segments extracted from `path`, used to render and match URLs.
|
|
35
35
|
*
|
|
36
|
-
* @see https://
|
|
36
|
+
* @see https://shelving.cc/api/Endpoint/placeholders
|
|
37
37
|
*/
|
|
38
38
|
placeholders;
|
|
39
39
|
/**
|
|
40
40
|
* The `Schema` that request payloads are validated against.
|
|
41
41
|
*
|
|
42
|
-
* @see https://
|
|
42
|
+
* @see https://shelving.cc/api/Endpoint/payload
|
|
43
43
|
*/
|
|
44
44
|
payload;
|
|
45
45
|
/**
|
|
46
46
|
* The `Schema` that response results are validated against.
|
|
47
47
|
*
|
|
48
|
-
* @see https://
|
|
48
|
+
* @see https://shelving.cc/api/Endpoint/result
|
|
49
49
|
*/
|
|
50
50
|
result;
|
|
51
51
|
constructor(method, path, payload, result) {
|
|
@@ -64,7 +64,7 @@ export class Endpoint {
|
|
|
64
64
|
* @returns The rendered absolute path, with any `{placeholders}` filled from `payload`.
|
|
65
65
|
* @throws {RequiredError} if this endpoint's path has `{placeholders}` but `payload` is not a data object.
|
|
66
66
|
* @example endpoint.renderPath({ id: "abc" }) // "/users/abc"
|
|
67
|
-
* @see https://
|
|
67
|
+
* @see https://shelving.cc/api/Endpoint/renderPath
|
|
68
68
|
*/
|
|
69
69
|
renderPath(payload, caller = this.renderPath) {
|
|
70
70
|
// Placeholders.
|
|
@@ -83,7 +83,7 @@ export class Endpoint {
|
|
|
83
83
|
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
84
84
|
* @returns A dictionary of matched `{placeholder}` params, or `undefined` if the method or path doesn't match.
|
|
85
85
|
* @example endpoint.match("GET", "/users/abc") // { id: "abc" }
|
|
86
|
-
* @see https://
|
|
86
|
+
* @see https://shelving.cc/api/Endpoint/match
|
|
87
87
|
*/
|
|
88
88
|
match(method, path, caller = this.match) {
|
|
89
89
|
if (method !== this.method)
|
|
@@ -96,7 +96,7 @@ export class Endpoint {
|
|
|
96
96
|
* @param callback The callback function that implements the logic for this endpoint by receiving the payload and returning the response.
|
|
97
97
|
* @returns An `EndpointHandler` object combining this endpoint and the callback into a single typed object.
|
|
98
98
|
* @example endpoint.handler((payload, request) => ({ ...payload }))
|
|
99
|
-
* @see https://
|
|
99
|
+
* @see https://shelving.cc/api/Endpoint/handler
|
|
100
100
|
*/
|
|
101
101
|
handler(callback) {
|
|
102
102
|
return { endpoint: this, callback };
|
|
@@ -106,7 +106,7 @@ export class Endpoint {
|
|
|
106
106
|
*
|
|
107
107
|
* @returns The method and path joined with a space, e.g. `GET /user/{id}`
|
|
108
108
|
* @example endpoint.toString() // "GET /users/{id}"
|
|
109
|
-
* @see https://
|
|
109
|
+
* @see https://shelving.cc/api/Endpoint/toString
|
|
110
110
|
*/
|
|
111
111
|
toString() {
|
|
112
112
|
return `${this.method} ${this.path}`;
|
package/api/endpoint/util.d.ts
CHANGED
|
@@ -11,14 +11,14 @@ import type { Endpoint } from "./Endpoint.js";
|
|
|
11
11
|
* @returns {Response} Returning a `Response` object (this will pass back to the client without validation).
|
|
12
12
|
* @returns {R} Returning the return type of the handler (this will be validated against the Endpoint's result schema).
|
|
13
13
|
*
|
|
14
|
-
* @see https://
|
|
14
|
+
* @see https://shelving.cc/api/EndpointCallback
|
|
15
15
|
*/
|
|
16
16
|
export type EndpointCallback<P, R, C = void> = (payload: P, request: Request, context: C) => R | Response | Promise<R | Response>;
|
|
17
17
|
/**
|
|
18
18
|
* A typed endpoint definition paired with its implementation callback.
|
|
19
19
|
* - Created with `Endpoint.handler()`; matched and invoked by `handleEndpoints()`.
|
|
20
20
|
*
|
|
21
|
-
* @see https://
|
|
21
|
+
* @see https://shelving.cc/api/EndpointHandler
|
|
22
22
|
*/
|
|
23
23
|
export interface EndpointHandler<P, R, C = void> {
|
|
24
24
|
readonly endpoint: Endpoint<P, R>;
|
|
@@ -27,13 +27,13 @@ export interface EndpointHandler<P, R, C = void> {
|
|
|
27
27
|
/**
|
|
28
28
|
* An `EndpointHandler` with any payload and result type, for use where the specific types don't matter.
|
|
29
29
|
*
|
|
30
|
-
* @see https://
|
|
30
|
+
* @see https://shelving.cc/api/AnyEndpointHandler
|
|
31
31
|
*/
|
|
32
32
|
export type AnyEndpointHandler<C = any> = EndpointHandler<any, any, C>;
|
|
33
33
|
/**
|
|
34
34
|
* A collection of endpoint handlers that can be matched and invoked by `handleEndpoints()`.
|
|
35
35
|
*
|
|
36
|
-
* @see https://
|
|
36
|
+
* @see https://shelving.cc/api/EndpointHandlers
|
|
37
37
|
*/
|
|
38
38
|
export type EndpointHandlers<C = void> = Iterable<AnyEndpointHandler<C>>;
|
|
39
39
|
/**
|
|
@@ -51,7 +51,7 @@ export type EndpointHandlers<C = void> = Iterable<AnyEndpointHandler<C>>;
|
|
|
51
51
|
* @throws {MethodNotAllowedError} if the request method is not a supported HTTP method.
|
|
52
52
|
* @throws {NotFoundError} if no base path matches, or no endpoint matches the target path.
|
|
53
53
|
* @example await handleEndpoints("https://myapi.com", [getUser.handler(loadUser)], request, undefined)
|
|
54
|
-
* @see https://
|
|
54
|
+
* @see https://shelving.cc/api/handleEndpoints
|
|
55
55
|
*/
|
|
56
56
|
export declare function handleEndpoints<C>(base: PossibleURL, handlers: EndpointHandlers<C>, request: Request, context: C, caller?: AnyCaller): Promise<Response>;
|
|
57
57
|
export declare function handleEndpoints(base: PossibleURL, handlers: EndpointHandlers<void>, request: Request, context?: undefined, caller?: AnyCaller): Promise<Response>;
|