shelving 1.258.5 → 1.258.7
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/api/cache/APICache.d.ts +0 -7
- package/api/cache/APICache.js +0 -7
- package/api/cache/EndpointCache.d.ts +0 -8
- package/api/cache/EndpointCache.js +0 -8
- package/api/endpoint/Endpoint.d.ts +1 -8
- package/api/endpoint/Endpoint.js +1 -8
- package/api/provider/APIProvider.d.ts +0 -5
- package/api/provider/APIProvider.js +0 -5
- package/api/provider/CachedAPIProvider.d.ts +1 -25
- package/api/provider/CachedAPIProvider.js +1 -25
- package/api/provider/ClientAPIProvider.d.ts +4 -62
- package/api/provider/ClientAPIProvider.js +4 -62
- package/api/provider/DebugAPIProvider.d.ts +3 -35
- package/api/provider/DebugAPIProvider.js +3 -35
- package/api/provider/JSONAPIProvider.d.ts +1 -17
- package/api/provider/JSONAPIProvider.js +1 -17
- package/api/provider/LoggingAPIProvider.d.ts +1 -21
- package/api/provider/LoggingAPIProvider.js +1 -21
- package/api/provider/MockAPIProvider.d.ts +3 -40
- package/api/provider/MockAPIProvider.js +3 -40
- package/api/provider/MockEndpointAPIProvider.d.ts +0 -14
- package/api/provider/MockEndpointAPIProvider.js +0 -14
- package/api/provider/ThroughAPIProvider.d.ts +0 -58
- package/api/provider/ThroughAPIProvider.js +0 -58
- package/api/provider/ValidationAPIProvider.d.ts +2 -26
- package/api/provider/ValidationAPIProvider.js +2 -26
- package/api/provider/XMLAPIProvider.d.ts +1 -17
- package/api/provider/XMLAPIProvider.js +1 -17
- package/api/store/EndpointStore.d.ts +0 -8
- package/api/store/EndpointStore.js +0 -8
- package/bun/BunPostgreSQLProvider.d.ts +1 -29
- package/bun/BunPostgreSQLProvider.js +1 -29
- package/cloudflare/CloudflareD1Provider.d.ts +1 -22
- package/cloudflare/CloudflareD1Provider.js +1 -22
- package/cloudflare/CloudflareKVProvider.d.ts +8 -113
- package/cloudflare/CloudflareKVProvider.js +8 -113
- package/db/cache/CollectionCache.d.ts +0 -8
- package/db/cache/CollectionCache.js +0 -8
- package/db/cache/DBCache.d.ts +0 -6
- package/db/cache/DBCache.js +0 -6
- package/db/collection/Collection.d.ts +1 -14
- package/db/collection/Collection.js +1 -14
- package/db/migrate/DBMigrator.d.ts +1 -11
- package/db/migrate/DBMigrator.js +0 -9
- package/db/migrate/PostgreSQLMigrator.d.ts +0 -3
- package/db/migrate/PostgreSQLMigrator.js +0 -3
- package/db/migrate/SQLMigrator.d.ts +1 -12
- package/db/migrate/SQLMigrator.js +1 -12
- package/db/migrate/SQLiteMigrator.d.ts +0 -3
- package/db/migrate/SQLiteMigrator.js +0 -3
- package/db/provider/CacheDBProvider.d.ts +11 -113
- package/db/provider/CacheDBProvider.js +11 -113
- package/db/provider/ChangesDBProvider.d.ts +7 -66
- package/db/provider/ChangesDBProvider.js +7 -66
- package/db/provider/DebugDBProvider.d.ts +0 -106
- package/db/provider/DebugDBProvider.js +0 -106
- package/db/provider/MemoryDBProvider.d.ts +0 -116
- package/db/provider/MemoryDBProvider.js +0 -116
- package/db/provider/MockDBProvider.d.ts +0 -88
- package/db/provider/MockDBProvider.js +0 -88
- package/db/provider/PostgreSQLProvider.d.ts +3 -29
- package/db/provider/PostgreSQLProvider.js +3 -29
- package/db/provider/SQLProvider.d.ts +11 -137
- package/db/provider/SQLProvider.js +12 -137
- package/db/provider/SQLiteProvider.d.ts +4 -39
- package/db/provider/SQLiteProvider.js +4 -39
- package/db/provider/ThroughDBProvider.d.ts +0 -143
- package/db/provider/ThroughDBProvider.js +0 -143
- package/db/provider/ValidationDBProvider.d.ts +9 -111
- package/db/provider/ValidationDBProvider.js +9 -111
- package/db/store/ItemStore.d.ts +0 -9
- package/db/store/ItemStore.js +0 -9
- package/db/store/QueryStore.d.ts +0 -9
- package/db/store/QueryStore.js +0 -9
- package/error/BaseError.d.ts +1 -3
- package/error/BaseError.js +1 -3
- package/error/Errors.d.ts +0 -2
- package/error/Errors.js +0 -2
- package/error/NetworkError.d.ts +1 -7
- package/error/NetworkError.js +1 -7
- package/error/RequestError.d.ts +10 -38
- package/error/RequestError.js +6 -38
- package/error/RequiredError.d.ts +1 -7
- package/error/RequiredError.js +1 -7
- package/error/ResponseError.d.ts +5 -8
- package/error/ResponseError.js +1 -8
- package/error/UnexpectedError.d.ts +1 -7
- package/error/UnexpectedError.js +1 -7
- package/error/UnimplementedError.d.ts +1 -7
- package/error/UnimplementedError.js +1 -7
- package/error/ValueError.d.ts +1 -7
- package/error/ValueError.js +1 -7
- package/extract/DirectoryExtractor.d.ts +0 -16
- package/extract/DirectoryExtractor.js +0 -16
- package/extract/IndexExtractor.d.ts +0 -18
- package/extract/IndexExtractor.js +0 -18
- package/extract/MarkupExtractor.d.ts +1 -10
- package/extract/MarkupExtractor.js +1 -10
- package/extract/MergingExtractor.d.ts +0 -18
- package/extract/MergingExtractor.js +0 -18
- package/extract/ModuleExtractor.d.ts +0 -10
- package/extract/ModuleExtractor.js +0 -10
- package/extract/PackageExtractor.d.ts +1 -16
- package/extract/PackageExtractor.js +1 -16
- package/extract/ThroughExtractor.d.ts +0 -6
- package/extract/ThroughExtractor.js +0 -6
- package/extract/TypescriptExtractor.d.ts +1 -11
- package/extract/TypescriptExtractor.js +1 -11
- package/firestore/client/FirestoreClientProvider.d.ts +0 -122
- package/firestore/client/FirestoreClientProvider.js +0 -122
- package/firestore/lite/FirestoreLiteProvider.d.ts +2 -122
- package/firestore/lite/FirestoreLiteProvider.js +2 -122
- package/firestore/server/FirestoreServerProvider.d.ts +4 -122
- package/firestore/server/FirestoreServerProvider.js +4 -122
- package/markup/MarkupParser.d.ts +0 -8
- package/markup/MarkupParser.js +0 -8
- package/package.json +1 -1
- package/react/createAPIContext.d.ts +0 -3
- package/react/createAPIContext.js +0 -3
- package/react/createDBContext.d.ts +0 -3
- package/react/createDBContext.js +0 -3
- package/react/useInstance.d.ts +0 -3
- package/react/useInstance.js +0 -3
- package/react/useLazy.d.ts +0 -3
- package/react/useMap.d.ts +0 -6
- package/react/useMap.js +0 -6
- package/react/useReduce.d.ts +0 -5
- package/react/useSequence.d.ts +0 -3
- package/react/useSequence.js +0 -3
- package/react/useStore.d.ts +0 -5
- package/schema/AddressSchema.d.ts +1 -11
- package/schema/AddressSchema.js +1 -11
- package/schema/ArraySchema.d.ts +2 -34
- package/schema/ArraySchema.js +2 -34
- package/schema/BooleanSchema.d.ts +3 -26
- package/schema/BooleanSchema.js +3 -26
- package/schema/ChoiceSchema.d.ts +13 -14
- package/schema/ChoiceSchema.js +21 -17
- package/schema/ColorSchema.d.ts +1 -14
- package/schema/ColorSchema.js +1 -14
- package/schema/CountrySchema.d.ts +1 -16
- package/schema/CountrySchema.js +2 -20
- package/schema/CurrencyAmountSchema.d.ts +2 -19
- package/schema/CurrencyAmountSchema.js +2 -19
- package/schema/CurrencyCodeSchema.d.ts +2 -23
- package/schema/CurrencyCodeSchema.js +2 -23
- package/schema/DataSchema.d.ts +2 -26
- package/schema/DataSchema.js +2 -25
- package/schema/DateSchema.d.ts +2 -20
- package/schema/DateSchema.js +2 -20
- package/schema/DateTimeSchema.d.ts +2 -19
- package/schema/DateTimeSchema.js +2 -19
- package/schema/DictionarySchema.d.ts +2 -20
- package/schema/DictionarySchema.js +2 -20
- package/schema/EmailSchema.d.ts +1 -14
- package/schema/EmailSchema.js +1 -14
- package/schema/EntitySchema.d.ts +1 -12
- package/schema/EntitySchema.js +1 -12
- package/schema/FileSchema.d.ts +1 -12
- package/schema/FileSchema.js +1 -12
- package/schema/KeySchema.d.ts +1 -11
- package/schema/KeySchema.js +1 -11
- package/schema/NullableSchema.d.ts +3 -36
- package/schema/NullableSchema.js +3 -36
- package/schema/NumberSchema.d.ts +13 -67
- package/schema/NumberSchema.js +13 -61
- package/schema/OptionalSchema.d.ts +3 -36
- package/schema/OptionalSchema.js +3 -36
- package/schema/PasswordSchema.d.ts +1 -12
- package/schema/PasswordSchema.js +1 -12
- package/schema/PhoneSchema.d.ts +1 -14
- package/schema/PhoneSchema.js +1 -14
- package/schema/RequiredSchema.d.ts +2 -17
- package/schema/RequiredSchema.js +2 -17
- package/schema/Schema.d.ts +0 -3
- package/schema/Schema.js +0 -3
- package/schema/SlugSchema.d.ts +1 -11
- package/schema/SlugSchema.js +1 -11
- package/schema/StringSchema.d.ts +9 -54
- package/schema/StringSchema.js +9 -54
- package/schema/ThroughSchema.d.ts +1 -11
- package/schema/ThroughSchema.js +1 -11
- package/schema/TimeSchema.d.ts +2 -19
- package/schema/TimeSchema.js +2 -19
- package/schema/URISchema.d.ts +3 -32
- package/schema/URISchema.js +3 -32
- package/schema/URLSchema.d.ts +3 -32
- package/schema/URLSchema.js +3 -32
- package/schema/UUIDSchema.d.ts +1 -11
- package/schema/UUIDSchema.js +1 -11
- package/sequence/DeferredSequence.d.ts +0 -6
- package/sequence/DeferredSequence.js +0 -6
- package/sequence/InspectSequence.d.ts +0 -29
- package/sequence/InspectSequence.js +1 -30
- package/sequence/LazySequence.d.ts +0 -11
- package/sequence/LazySequence.js +0 -11
- package/sequence/Sequence.d.ts +0 -4
- package/sequence/Sequence.js +0 -4
- package/sequence/ThroughSequence.d.ts +0 -8
- package/sequence/ThroughSequence.js +0 -8
- package/store/ArrayStore.d.ts +0 -9
- package/store/ArrayStore.js +0 -9
- package/store/BooleanStore.d.ts +0 -6
- package/store/BooleanStore.js +0 -6
- package/store/BusyStore.d.ts +0 -4
- package/store/BusyStore.js +1 -5
- package/store/DataStore.d.ts +0 -17
- package/store/DataStore.js +0 -17
- package/store/DictionaryStore.d.ts +0 -11
- package/store/DictionaryStore.js +0 -11
- package/store/FetchStore.d.ts +0 -9
- package/store/FetchStore.js +0 -9
- package/store/PathStore.d.ts +0 -15
- package/store/PathStore.js +0 -15
- package/store/PayloadFetchStore.d.ts +0 -7
- package/store/PayloadFetchStore.js +0 -7
- package/store/Store.d.ts +0 -6
- package/store/Store.js +0 -6
- package/store/URLStore.d.ts +0 -18
- package/store/URLStore.js +0 -18
- package/test/util.d.ts +0 -2
- package/test/util.js +0 -2
- package/ui/app/App.d.ts +0 -4
- package/ui/app/App.js +0 -4
- package/ui/app/App.tsx +0 -4
- package/ui/block/Block.d.ts +0 -1
- package/ui/block/Block.js +0 -1
- package/ui/block/Block.tsx +0 -1
- package/ui/block/Card.d.ts +0 -3
- package/ui/block/Card.js +0 -3
- package/ui/block/Card.tsx +0 -3
- package/ui/block/Column.d.ts +0 -2
- package/ui/block/Column.js +0 -2
- package/ui/block/Column.tsx +0 -2
- package/ui/block/Heading.d.ts +0 -2
- package/ui/block/Heading.js +0 -2
- package/ui/block/Heading.tsx +0 -2
- package/ui/block/Image.d.ts +0 -1
- package/ui/block/Image.js +0 -1
- package/ui/block/Image.tsx +0 -1
- package/ui/block/Label.d.ts +0 -1
- package/ui/block/Label.js +0 -1
- package/ui/block/Label.tsx +0 -1
- package/ui/block/List.d.ts +0 -3
- package/ui/block/List.js +0 -3
- package/ui/block/List.tsx +0 -3
- package/ui/block/Panel.d.ts +0 -3
- package/ui/block/Panel.js +0 -3
- package/ui/block/Panel.md +2 -1
- package/ui/block/Panel.tsx +0 -3
- package/ui/block/Paragraph.d.ts +0 -2
- package/ui/block/Paragraph.js +0 -2
- package/ui/block/Paragraph.tsx +0 -2
- package/ui/block/Preformatted.d.ts +0 -1
- package/ui/block/Preformatted.js +0 -1
- package/ui/block/Preformatted.tsx +0 -1
- package/ui/block/Prose.d.ts +0 -2
- package/ui/block/Prose.js +0 -2
- package/ui/block/Prose.md +1 -7
- package/ui/block/Prose.tsx +0 -2
- package/ui/block/Row.d.ts +0 -2
- package/ui/block/Row.js +0 -2
- package/ui/block/Row.tsx +0 -2
- package/ui/block/Section.d.ts +0 -9
- package/ui/block/Section.js +0 -9
- package/ui/block/Section.tsx +0 -9
- package/ui/block/Subheading.d.ts +0 -2
- package/ui/block/Subheading.js +0 -2
- package/ui/block/Subheading.tsx +0 -2
- package/ui/block/Title.d.ts +0 -2
- package/ui/block/Title.js +0 -2
- package/ui/block/Title.tsx +0 -2
- package/ui/block/Video.d.ts +0 -3
- package/ui/block/Video.js +0 -3
- package/ui/block/Video.tsx +0 -3
- package/ui/dialog/Dialog.d.ts +0 -5
- package/ui/dialog/Dialog.js +0 -5
- package/ui/dialog/Dialog.tsx +0 -5
- package/ui/dialog/Dialogs.d.ts +0 -9
- package/ui/dialog/Dialogs.js +0 -9
- package/ui/dialog/Dialogs.tsx +0 -9
- package/ui/dialog/Modal.d.ts +0 -3
- package/ui/dialog/Modal.js +0 -3
- package/ui/dialog/Modal.tsx +0 -3
- package/ui/docs/DocumentationCard.d.ts +0 -2
- package/ui/docs/DocumentationCard.js +0 -2
- package/ui/docs/DocumentationCard.tsx +0 -2
- package/ui/docs/DocumentationDescription.d.ts +0 -1
- package/ui/docs/DocumentationDescription.js +0 -1
- package/ui/docs/DocumentationDescription.tsx +0 -1
- package/ui/docs/DocumentationKind.d.ts +0 -1
- package/ui/docs/DocumentationKind.js +0 -1
- package/ui/docs/DocumentationKind.tsx +0 -1
- package/ui/docs/DocumentationPage.d.ts +0 -2
- package/ui/docs/DocumentationPage.js +0 -2
- package/ui/docs/DocumentationPage.md +1 -1
- package/ui/docs/DocumentationPage.tsx +0 -2
- package/ui/docs/DocumentationParams.d.ts +0 -1
- package/ui/docs/DocumentationParams.js +0 -1
- package/ui/docs/DocumentationParams.tsx +0 -1
- package/ui/docs/DocumentationProperties.d.ts +3 -4
- package/ui/docs/DocumentationProperties.js +3 -4
- package/ui/docs/DocumentationProperties.tsx +3 -4
- package/ui/docs/DocumentationReferences.d.ts +0 -1
- package/ui/docs/DocumentationReferences.js +0 -1
- package/ui/docs/DocumentationReferences.tsx +0 -1
- package/ui/docs/DocumentationReturns.d.ts +0 -1
- package/ui/docs/DocumentationReturns.js +0 -1
- package/ui/docs/DocumentationReturns.tsx +0 -1
- package/ui/docs/DocumentationSearchPage.d.ts +0 -1
- package/ui/docs/DocumentationSearchPage.js +0 -1
- package/ui/docs/DocumentationSearchPage.tsx +0 -1
- package/ui/docs/DocumentationSignatures.d.ts +0 -1
- package/ui/docs/DocumentationSignatures.js +0 -1
- package/ui/docs/DocumentationSignatures.tsx +0 -1
- package/ui/docs/DocumentationThrows.d.ts +0 -1
- package/ui/docs/DocumentationThrows.js +0 -1
- package/ui/docs/DocumentationThrows.tsx +0 -1
- package/ui/docs/DocumentationType.d.ts +2 -3
- package/ui/docs/DocumentationType.js +1 -2
- package/ui/docs/DocumentationType.tsx +2 -3
- package/ui/form/Button.d.ts +0 -3
- package/ui/form/Button.js +0 -3
- package/ui/form/Button.md +1 -1
- package/ui/form/Button.tsx +0 -3
- package/ui/form/Field.md +3 -1
- package/ui/form/Form.d.ts +0 -1
- package/ui/form/Form.md +1 -7
- package/ui/form/Form.tsx +0 -1
- package/ui/form/FormMessage.d.ts +0 -1
- package/ui/form/FormMessage.js +0 -1
- package/ui/form/FormMessage.tsx +0 -1
- package/ui/form/FormNotice.d.ts +0 -1
- package/ui/form/FormNotice.js +0 -1
- package/ui/form/FormNotice.tsx +0 -1
- package/ui/form/FormStore.d.ts +0 -11
- package/ui/form/FormStore.js +0 -11
- package/ui/form/FormStore.tsx +0 -11
- package/ui/form/QueryInput.d.ts +1 -5
- package/ui/form/QueryInput.tsx +1 -5
- package/ui/form/SchemaInput.d.ts +2 -4
- package/ui/form/SchemaInput.js +7 -6
- package/ui/form/SchemaInput.tsx +6 -7
- package/ui/inline/Code.d.ts +0 -2
- package/ui/inline/Code.js +0 -2
- package/ui/inline/Code.tsx +0 -2
- package/ui/inline/Deleted.d.ts +0 -1
- package/ui/inline/Deleted.js +0 -1
- package/ui/inline/Deleted.tsx +0 -1
- package/ui/inline/Emphasis.d.ts +0 -1
- package/ui/inline/Emphasis.js +0 -1
- package/ui/inline/Emphasis.tsx +0 -1
- package/ui/inline/Inserted.d.ts +0 -1
- package/ui/inline/Inserted.js +0 -1
- package/ui/inline/Inserted.tsx +0 -1
- package/ui/inline/Link.d.ts +0 -2
- package/ui/inline/Link.js +0 -2
- package/ui/inline/Link.tsx +0 -2
- package/ui/inline/Mark.d.ts +0 -2
- package/ui/inline/Mark.js +0 -2
- package/ui/inline/Mark.tsx +0 -2
- package/ui/inline/Small.d.ts +0 -1
- package/ui/inline/Small.js +0 -1
- package/ui/inline/Small.tsx +0 -1
- package/ui/inline/Strong.d.ts +0 -2
- package/ui/inline/Strong.js +0 -2
- package/ui/inline/Strong.tsx +0 -2
- package/ui/inline/Subscript.d.ts +0 -1
- package/ui/inline/Subscript.js +0 -1
- package/ui/inline/Subscript.tsx +0 -1
- package/ui/inline/Superscript.d.ts +0 -1
- package/ui/inline/Superscript.js +0 -1
- package/ui/inline/Superscript.tsx +0 -1
- package/ui/inline/When.d.ts +0 -3
- package/ui/inline/When.js +0 -3
- package/ui/inline/When.tsx +0 -3
- package/ui/layout/CenteredLayout.d.ts +4 -4
- package/ui/layout/CenteredLayout.js +0 -4
- package/ui/layout/CenteredLayout.md +2 -2
- package/ui/layout/CenteredLayout.tsx +4 -4
- package/ui/layout/Layout.d.ts +0 -1
- package/ui/layout/Layout.js +0 -1
- package/ui/layout/Layout.ts +0 -1
- package/ui/layout/SidebarLayout.d.ts +0 -6
- package/ui/layout/SidebarLayout.js +0 -6
- package/ui/layout/SidebarLayout.tsx +0 -6
- package/ui/menu/Menu.d.ts +0 -7
- package/ui/menu/Menu.js +0 -7
- package/ui/menu/Menu.tsx +0 -7
- package/ui/misc/Catcher.d.ts +0 -13
- package/ui/misc/Catcher.js +0 -13
- package/ui/misc/Catcher.tsx +0 -13
- package/ui/misc/Icon.d.ts +1 -2
- package/ui/misc/Icon.js +0 -1
- package/ui/misc/Icon.md +3 -3
- package/ui/misc/Icon.tsx +1 -2
- package/ui/misc/Loading.d.ts +0 -3
- package/ui/misc/Loading.js +0 -3
- package/ui/misc/Loading.tsx +0 -3
- package/ui/misc/Mapper.d.ts +0 -13
- package/ui/misc/Mapper.js +0 -13
- package/ui/misc/Mapper.tsx +0 -13
- package/ui/misc/Markup.d.ts +0 -1
- package/ui/misc/Markup.js +0 -1
- package/ui/misc/Markup.tsx +0 -1
- package/ui/misc/Tag.d.ts +0 -3
- package/ui/misc/Tag.js +0 -3
- package/ui/misc/Tag.tsx +0 -3
- package/ui/notice/Message.d.ts +0 -2
- package/ui/notice/Message.js +0 -2
- package/ui/notice/Message.tsx +0 -2
- package/ui/notice/Notice.d.ts +0 -5
- package/ui/notice/Notice.js +0 -5
- package/ui/notice/Notice.tsx +0 -5
- package/ui/notice/NoticeStore.d.ts +0 -7
- package/ui/notice/NoticeStore.js +0 -7
- package/ui/notice/NoticeStore.ts +0 -7
- package/ui/notice/Notices.d.ts +0 -2
- package/ui/notice/Notices.js +0 -2
- package/ui/notice/Notices.tsx +0 -2
- package/ui/page/HTML.d.ts +0 -4
- package/ui/page/HTML.js +0 -4
- package/ui/page/HTML.tsx +0 -4
- package/ui/page/Head.d.ts +0 -2
- package/ui/page/Head.js +0 -2
- package/ui/page/Head.tsx +0 -2
- package/ui/page/Page.d.ts +0 -4
- package/ui/page/Page.js +0 -4
- package/ui/page/Page.tsx +0 -4
- package/ui/router/Navigation.d.ts +0 -4
- package/ui/router/Navigation.js +0 -4
- package/ui/router/Navigation.tsx +0 -4
- package/ui/router/NavigationContext.d.ts +0 -1
- package/ui/router/NavigationContext.js +0 -1
- package/ui/router/NavigationContext.tsx +0 -1
- package/ui/router/NavigationStore.d.ts +0 -7
- package/ui/router/NavigationStore.js +0 -7
- package/ui/router/NavigationStore.tsx +0 -7
- package/ui/router/RouteCache.d.ts +0 -4
- package/ui/router/RouteCache.js +0 -4
- package/ui/router/RouteCache.tsx +0 -4
- package/ui/router/Router.d.ts +0 -5
- package/ui/router/Router.js +0 -5
- package/ui/router/Router.md +2 -22
- package/ui/router/Router.tsx +0 -5
- package/ui/style/Block.d.ts +0 -1
- package/ui/style/Block.js +0 -1
- package/ui/style/Block.tsx +0 -1
- package/ui/style/Color.d.ts +0 -1
- package/ui/style/Color.js +0 -1
- package/ui/style/Color.tsx +0 -1
- package/ui/style/Duration.d.ts +0 -1
- package/ui/style/Duration.js +0 -1
- package/ui/style/Duration.tsx +0 -1
- package/ui/style/Flex.d.ts +0 -1
- package/ui/style/Flex.js +0 -1
- package/ui/style/Flex.tsx +0 -1
- package/ui/style/Gap.d.ts +0 -1
- package/ui/style/Gap.js +0 -1
- package/ui/style/Gap.tsx +0 -1
- package/ui/style/Indent.d.ts +0 -1
- package/ui/style/Indent.js +0 -1
- package/ui/style/Indent.tsx +0 -1
- package/ui/style/Padding.d.ts +0 -1
- package/ui/style/Padding.js +0 -1
- package/ui/style/Padding.tsx +0 -1
- package/ui/style/Radius.d.ts +0 -1
- package/ui/style/Radius.js +0 -1
- package/ui/style/Radius.tsx +0 -1
- package/ui/style/Scroll.d.ts +0 -1
- package/ui/style/Scroll.js +0 -1
- package/ui/style/Scroll.tsx +0 -1
- package/ui/style/Shadow.d.ts +0 -1
- package/ui/style/Shadow.js +0 -1
- package/ui/style/Shadow.tsx +0 -1
- package/ui/style/Space.d.ts +0 -1
- package/ui/style/Space.js +0 -1
- package/ui/style/Space.tsx +0 -1
- package/ui/style/Status.d.ts +0 -1
- package/ui/style/Status.js +0 -1
- package/ui/style/Status.tsx +0 -1
- package/ui/style/Stroke.d.ts +0 -1
- package/ui/style/Stroke.js +0 -1
- package/ui/style/Stroke.tsx +0 -1
- package/ui/style/getRadiusClass.md +1 -1
- package/ui/style/getSpaceClass.md +1 -1
- package/ui/style/getTypographyClass.md +1 -1
- package/ui/style/getWidthClass.md +1 -1
- package/ui/table/Cell.d.ts +0 -2
- package/ui/table/Cell.js +0 -2
- package/ui/table/Cell.tsx +0 -2
- package/ui/table/Table.d.ts +0 -3
- package/ui/table/Table.js +0 -2
- package/ui/table/Table.tsx +0 -3
- package/ui/transition/CollapseTransition.d.ts +0 -2
- package/ui/transition/CollapseTransition.js +0 -2
- package/ui/transition/CollapseTransition.tsx +0 -2
- package/ui/transition/FadeTransition.d.ts +0 -2
- package/ui/transition/FadeTransition.js +0 -2
- package/ui/transition/FadeTransition.tsx +0 -2
- package/ui/transition/HorizontalTransition.d.ts +0 -2
- package/ui/transition/HorizontalTransition.js +0 -2
- package/ui/transition/HorizontalTransition.tsx +0 -2
- package/ui/transition/Transition.d.ts +0 -2
- package/ui/transition/Transition.js +0 -2
- package/ui/transition/Transition.tsx +0 -2
- package/ui/transition/VerticalTransition.d.ts +0 -2
- package/ui/transition/VerticalTransition.js +0 -2
- package/ui/transition/VerticalTransition.tsx +0 -2
- package/ui/tree/TreeApp.d.ts +0 -2
- package/ui/tree/TreeApp.js +0 -2
- package/ui/tree/TreeApp.tsx +0 -2
- package/ui/tree/TreeBreadcrumbs.d.ts +0 -1
- package/ui/tree/TreeBreadcrumbs.js +0 -1
- package/ui/tree/TreeBreadcrumbs.tsx +0 -1
- package/ui/tree/TreeButton.d.ts +0 -1
- package/ui/tree/TreeButton.js +0 -1
- package/ui/tree/TreeButton.tsx +0 -1
- package/ui/tree/TreeCard.d.ts +0 -1
- package/ui/tree/TreeCard.js +0 -1
- package/ui/tree/TreeCard.tsx +0 -1
- package/ui/tree/TreeCards.d.ts +0 -1
- package/ui/tree/TreeCards.js +0 -1
- package/ui/tree/TreeCards.tsx +0 -1
- package/ui/tree/TreeContext.d.ts +0 -2
- package/ui/tree/TreeContext.js +0 -2
- package/ui/tree/TreeContext.tsx +0 -2
- package/ui/tree/TreeLink.d.ts +0 -1
- package/ui/tree/TreeLink.js +0 -1
- package/ui/tree/TreeLink.tsx +0 -1
- package/ui/tree/TreeMarkup.d.ts +0 -1
- package/ui/tree/TreeMarkup.js +0 -1
- package/ui/tree/TreeMarkup.tsx +0 -1
- package/ui/tree/TreeMenu.d.ts +0 -4
- package/ui/tree/TreeMenu.js +0 -4
- package/ui/tree/TreeMenu.tsx +0 -4
- package/ui/tree/TreePage.d.ts +0 -1
- package/ui/tree/TreePage.js +0 -1
- package/ui/tree/TreePage.tsx +0 -1
- package/ui/tree/TreeRouter.d.ts +0 -1
- package/ui/tree/TreeRouter.js +0 -1
- package/ui/tree/TreeRouter.tsx +0 -1
- package/ui/tree/TreeSidebar.d.ts +0 -2
- package/ui/tree/TreeSidebar.js +0 -2
- package/ui/tree/TreeSidebar.md +2 -1
- package/ui/tree/TreeSidebar.tsx +0 -2
- package/ui/util/context.d.ts +0 -1
- package/ui/util/context.ts +0 -1
- package/ui/util/css.d.ts +0 -2
- package/ui/util/css.js +0 -2
- package/ui/util/css.ts +0 -2
- package/ui/util/notice.d.ts +0 -7
- package/ui/util/notice.js +0 -7
- package/ui/util/notice.ts +0 -7
- package/util/ansi.d.ts +0 -1
- package/util/ansi.js +0 -1
- package/util/array.d.ts +0 -70
- package/util/array.js +0 -57
- package/util/async.d.ts +0 -8
- package/util/async.js +0 -7
- package/util/base64.d.ts +0 -6
- package/util/base64.js +0 -6
- package/util/bytes.d.ts +0 -3
- package/util/bytes.js +0 -3
- package/util/class.d.ts +0 -5
- package/util/class.js +0 -5
- package/util/color.d.ts +0 -16
- package/util/color.js +0 -16
- package/util/crypto.d.ts +0 -5
- package/util/crypto.js +0 -5
- package/util/currency.d.ts +0 -8
- package/util/currency.js +0 -8
- package/util/data.d.ts +0 -11
- package/util/data.js +0 -4
- package/util/date.d.ts +0 -18
- package/util/date.js +0 -18
- package/util/debug.d.ts +0 -12
- package/util/debug.js +0 -12
- package/util/dictionary.d.ts +0 -26
- package/util/dictionary.js +0 -24
- package/util/diff.d.ts +0 -7
- package/util/diff.js +0 -2
- package/util/dispose.d.ts +5 -41
- package/util/dispose.js +5 -41
- package/util/duration.d.ts +0 -28
- package/util/duration.js +0 -28
- package/util/element.d.ts +0 -8
- package/util/element.js +0 -6
- package/util/entity.d.ts +0 -3
- package/util/entry.d.ts +0 -5
- package/util/entry.js +0 -4
- package/util/env.d.ts +0 -4
- package/util/env.js +0 -4
- package/util/equal.d.ts +0 -22
- package/util/equal.js +0 -22
- package/util/error.d.ts +0 -7
- package/util/error.js +0 -7
- package/util/file.d.ts +0 -6
- package/util/file.js +0 -6
- package/util/filter.d.ts +0 -3
- package/util/filter.js +0 -3
- package/util/focus.d.ts +0 -1
- package/util/focus.js +0 -1
- package/util/format.d.ts +0 -14
- package/util/format.js +0 -14
- package/util/function.d.ts +0 -3
- package/util/function.js +0 -3
- package/util/geo.d.ts +0 -4
- package/util/geo.js +0 -4
- package/util/hash.d.ts +0 -2
- package/util/hash.js +0 -2
- package/util/http.d.ts +0 -15
- package/util/http.js +0 -15
- package/util/hydrate.d.ts +0 -2
- package/util/hydrate.js +0 -2
- package/util/item.d.ts +0 -4
- package/util/item.js +0 -4
- package/util/iterate.d.ts +0 -11
- package/util/iterate.js +0 -9
- package/util/jwt.d.ts +0 -7
- package/util/jwt.js +0 -7
- package/util/lazy.d.ts +0 -1
- package/util/link.d.ts +0 -5
- package/util/link.js +0 -5
- package/util/log.d.ts +0 -3
- package/util/log.js +0 -3
- package/util/map.d.ts +0 -11
- package/util/map.js +0 -10
- package/util/merge.d.ts +0 -5
- package/util/merge.js +0 -1
- package/util/null.d.ts +0 -3
- package/util/null.js +0 -3
- package/util/number.d.ts +2 -19
- package/util/number.js +2 -19
- package/util/object.d.ts +0 -34
- package/util/object.js +0 -22
- package/util/path.d.ts +0 -15
- package/util/path.js +0 -8
- package/util/query.d.ts +0 -7
- package/util/query.js +0 -7
- package/util/random.d.ts +0 -10
- package/util/random.js +0 -10
- package/util/regexp.d.ts +0 -28
- package/util/regexp.js +0 -18
- package/util/sequence.d.ts +0 -6
- package/util/sequence.js +0 -6
- package/util/serialise.d.ts +0 -1
- package/util/serialise.js +0 -1
- package/util/set.d.ts +0 -7
- package/util/set.js +0 -7
- package/util/sort.d.ts +0 -3
- package/util/sort.js +0 -3
- package/util/source.d.ts +0 -2
- package/util/source.js +0 -2
- package/util/start.d.ts +0 -13
- package/util/start.js +0 -13
- package/util/string.d.ts +0 -13
- package/util/string.js +0 -12
- package/util/timeout.d.ts +0 -14
- package/util/timeout.js +0 -14
- package/util/transform.d.ts +0 -8
- package/util/transform.js +0 -7
- package/util/tree.d.ts +0 -1
- package/util/tree.js +0 -1
- package/util/undefined.d.ts +0 -3
- package/util/undefined.js +0 -3
- package/util/units.d.ts +0 -11
- package/util/units.js +0 -11
- package/util/update.d.ts +1 -3
- package/util/update.js +0 -2
- package/util/uri.d.ts +0 -4
- package/util/uri.js +0 -4
- package/util/url.d.ts +1 -28
- package/util/url.js +0 -27
- package/util/uuid.d.ts +0 -3
- package/util/uuid.js +0 -3
- package/util/validate.d.ts +0 -5
- package/util/validate.js +0 -5
- package/util/xml.d.ts +0 -2
- package/util/xml.js +0 -2
|
@@ -5,24 +5,12 @@ import { ThroughAPIProvider } from "./ThroughAPIProvider.js";
|
|
|
5
5
|
* Provider that logs fetches to the console to keep useful request/response logs in production.
|
|
6
6
|
* - Defaults to logging requests, responses, and errors via the `log` utilities; each can be overridden.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
9
|
-
* const api = new LoggingAPIProvider(source);
|
|
10
|
-
* await api.fetch(request); // logs request and response
|
|
11
8
|
* @see https://shelving.cc/api/LoggingAPIProvider
|
|
12
9
|
*/
|
|
13
10
|
export declare class LoggingAPIProvider<P, R> extends ThroughAPIProvider<P, R> {
|
|
14
11
|
protected _logRequest: Callback<[Request]>;
|
|
15
12
|
protected _logResponse: Callback<[Response, Request]>;
|
|
16
13
|
protected _logError: Callback<[reason: unknown, Request]>;
|
|
17
|
-
/**
|
|
18
|
-
* Create a logging provider wrapping a source provider.
|
|
19
|
-
*
|
|
20
|
-
* @param source The source provider whose fetches are logged.
|
|
21
|
-
* @param onRequest Called to log each outgoing request.
|
|
22
|
-
* @param onResponse Called to log each response.
|
|
23
|
-
* @param onError Called to log each error.
|
|
24
|
-
* @example new LoggingAPIProvider(source)
|
|
25
|
-
*/
|
|
26
14
|
constructor(source: APIProvider<P, R>,
|
|
27
15
|
/** Log requests. */
|
|
28
16
|
onRequest?: Callback<[Request]>,
|
|
@@ -30,14 +18,6 @@ export declare class LoggingAPIProvider<P, R> extends ThroughAPIProvider<P, R> {
|
|
|
30
18
|
onResponse?: Callback<[Response, Request]>,
|
|
31
19
|
/** Log errors for requests. */
|
|
32
20
|
onError?: Callback<[reason: unknown, Request]>);
|
|
33
|
-
/**
|
|
34
|
-
* Fetch a request through the source provider, logging the request, response, and any error.
|
|
35
|
-
*
|
|
36
|
-
* @param request The request to fetch.
|
|
37
|
-
* @returns Promise resolving to the response.
|
|
38
|
-
* @throws Rethrows any error thrown by the source provider (after logging it).
|
|
39
|
-
* @example await api.fetch(request)
|
|
40
|
-
* @see https://shelving.cc/api/LoggingAPIProvider/fetch
|
|
41
|
-
*/
|
|
21
|
+
/** Log the request, response, and any error while fetching. */
|
|
42
22
|
fetch(request: Request): Promise<Response>;
|
|
43
23
|
}
|
|
@@ -4,24 +4,12 @@ import { ThroughAPIProvider } from "./ThroughAPIProvider.js";
|
|
|
4
4
|
* Provider that logs fetches to the console to keep useful request/response logs in production.
|
|
5
5
|
* - Defaults to logging requests, responses, and errors via the `log` utilities; each can be overridden.
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
8
|
-
* const api = new LoggingAPIProvider(source);
|
|
9
|
-
* await api.fetch(request); // logs request and response
|
|
10
7
|
* @see https://shelving.cc/api/LoggingAPIProvider
|
|
11
8
|
*/
|
|
12
9
|
export class LoggingAPIProvider extends ThroughAPIProvider {
|
|
13
10
|
_logRequest;
|
|
14
11
|
_logResponse;
|
|
15
12
|
_logError;
|
|
16
|
-
/**
|
|
17
|
-
* Create a logging provider wrapping a source provider.
|
|
18
|
-
*
|
|
19
|
-
* @param source The source provider whose fetches are logged.
|
|
20
|
-
* @param onRequest Called to log each outgoing request.
|
|
21
|
-
* @param onResponse Called to log each response.
|
|
22
|
-
* @param onError Called to log each error.
|
|
23
|
-
* @example new LoggingAPIProvider(source)
|
|
24
|
-
*/
|
|
25
13
|
constructor(source,
|
|
26
14
|
/** Log requests. */
|
|
27
15
|
onRequest = logRequest,
|
|
@@ -34,15 +22,7 @@ export class LoggingAPIProvider extends ThroughAPIProvider {
|
|
|
34
22
|
this._logResponse = onResponse;
|
|
35
23
|
this._logError = onError;
|
|
36
24
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Fetch a request through the source provider, logging the request, response, and any error.
|
|
39
|
-
*
|
|
40
|
-
* @param request The request to fetch.
|
|
41
|
-
* @returns Promise resolving to the response.
|
|
42
|
-
* @throws Rethrows any error thrown by the source provider (after logging it).
|
|
43
|
-
* @example await api.fetch(request)
|
|
44
|
-
* @see https://shelving.cc/api/LoggingAPIProvider/fetch
|
|
45
|
-
*/
|
|
25
|
+
/** Log the request, response, and any error while fetching. */
|
|
46
26
|
async fetch(request) {
|
|
47
27
|
try {
|
|
48
28
|
this._logRequest(request);
|
|
@@ -36,10 +36,6 @@ export type MockAPIResponseCall = {
|
|
|
36
36
|
* - The source provider's `fetch()` is never called — this provider intercepts all fetches and routes them through a `RequestHandler`.
|
|
37
37
|
* - Records `requestCalls`, `fetchCalls`, and `responseCalls` so tests can assert on what happened.
|
|
38
38
|
*
|
|
39
|
-
* @example
|
|
40
|
-
* const api = new MockAPIProvider();
|
|
41
|
-
* const result = await api.call(endpoint, payload);
|
|
42
|
-
* expect(api.fetchCalls).toHaveLength(1);
|
|
43
39
|
* @see https://shelving.cc/api/MockAPIProvider
|
|
44
40
|
*/
|
|
45
41
|
export declare class MockAPIProvider<P = unknown, R = unknown> extends ThroughAPIProvider<P, R> {
|
|
@@ -63,44 +59,11 @@ export declare class MockAPIProvider<P = unknown, R = unknown> extends ThroughAP
|
|
|
63
59
|
* @see https://shelving.cc/api/MockAPIProvider/handler
|
|
64
60
|
*/
|
|
65
61
|
readonly handler: RequestHandler;
|
|
66
|
-
/**
|
|
67
|
-
* Create a mock provider that serves fetches from a handler.
|
|
68
|
-
*
|
|
69
|
-
* @param handler The handler that produces a response for each request (defaults to echoing the request).
|
|
70
|
-
* @param source The source provider used to build requests and parse responses.
|
|
71
|
-
* @example new MockAPIProvider()
|
|
72
|
-
*/
|
|
73
62
|
constructor(handler?: RequestHandler, source?: APIProvider<P, R>);
|
|
74
|
-
/**
|
|
75
|
-
* Build a request via the source provider, recording the endpoint and payload in `requestCalls`.
|
|
76
|
-
*
|
|
77
|
-
* @param endpoint The endpoint to build a request for.
|
|
78
|
-
* @param payload The payload to send.
|
|
79
|
-
* @param options Optional request options.
|
|
80
|
-
* @param caller The calling function used for error stack traces.
|
|
81
|
-
* @returns The built request.
|
|
82
|
-
* @example api.createRequest(endpoint, payload)
|
|
83
|
-
* @see https://shelving.cc/api/MockAPIProvider/createRequest
|
|
84
|
-
*/
|
|
63
|
+
/** Record the endpoint and payload in `requestCalls` while building the request. */
|
|
85
64
|
createRequest<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, options?: RequestOptions, caller?: AnyCaller): Request;
|
|
86
|
-
/**
|
|
87
|
-
* Parse a response via the source provider, recording the response and result in `responseCalls`.
|
|
88
|
-
*
|
|
89
|
-
* @param endpoint The endpoint the response came from.
|
|
90
|
-
* @param response The response to parse.
|
|
91
|
-
* @param caller The calling function used for error stack traces.
|
|
92
|
-
* @returns Promise resolving to the parsed result.
|
|
93
|
-
* @example await api.parseResponse(endpoint, response)
|
|
94
|
-
* @see https://shelving.cc/api/MockAPIProvider/parseResponse
|
|
95
|
-
*/
|
|
65
|
+
/** Record the response and result in `responseCalls` while parsing the response. */
|
|
96
66
|
parseResponse<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, response: Response, caller?: AnyCaller): Promise<RR>;
|
|
97
|
-
/**
|
|
98
|
-
* Serve a request through the handler instead of the network, recording it in `fetchCalls`.
|
|
99
|
-
*
|
|
100
|
-
* @param request The request to handle.
|
|
101
|
-
* @returns Promise resolving to the handler's response.
|
|
102
|
-
* @example await api.fetch(request)
|
|
103
|
-
* @see https://shelving.cc/api/MockAPIProvider/fetch
|
|
104
|
-
*/
|
|
67
|
+
/** Serve the request through the handler instead of the network, recording it in `fetchCalls`. */
|
|
105
68
|
fetch(request: Request): Promise<Response>;
|
|
106
69
|
}
|
|
@@ -11,10 +11,6 @@ async function _mockHandler(request) {
|
|
|
11
11
|
* - The source provider's `fetch()` is never called — this provider intercepts all fetches and routes them through a `RequestHandler`.
|
|
12
12
|
* - Records `requestCalls`, `fetchCalls`, and `responseCalls` so tests can assert on what happened.
|
|
13
13
|
*
|
|
14
|
-
* @example
|
|
15
|
-
* const api = new MockAPIProvider();
|
|
16
|
-
* const result = await api.call(endpoint, payload);
|
|
17
|
-
* expect(api.fetchCalls).toHaveLength(1);
|
|
18
14
|
* @see https://shelving.cc/api/MockAPIProvider
|
|
19
15
|
*/
|
|
20
16
|
export class MockAPIProvider extends ThroughAPIProvider {
|
|
@@ -38,56 +34,23 @@ export class MockAPIProvider extends ThroughAPIProvider {
|
|
|
38
34
|
* @see https://shelving.cc/api/MockAPIProvider/handler
|
|
39
35
|
*/
|
|
40
36
|
handler;
|
|
41
|
-
/**
|
|
42
|
-
* Create a mock provider that serves fetches from a handler.
|
|
43
|
-
*
|
|
44
|
-
* @param handler The handler that produces a response for each request (defaults to echoing the request).
|
|
45
|
-
* @param source The source provider used to build requests and parse responses.
|
|
46
|
-
* @example new MockAPIProvider()
|
|
47
|
-
*/
|
|
48
37
|
constructor(handler = _mockHandler, source = new ClientAPIProvider({ url: "https://api.mock.com" })) {
|
|
49
38
|
super(source);
|
|
50
39
|
this.handler = handler;
|
|
51
40
|
}
|
|
52
|
-
/**
|
|
53
|
-
* Build a request via the source provider, recording the endpoint and payload in `requestCalls`.
|
|
54
|
-
*
|
|
55
|
-
* @param endpoint The endpoint to build a request for.
|
|
56
|
-
* @param payload The payload to send.
|
|
57
|
-
* @param options Optional request options.
|
|
58
|
-
* @param caller The calling function used for error stack traces.
|
|
59
|
-
* @returns The built request.
|
|
60
|
-
* @example api.createRequest(endpoint, payload)
|
|
61
|
-
* @see https://shelving.cc/api/MockAPIProvider/createRequest
|
|
62
|
-
*/
|
|
41
|
+
/** Record the endpoint and payload in `requestCalls` while building the request. */
|
|
63
42
|
createRequest(endpoint, payload, options, caller = this.createRequest) {
|
|
64
43
|
const request = super.createRequest(endpoint, payload, options, caller);
|
|
65
44
|
this.requestCalls.push({ endpoint, payload, options, request });
|
|
66
45
|
return request;
|
|
67
46
|
}
|
|
68
|
-
/**
|
|
69
|
-
* Parse a response via the source provider, recording the response and result in `responseCalls`.
|
|
70
|
-
*
|
|
71
|
-
* @param endpoint The endpoint the response came from.
|
|
72
|
-
* @param response The response to parse.
|
|
73
|
-
* @param caller The calling function used for error stack traces.
|
|
74
|
-
* @returns Promise resolving to the parsed result.
|
|
75
|
-
* @example await api.parseResponse(endpoint, response)
|
|
76
|
-
* @see https://shelving.cc/api/MockAPIProvider/parseResponse
|
|
77
|
-
*/
|
|
47
|
+
/** Record the response and result in `responseCalls` while parsing the response. */
|
|
78
48
|
async parseResponse(endpoint, response, caller = this.parseResponse) {
|
|
79
49
|
const result = await super.parseResponse(endpoint, response, caller);
|
|
80
50
|
this.responseCalls.push({ endpoint, response, result });
|
|
81
51
|
return result;
|
|
82
52
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Serve a request through the handler instead of the network, recording it in `fetchCalls`.
|
|
85
|
-
*
|
|
86
|
-
* @param request The request to handle.
|
|
87
|
-
* @returns Promise resolving to the handler's response.
|
|
88
|
-
* @example await api.fetch(request)
|
|
89
|
-
* @see https://shelving.cc/api/MockAPIProvider/fetch
|
|
90
|
-
*/
|
|
53
|
+
/** Serve the request through the handler instead of the network, recording it in `fetchCalls`. */
|
|
91
54
|
async fetch(request) {
|
|
92
55
|
const response = await this.handler(request);
|
|
93
56
|
this.fetchCalls.push({ request, response });
|
|
@@ -5,22 +5,8 @@ import { MockAPIProvider } from "./MockAPIProvider.js";
|
|
|
5
5
|
* Provider that mocks an API that calls and matches an array of `EndpointHandler` objects returned from `Endpoint.handler()`
|
|
6
6
|
* - Used to test server-side API code, calls against an API made up of multiple `Endpoint` instances.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
9
|
-
* const endpoint = POST("/squared", INTEGER, INTEGER); // Create an endpoint designed to square its input number.
|
|
10
|
-
* const handlers = [endpoint.handler(num => num * num)]; // Implement handlers for the endpoints.
|
|
11
|
-
* const api = new MockEnpdointAPIProvider(handlers); // Create a new mock provider.
|
|
12
|
-
* const result = await api.fetch(endpoint, 4); // Mock a call to the endpoint through the provider.
|
|
13
|
-
* expect(result).toBe(16);
|
|
14
8
|
* @see https://shelving.cc/api/MockEndpointAPIProvider
|
|
15
9
|
*/
|
|
16
10
|
export declare class MockEndpointAPIProvider<P, R, C> extends MockAPIProvider<P, R> {
|
|
17
|
-
/**
|
|
18
|
-
* Create a mock provider that routes calls through an array of endpoint handlers instead of the network.
|
|
19
|
-
*
|
|
20
|
-
* @param handlers The endpoint handlers (from `Endpoint.handler()`) that serve matching requests.
|
|
21
|
-
* @param context The context value passed to each handler.
|
|
22
|
-
* @param source Optional source provider used to build requests and parse responses.
|
|
23
|
-
* @example new MockEndpointAPIProvider(handlers, context)
|
|
24
|
-
*/
|
|
25
11
|
constructor(handlers: EndpointHandlers<C>, context: C, source?: ClientAPIProvider<P, R>);
|
|
26
12
|
}
|
|
@@ -4,23 +4,9 @@ import { MockAPIProvider } from "./MockAPIProvider.js";
|
|
|
4
4
|
* Provider that mocks an API that calls and matches an array of `EndpointHandler` objects returned from `Endpoint.handler()`
|
|
5
5
|
* - Used to test server-side API code, calls against an API made up of multiple `Endpoint` instances.
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
8
|
-
* const endpoint = POST("/squared", INTEGER, INTEGER); // Create an endpoint designed to square its input number.
|
|
9
|
-
* const handlers = [endpoint.handler(num => num * num)]; // Implement handlers for the endpoints.
|
|
10
|
-
* const api = new MockEnpdointAPIProvider(handlers); // Create a new mock provider.
|
|
11
|
-
* const result = await api.fetch(endpoint, 4); // Mock a call to the endpoint through the provider.
|
|
12
|
-
* expect(result).toBe(16);
|
|
13
7
|
* @see https://shelving.cc/api/MockEndpointAPIProvider
|
|
14
8
|
*/
|
|
15
9
|
export class MockEndpointAPIProvider extends MockAPIProvider {
|
|
16
|
-
/**
|
|
17
|
-
* Create a mock provider that routes calls through an array of endpoint handlers instead of the network.
|
|
18
|
-
*
|
|
19
|
-
* @param handlers The endpoint handlers (from `Endpoint.handler()`) that serve matching requests.
|
|
20
|
-
* @param context The context value passed to each handler.
|
|
21
|
-
* @param source Optional source provider used to build requests and parse responses.
|
|
22
|
-
* @example new MockEndpointAPIProvider(handlers, context)
|
|
23
|
-
*/
|
|
24
10
|
constructor(handlers, context, source) {
|
|
25
11
|
super(request => handleEndpoints(this.url, handlers, request, context, this.call), source);
|
|
26
12
|
}
|
|
@@ -8,21 +8,9 @@ import { APIProvider } from "./APIProvider.js";
|
|
|
8
8
|
* - Extend this when you want to intercept only selected API operations, such as injecting auth headers or logging.
|
|
9
9
|
* - Implements `Sourceable` so wrapped providers are discoverable via `getSource()` / `requireSource()`.
|
|
10
10
|
*
|
|
11
|
-
* @example
|
|
12
|
-
* class AuthAPIProvider extends ThroughAPIProvider {
|
|
13
|
-
* override createRequest(endpoint, payload, options, caller) {
|
|
14
|
-
* return super.createRequest(endpoint, payload, { ...options, headers: { authorization: TOKEN } }, caller);
|
|
15
|
-
* }
|
|
16
|
-
* }
|
|
17
|
-
*
|
|
18
11
|
* @see https://shelving.cc/api/ThroughAPIProvider
|
|
19
12
|
*/
|
|
20
13
|
export declare class ThroughAPIProvider<P, R> extends APIProvider<P, R> implements Sourceable<APIProvider<P, R>> {
|
|
21
|
-
/**
|
|
22
|
-
* The base URL, delegated to the wrapped `source` provider.
|
|
23
|
-
*
|
|
24
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/url
|
|
25
|
-
*/
|
|
26
14
|
get url(): URL;
|
|
27
15
|
/**
|
|
28
16
|
* The wrapped source provider that operations delegate to.
|
|
@@ -30,56 +18,10 @@ export declare class ThroughAPIProvider<P, R> extends APIProvider<P, R> implemen
|
|
|
30
18
|
* @see https://shelving.cc/api/ThroughAPIProvider/source
|
|
31
19
|
*/
|
|
32
20
|
readonly source: APIProvider<P, R>;
|
|
33
|
-
/**
|
|
34
|
-
* Wrap a source `APIProvider`.
|
|
35
|
-
*
|
|
36
|
-
* @param source The provider that every operation delegates to.
|
|
37
|
-
* @example new ThroughAPIProvider(clientProvider)
|
|
38
|
-
* @see https://shelving.cc/api/ThroughAPIProvider
|
|
39
|
-
*/
|
|
40
21
|
constructor(source: APIProvider<P, R>);
|
|
41
|
-
/**
|
|
42
|
-
* Render the request URL by delegating to the source provider.
|
|
43
|
-
*
|
|
44
|
-
* @param endpoint The endpoint whose path is rendered into the base URL.
|
|
45
|
-
* @param payload The payload supplying `{placeholder}` and query-param values.
|
|
46
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
47
|
-
* @returns The fully resolved request `URL`.
|
|
48
|
-
* @example provider.renderURL(getUser, { id: "abc" })
|
|
49
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/renderURL
|
|
50
|
-
*/
|
|
51
22
|
renderURL<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, caller?: AnyCaller): URL;
|
|
52
|
-
/**
|
|
53
|
-
* Create the request by delegating to the source provider.
|
|
54
|
-
*
|
|
55
|
-
* @param endpoint The endpoint the request targets.
|
|
56
|
-
* @param payload The payload to embed into the `Request`.
|
|
57
|
-
* @param options The `RequestOptions` to use, merged over the provider's own options.
|
|
58
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
59
|
-
* @returns The created `Request`.
|
|
60
|
-
* @example provider.createRequest(getUser, { id: "abc" })
|
|
61
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/createRequest
|
|
62
|
-
*/
|
|
63
23
|
createRequest<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, options?: RequestOptions, caller?: AnyCaller): Request;
|
|
64
|
-
/**
|
|
65
|
-
* Parse the response by delegating to the source provider.
|
|
66
|
-
*
|
|
67
|
-
* @param endpoint The endpoint the response was produced for.
|
|
68
|
-
* @param response The `Response` to parse.
|
|
69
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
70
|
-
* @returns A promise resolving to the parsed result.
|
|
71
|
-
* @example await provider.parseResponse(getUser, response)
|
|
72
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/parseResponse
|
|
73
|
-
*/
|
|
74
24
|
parseResponse<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, response: Response, caller?: AnyCaller): Promise<RR>;
|
|
75
|
-
/**
|
|
76
|
-
* Send the request by delegating to the source provider.
|
|
77
|
-
*
|
|
78
|
-
* @param request The `Request` to send.
|
|
79
|
-
* @returns A promise resolving to the `Response`.
|
|
80
|
-
* @example await provider.fetch(request)
|
|
81
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/fetch
|
|
82
|
-
*/
|
|
83
25
|
fetch(request: Request): Promise<Response>;
|
|
84
26
|
[Symbol.asyncDispose](): Promise<void>;
|
|
85
27
|
}
|
|
@@ -5,21 +5,9 @@ import { APIProvider } from "./APIProvider.js";
|
|
|
5
5
|
* - Extend this when you want to intercept only selected API operations, such as injecting auth headers or logging.
|
|
6
6
|
* - Implements `Sourceable` so wrapped providers are discoverable via `getSource()` / `requireSource()`.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
9
|
-
* class AuthAPIProvider extends ThroughAPIProvider {
|
|
10
|
-
* override createRequest(endpoint, payload, options, caller) {
|
|
11
|
-
* return super.createRequest(endpoint, payload, { ...options, headers: { authorization: TOKEN } }, caller);
|
|
12
|
-
* }
|
|
13
|
-
* }
|
|
14
|
-
*
|
|
15
8
|
* @see https://shelving.cc/api/ThroughAPIProvider
|
|
16
9
|
*/
|
|
17
10
|
export class ThroughAPIProvider extends APIProvider {
|
|
18
|
-
/**
|
|
19
|
-
* The base URL, delegated to the wrapped `source` provider.
|
|
20
|
-
*
|
|
21
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/url
|
|
22
|
-
*/
|
|
23
11
|
get url() {
|
|
24
12
|
return this.source.url;
|
|
25
13
|
}
|
|
@@ -29,65 +17,19 @@ export class ThroughAPIProvider extends APIProvider {
|
|
|
29
17
|
* @see https://shelving.cc/api/ThroughAPIProvider/source
|
|
30
18
|
*/
|
|
31
19
|
source;
|
|
32
|
-
/**
|
|
33
|
-
* Wrap a source `APIProvider`.
|
|
34
|
-
*
|
|
35
|
-
* @param source The provider that every operation delegates to.
|
|
36
|
-
* @example new ThroughAPIProvider(clientProvider)
|
|
37
|
-
* @see https://shelving.cc/api/ThroughAPIProvider
|
|
38
|
-
*/
|
|
39
20
|
constructor(source) {
|
|
40
21
|
super();
|
|
41
22
|
this.source = source;
|
|
42
23
|
}
|
|
43
|
-
/**
|
|
44
|
-
* Render the request URL by delegating to the source provider.
|
|
45
|
-
*
|
|
46
|
-
* @param endpoint The endpoint whose path is rendered into the base URL.
|
|
47
|
-
* @param payload The payload supplying `{placeholder}` and query-param values.
|
|
48
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
49
|
-
* @returns The fully resolved request `URL`.
|
|
50
|
-
* @example provider.renderURL(getUser, { id: "abc" })
|
|
51
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/renderURL
|
|
52
|
-
*/
|
|
53
24
|
renderURL(endpoint, payload, caller = this.renderURL) {
|
|
54
25
|
return this.source.renderURL(endpoint, payload, caller);
|
|
55
26
|
}
|
|
56
|
-
/**
|
|
57
|
-
* Create the request by delegating to the source provider.
|
|
58
|
-
*
|
|
59
|
-
* @param endpoint The endpoint the request targets.
|
|
60
|
-
* @param payload The payload to embed into the `Request`.
|
|
61
|
-
* @param options The `RequestOptions` to use, merged over the provider's own options.
|
|
62
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
63
|
-
* @returns The created `Request`.
|
|
64
|
-
* @example provider.createRequest(getUser, { id: "abc" })
|
|
65
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/createRequest
|
|
66
|
-
*/
|
|
67
27
|
createRequest(endpoint, payload, options, caller = this.createRequest) {
|
|
68
28
|
return this.source.createRequest(endpoint, payload, options, caller);
|
|
69
29
|
}
|
|
70
|
-
/**
|
|
71
|
-
* Parse the response by delegating to the source provider.
|
|
72
|
-
*
|
|
73
|
-
* @param endpoint The endpoint the response was produced for.
|
|
74
|
-
* @param response The `Response` to parse.
|
|
75
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
76
|
-
* @returns A promise resolving to the parsed result.
|
|
77
|
-
* @example await provider.parseResponse(getUser, response)
|
|
78
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/parseResponse
|
|
79
|
-
*/
|
|
80
30
|
parseResponse(endpoint, response, caller = this.parseResponse) {
|
|
81
31
|
return this.source.parseResponse(endpoint, response, caller);
|
|
82
32
|
}
|
|
83
|
-
/**
|
|
84
|
-
* Send the request by delegating to the source provider.
|
|
85
|
-
*
|
|
86
|
-
* @param request The `Request` to send.
|
|
87
|
-
* @returns A promise resolving to the `Response`.
|
|
88
|
-
* @example await provider.fetch(request)
|
|
89
|
-
* @see https://shelving.cc/api/ThroughAPIProvider/fetch
|
|
90
|
-
*/
|
|
91
33
|
fetch(request) {
|
|
92
34
|
return this.source.fetch(request);
|
|
93
35
|
}
|
|
@@ -6,35 +6,11 @@ import { ThroughAPIProvider } from "./ThroughAPIProvider.js";
|
|
|
6
6
|
* Provider that validates payloads and results against the endpoint's schemas, so a source of any type is made type-safe.
|
|
7
7
|
* - Payload validation errors bubble up as user-readable strings; result validation errors are wrapped in `ResponseError`.
|
|
8
8
|
*
|
|
9
|
-
* @example
|
|
10
|
-
* const api = new ValidationAPIProvider(source);
|
|
11
|
-
* const result = await api.call(endpoint, payload); // validated payload and result
|
|
12
9
|
* @see https://shelving.cc/api/ValidationAPIProvider
|
|
13
10
|
*/
|
|
14
11
|
export declare class ValidationAPIProvider<P, R> extends ThroughAPIProvider<P, R> {
|
|
15
|
-
/**
|
|
16
|
-
* Build a request via the source provider after validating the payload against the endpoint's payload schema.
|
|
17
|
-
*
|
|
18
|
-
* @param endpoint The endpoint to build a request for.
|
|
19
|
-
* @param payload The payload to validate and send.
|
|
20
|
-
* @param options Optional request options.
|
|
21
|
-
* @param caller The calling function used for error stack traces.
|
|
22
|
-
* @returns The built request.
|
|
23
|
-
* @throws {string} A user-readable validation message if the payload is invalid.
|
|
24
|
-
* @example api.createRequest(endpoint, payload)
|
|
25
|
-
* @see https://shelving.cc/api/ValidationAPIProvider/createRequest
|
|
26
|
-
*/
|
|
12
|
+
/** Validates `payload` against the endpoint's payload schema before delegating; an invalid payload throws a user-readable `string`. */
|
|
27
13
|
createRequest<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, payload: PP, options?: RequestOptions, caller?: AnyCaller): Request;
|
|
28
|
-
/**
|
|
29
|
-
* Parse a response via the source provider, then validate the result against the endpoint's result schema.
|
|
30
|
-
*
|
|
31
|
-
* @param endpoint The endpoint the response came from.
|
|
32
|
-
* @param response The response to parse and validate.
|
|
33
|
-
* @param caller The calling function used for error stack traces.
|
|
34
|
-
* @returns Promise resolving to the validated result.
|
|
35
|
-
* @throws {ResponseError} If the result fails validation (treated as a server/transport problem).
|
|
36
|
-
* @example await api.parseResponse(endpoint, response)
|
|
37
|
-
* @see https://shelving.cc/api/ValidationAPIProvider/parseResponse
|
|
38
|
-
*/
|
|
14
|
+
/** Validates the parsed result against the endpoint's result schema; a failed result is wrapped as a `ResponseError`. */
|
|
39
15
|
parseResponse<PP extends P, RR extends R>(endpoint: Endpoint<PP, RR>, response: Response, caller?: AnyCaller): Promise<RR>;
|
|
40
16
|
}
|
|
@@ -4,39 +4,15 @@ import { ThroughAPIProvider } from "./ThroughAPIProvider.js";
|
|
|
4
4
|
* Provider that validates payloads and results against the endpoint's schemas, so a source of any type is made type-safe.
|
|
5
5
|
* - Payload validation errors bubble up as user-readable strings; result validation errors are wrapped in `ResponseError`.
|
|
6
6
|
*
|
|
7
|
-
* @example
|
|
8
|
-
* const api = new ValidationAPIProvider(source);
|
|
9
|
-
* const result = await api.call(endpoint, payload); // validated payload and result
|
|
10
7
|
* @see https://shelving.cc/api/ValidationAPIProvider
|
|
11
8
|
*/
|
|
12
9
|
export class ValidationAPIProvider extends ThroughAPIProvider {
|
|
13
|
-
/**
|
|
14
|
-
* Build a request via the source provider after validating the payload against the endpoint's payload schema.
|
|
15
|
-
*
|
|
16
|
-
* @param endpoint The endpoint to build a request for.
|
|
17
|
-
* @param payload The payload to validate and send.
|
|
18
|
-
* @param options Optional request options.
|
|
19
|
-
* @param caller The calling function used for error stack traces.
|
|
20
|
-
* @returns The built request.
|
|
21
|
-
* @throws {string} A user-readable validation message if the payload is invalid.
|
|
22
|
-
* @example api.createRequest(endpoint, payload)
|
|
23
|
-
* @see https://shelving.cc/api/ValidationAPIProvider/createRequest
|
|
24
|
-
*/
|
|
10
|
+
/** Validates `payload` against the endpoint's payload schema before delegating; an invalid payload throws a user-readable `string`. */
|
|
25
11
|
createRequest(endpoint, payload, options, caller = this.createRequest) {
|
|
26
12
|
// Validate payload — let thrown strings bubble up as user-readable messages for e.g. form handlers.
|
|
27
13
|
return super.createRequest(endpoint, endpoint.payload.validate(payload), options, caller);
|
|
28
14
|
}
|
|
29
|
-
/**
|
|
30
|
-
* Parse a response via the source provider, then validate the result against the endpoint's result schema.
|
|
31
|
-
*
|
|
32
|
-
* @param endpoint The endpoint the response came from.
|
|
33
|
-
* @param response The response to parse and validate.
|
|
34
|
-
* @param caller The calling function used for error stack traces.
|
|
35
|
-
* @returns Promise resolving to the validated result.
|
|
36
|
-
* @throws {ResponseError} If the result fails validation (treated as a server/transport problem).
|
|
37
|
-
* @example await api.parseResponse(endpoint, response)
|
|
38
|
-
* @see https://shelving.cc/api/ValidationAPIProvider/parseResponse
|
|
39
|
-
*/
|
|
15
|
+
/** Validates the parsed result against the endpoint's result schema; a failed result is wrapped as a `ResponseError`. */
|
|
40
16
|
async parseResponse(endpoint, response, caller = this.parseResponse) {
|
|
41
17
|
try {
|
|
42
18
|
// Validate result — wrap in ResponseError as this is a server/transport problem, not user error.
|
|
@@ -8,26 +8,10 @@ import { ClientAPIProvider } from "./ClientAPIProvider.js";
|
|
|
8
8
|
* Client API provider that always sends request bodies as XML and parses responses as plain text.
|
|
9
9
|
* - Request payloads must be data objects (serialised to XML); results are returned as raw text strings.
|
|
10
10
|
*
|
|
11
|
-
* @example
|
|
12
|
-
* const provider = new XMLAPIProvider({ url: "https://api.example.com" });
|
|
13
|
-
* const xml = await provider.call(getFeed, { id: "abc" });
|
|
14
|
-
*
|
|
15
11
|
* @see https://shelving.cc/api/XMLAPIProvider
|
|
16
12
|
*/
|
|
17
13
|
export declare class XMLAPIProvider<P extends Data = Data, R extends string = string> extends ClientAPIProvider<P, R> {
|
|
18
14
|
protected _createBodyRequest(method: RequestBodyMethod, url: PossibleURL, payload: P, options: RequestOptions, caller: AnyCaller): Request;
|
|
19
|
-
/**
|
|
20
|
-
* Parse a text `Response` for an endpoint.
|
|
21
|
-
* - Non-2xx responses become `ResponseError`.
|
|
22
|
-
* - The response body is always returned as raw text.
|
|
23
|
-
*
|
|
24
|
-
* @param _endpoint The endpoint the response was produced for.
|
|
25
|
-
* @param response The `Response` whose body is read as text.
|
|
26
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
27
|
-
* @returns A promise resolving to the raw text result.
|
|
28
|
-
* @throws {ResponseError} if the response status is non-2xx.
|
|
29
|
-
* @example await provider.parseResponse(getFeed, response)
|
|
30
|
-
* @see https://shelving.cc/api/XMLAPIProvider/parseResponse
|
|
31
|
-
*/
|
|
15
|
+
/** Return the response body as raw text rather than parsing it. */
|
|
32
16
|
parseResponse<PP extends P, RR extends R>(_endpoint: Endpoint<PP, RR>, response: Response, caller?: AnyCaller): Promise<RR>;
|
|
33
17
|
}
|
|
@@ -5,29 +5,13 @@ import { ClientAPIProvider } from "./ClientAPIProvider.js";
|
|
|
5
5
|
* Client API provider that always sends request bodies as XML and parses responses as plain text.
|
|
6
6
|
* - Request payloads must be data objects (serialised to XML); results are returned as raw text strings.
|
|
7
7
|
*
|
|
8
|
-
* @example
|
|
9
|
-
* const provider = new XMLAPIProvider({ url: "https://api.example.com" });
|
|
10
|
-
* const xml = await provider.call(getFeed, { id: "abc" });
|
|
11
|
-
*
|
|
12
8
|
* @see https://shelving.cc/api/XMLAPIProvider
|
|
13
9
|
*/
|
|
14
10
|
export class XMLAPIProvider extends ClientAPIProvider {
|
|
15
11
|
_createBodyRequest(method, url, payload, options, caller) {
|
|
16
12
|
return createXMLRequest(method, url, payload, options, caller);
|
|
17
13
|
}
|
|
18
|
-
/**
|
|
19
|
-
* Parse a text `Response` for an endpoint.
|
|
20
|
-
* - Non-2xx responses become `ResponseError`.
|
|
21
|
-
* - The response body is always returned as raw text.
|
|
22
|
-
*
|
|
23
|
-
* @param _endpoint The endpoint the response was produced for.
|
|
24
|
-
* @param response The `Response` whose body is read as text.
|
|
25
|
-
* @param caller The function to attribute thrown errors to (defaults to this method).
|
|
26
|
-
* @returns A promise resolving to the raw text result.
|
|
27
|
-
* @throws {ResponseError} if the response status is non-2xx.
|
|
28
|
-
* @example await provider.parseResponse(getFeed, response)
|
|
29
|
-
* @see https://shelving.cc/api/XMLAPIProvider/parseResponse
|
|
30
|
-
*/
|
|
14
|
+
/** Return the response body as raw text rather than parsing it. */
|
|
31
15
|
async parseResponse(_endpoint, response, caller = this.parseResponse) {
|
|
32
16
|
const { ok, status } = response;
|
|
33
17
|
const content = await response.text();
|
|
@@ -20,14 +20,6 @@ export declare class EndpointStore<P, R> extends PayloadFetchStore<P, R> {
|
|
|
20
20
|
* @see https://shelving.cc/api/EndpointStore/endpoint
|
|
21
21
|
*/
|
|
22
22
|
readonly endpoint: Endpoint<P, R>;
|
|
23
|
-
/**
|
|
24
|
-
* Create a store that tracks the result of an endpoint call.
|
|
25
|
-
*
|
|
26
|
-
* @param endpoint The endpoint to call.
|
|
27
|
-
* @param payload The payload to call the endpoint with.
|
|
28
|
-
* @param provider The API provider to call the endpoint through.
|
|
29
|
-
* @example new EndpointStore(endpoint, payload, provider)
|
|
30
|
-
*/
|
|
31
23
|
constructor(endpoint: Endpoint<P, R>, payload: P, provider: APIProvider<P, R>);
|
|
32
24
|
protected _fetch(signal: AbortSignal): Promise<R>;
|
|
33
25
|
}
|
|
@@ -19,14 +19,6 @@ export class EndpointStore extends PayloadFetchStore {
|
|
|
19
19
|
* @see https://shelving.cc/api/EndpointStore/endpoint
|
|
20
20
|
*/
|
|
21
21
|
endpoint;
|
|
22
|
-
/**
|
|
23
|
-
* Create a store that tracks the result of an endpoint call.
|
|
24
|
-
*
|
|
25
|
-
* @param endpoint The endpoint to call.
|
|
26
|
-
* @param payload The payload to call the endpoint with.
|
|
27
|
-
* @param provider The API provider to call the endpoint through.
|
|
28
|
-
* @example new EndpointStore(endpoint, payload, provider)
|
|
29
|
-
*/
|
|
30
22
|
constructor(endpoint, payload, provider) {
|
|
31
23
|
super(payload, NONE);
|
|
32
24
|
this.endpoint = endpoint;
|
|
@@ -10,40 +10,12 @@ import type { Identifier } from "../util/item.js";
|
|
|
10
10
|
* - Identifiers are escaped through `Bun.SQL`'s own `sql()` helper rather than naive string quoting, which is more secure.
|
|
11
11
|
* - Requires the `bun` peer dependency and a running Bun environment.
|
|
12
12
|
*
|
|
13
|
-
* @example
|
|
14
|
-
* import { SQL } from "bun";
|
|
15
|
-
* const provider = new BunPostgreSQLProvider(new SQL(process.env.DATABASE_URL));
|
|
16
|
-
*
|
|
17
13
|
* @see https://shelving.cc/bun/BunPostgreSQLProvider
|
|
18
14
|
*/
|
|
19
15
|
export declare class BunPostgreSQLProvider<I extends Identifier = Identifier, T extends Data = Data> extends PostgreSQLProvider<I, T> {
|
|
20
16
|
private _sql;
|
|
21
|
-
/**
|
|
22
|
-
* Create a provider wrapping an existing `Bun.SQL` connection.
|
|
23
|
-
*
|
|
24
|
-
* @param sql The `Bun.SQL` instance to execute queries against.
|
|
25
|
-
* @see https://shelving.cc/bun/BunPostgreSQLProvider
|
|
26
|
-
*/
|
|
27
17
|
constructor(sql: SQL);
|
|
28
|
-
/**
|
|
29
|
-
* Execute an SQL query through the underlying `Bun.SQL` connection.
|
|
30
|
-
*
|
|
31
|
-
* @param strings The tagged-template string parts of the query.
|
|
32
|
-
* @param values The interpolated values bound as query parameters.
|
|
33
|
-
* @returns Promise resolving to the array of result rows.
|
|
34
|
-
* @example provider.exec`SELECT * FROM ${provider.sqlIdentifier("items")}`
|
|
35
|
-
* @see https://shelving.cc/bun/BunPostgreSQLProvider/exec
|
|
36
|
-
*/
|
|
37
18
|
exec<X extends Data>(strings: TemplateStringsArray, ...values: ImmutableArray<unknown>): Promise<ImmutableArray<X>>;
|
|
38
|
-
/**
|
|
39
|
-
* Build an SQL fragment for an identifier, escaped via `Bun.SQL`'s `sql()` helper.
|
|
40
|
-
*
|
|
41
|
-
* Overrides the base implementation because the Bun SQL engine supports first-class identifier wrapping, which is more secure than manual quoting.
|
|
42
|
-
*
|
|
43
|
-
* @param name The identifier (table or column name) to escape.
|
|
44
|
-
* @returns An `SQLFragment` wrapping the escaped identifier.
|
|
45
|
-
* @example provider.sqlIdentifier("items")
|
|
46
|
-
* @see https://shelving.cc/bun/BunPostgreSQLProvider/sqlIdentifier
|
|
47
|
-
*/
|
|
19
|
+
/** Escapes the identifier via `Bun.SQL`'s first-class `sql()` wrapping rather than manual quoting, which is more secure. */
|
|
48
20
|
sqlIdentifier(name: string): SQLFragment;
|
|
49
21
|
}
|