@astrogate/sdk 0.0.0-stage → 0.1.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 +6 -2
- package/THIRD_PARTY_NOTICES.md +17 -0
- package/dist/browser.d.ts +85 -0
- package/dist/browser.js +16 -0
- package/dist/database-binding.d.ts +7 -0
- package/dist/database-binding.js +11 -0
- package/dist/hosted-session.d.ts +1 -0
- package/dist/hosted-session.js +11 -0
- package/dist/http.d.ts +24 -0
- package/dist/http.js +92 -0
- package/dist/inventory.d.ts +7 -0
- package/dist/inventory.js +18 -0
- package/dist/management-read.d.ts +17 -0
- package/dist/management-read.js +104 -0
- package/dist/management.d.ts +347 -0
- package/dist/management.js +137 -0
- package/dist/operator.d.ts +136 -0
- package/dist/operator.js +53 -0
- package/dist/react.d.ts +16 -0
- package/dist/react.js +10 -0
- package/dist/server.d.ts +27 -0
- package/dist/server.js +30 -0
- package/dist/services.d.ts +7 -0
- package/dist/services.js +53 -0
- package/dist/storage.d.ts +68 -0
- package/dist/storage.js +30 -0
- package/dist/tasks.d.ts +42 -0
- package/dist/tasks.js +24 -0
- package/dist/wire.gen.d.ts +7107 -0
- package/dist/wire.gen.js +5 -0
- package/native-provenance.json +15 -0
- package/node_modules/@instantdb/admin/LICENSE +202 -0
- package/node_modules/@instantdb/admin/dist/esm/index.d.ts +607 -0
- package/node_modules/@instantdb/admin/dist/esm/index.js +1036 -0
- package/node_modules/@instantdb/admin/dist/esm/polyfill.d.ts +16 -0
- package/node_modules/@instantdb/admin/dist/esm/polyfill.js +21 -0
- package/node_modules/@instantdb/admin/dist/esm/subscribe.d.ts +38 -0
- package/node_modules/@instantdb/admin/dist/esm/subscribe.js +301 -0
- package/node_modules/@instantdb/admin/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/admin/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/admin/package.json +23 -0
- package/node_modules/@instantdb/core/LICENSE +202 -0
- package/node_modules/@instantdb/core/dist/esm/Connection.d.ts +92 -0
- package/node_modules/@instantdb/core/dist/esm/Connection.js +188 -0
- package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.d.ts +10 -0
- package/node_modules/@instantdb/core/dist/esm/InMemoryStorage.js +25 -0
- package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.d.ts +17 -0
- package/node_modules/@instantdb/core/dist/esm/IndexedDBStorage.js +309 -0
- package/node_modules/@instantdb/core/dist/esm/InstantError.d.ts +6 -0
- package/node_modules/@instantdb/core/dist/esm/InstantError.js +23 -0
- package/node_modules/@instantdb/core/dist/esm/Reactor.d.ts +430 -0
- package/node_modules/@instantdb/core/dist/esm/Reactor.js +2369 -0
- package/node_modules/@instantdb/core/dist/esm/StorageAPI.d.ts +39 -0
- package/node_modules/@instantdb/core/dist/esm/StorageAPI.js +65 -0
- package/node_modules/@instantdb/core/dist/esm/Stream.d.ts +120 -0
- package/node_modules/@instantdb/core/dist/esm/Stream.js +811 -0
- package/node_modules/@instantdb/core/dist/esm/SyncTable.d.ts +144 -0
- package/node_modules/@instantdb/core/dist/esm/SyncTable.js +523 -0
- package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.d.ts +4 -0
- package/node_modules/@instantdb/core/dist/esm/WindowNetworkListener.js +19 -0
- package/node_modules/@instantdb/core/dist/esm/attrTypes.d.ts +25 -0
- package/node_modules/@instantdb/core/dist/esm/attrTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/authAPI.d.ts +64 -0
- package/node_modules/@instantdb/core/dist/esm/authAPI.js +103 -0
- package/node_modules/@instantdb/core/dist/esm/clientTypes.d.ts +40 -0
- package/node_modules/@instantdb/core/dist/esm/clientTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/coreTypes.d.ts +33 -0
- package/node_modules/@instantdb/core/dist/esm/coreTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/createRouteHandler.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/createRouteHandler.js +51 -0
- package/node_modules/@instantdb/core/dist/esm/datalog.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/datalog.js +99 -0
- package/node_modules/@instantdb/core/dist/esm/devtool.d.ts +3 -0
- package/node_modules/@instantdb/core/dist/esm/devtool.js +144 -0
- package/node_modules/@instantdb/core/dist/esm/framework.d.ts +80 -0
- package/node_modules/@instantdb/core/dist/esm/framework.js +243 -0
- package/node_modules/@instantdb/core/dist/esm/helperTypes.d.ts +75 -0
- package/node_modules/@instantdb/core/dist/esm/helperTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/index.d.ts +597 -0
- package/node_modules/@instantdb/core/dist/esm/index.js +649 -0
- package/node_modules/@instantdb/core/dist/esm/infiniteQuery.d.ts +25 -0
- package/node_modules/@instantdb/core/dist/esm/infiniteQuery.js +430 -0
- package/node_modules/@instantdb/core/dist/esm/instaml.d.ts +17 -0
- package/node_modules/@instantdb/core/dist/esm/instaml.js +576 -0
- package/node_modules/@instantdb/core/dist/esm/instaql.d.ts +12 -0
- package/node_modules/@instantdb/core/dist/esm/instaql.js +632 -0
- package/node_modules/@instantdb/core/dist/esm/instatx.d.ts +127 -0
- package/node_modules/@instantdb/core/dist/esm/instatx.js +93 -0
- package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/model/instaqlResult.js +24 -0
- package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/parseSchemaFromJSON.js +142 -0
- package/node_modules/@instantdb/core/dist/esm/presence.d.ts +50 -0
- package/node_modules/@instantdb/core/dist/esm/presence.js +50 -0
- package/node_modules/@instantdb/core/dist/esm/presenceTypes.d.ts +9 -0
- package/node_modules/@instantdb/core/dist/esm/presenceTypes.js +3 -0
- package/node_modules/@instantdb/core/dist/esm/queryTypes.d.ts +271 -0
- package/node_modules/@instantdb/core/dist/esm/queryTypes.js +3 -0
- package/node_modules/@instantdb/core/dist/esm/queryValidation.d.ts +5 -0
- package/node_modules/@instantdb/core/dist/esm/queryValidation.js +287 -0
- package/node_modules/@instantdb/core/dist/esm/reactorTypes.d.ts +29 -0
- package/node_modules/@instantdb/core/dist/esm/reactorTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.d.ts +19 -0
- package/node_modules/@instantdb/core/dist/esm/routeHandlerProtocol.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/rulesTypes.d.ts +85 -0
- package/node_modules/@instantdb/core/dist/esm/rulesTypes.js +1 -0
- package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.d.ts +18 -0
- package/node_modules/@instantdb/core/dist/esm/sanityCheckQueries.js +152 -0
- package/node_modules/@instantdb/core/dist/esm/schema.d.ts +72 -0
- package/node_modules/@instantdb/core/dist/esm/schema.js +128 -0
- package/node_modules/@instantdb/core/dist/esm/schemaTypes.d.ts +244 -0
- package/node_modules/@instantdb/core/dist/esm/schemaTypes.js +106 -0
- package/node_modules/@instantdb/core/dist/esm/store.d.ts +89 -0
- package/node_modules/@instantdb/core/dist/esm/store.js +722 -0
- package/node_modules/@instantdb/core/dist/esm/transactionValidation.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/transactionValidation.js +130 -0
- package/node_modules/@instantdb/core/dist/esm/utils/Deferred.d.ts +8 -0
- package/node_modules/@instantdb/core/dist/esm/utils/Deferred.js +17 -0
- package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.d.ts +80 -0
- package/node_modules/@instantdb/core/dist/esm/utils/PersistedObject.js +448 -0
- package/node_modules/@instantdb/core/dist/esm/utils/dates.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/dates.js +211 -0
- package/node_modules/@instantdb/core/dist/esm/utils/error.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/utils/error.js +8 -0
- package/node_modules/@instantdb/core/dist/esm/utils/fetch.d.ts +125 -0
- package/node_modules/@instantdb/core/dist/esm/utils/fetch.js +31 -0
- package/node_modules/@instantdb/core/dist/esm/utils/flags.d.ts +4 -0
- package/node_modules/@instantdb/core/dist/esm/utils/flags.js +10 -0
- package/node_modules/@instantdb/core/dist/esm/utils/id.d.ts +3 -0
- package/node_modules/@instantdb/core/dist/esm/utils/id.js +25 -0
- package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/utils/linkIndex.js +17 -0
- package/node_modules/@instantdb/core/dist/esm/utils/log.d.ts +6 -0
- package/node_modules/@instantdb/core/dist/esm/utils/log.js +13 -0
- package/node_modules/@instantdb/core/dist/esm/utils/object.d.ts +16 -0
- package/node_modules/@instantdb/core/dist/esm/utils/object.js +143 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pgtime.d.ts +197 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pgtime.js +197 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pick.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/pick.js +9 -0
- package/node_modules/@instantdb/core/dist/esm/utils/strings.d.ts +1 -0
- package/node_modules/@instantdb/core/dist/esm/utils/strings.js +15 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHash.d.ts +15 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHash.js +71 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.d.ts +7 -0
- package/node_modules/@instantdb/core/dist/esm/utils/weakHashLegacy.js +72 -0
- package/node_modules/@instantdb/core/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/core/dist/esm/warningToggle.d.ts +2 -0
- package/node_modules/@instantdb/core/dist/esm/warningToggle.js +4 -0
- package/node_modules/@instantdb/core/package.json +20 -0
- package/node_modules/@instantdb/eventsource/LICENSE +22 -0
- package/node_modules/@instantdb/eventsource/README.md +226 -0
- package/node_modules/@instantdb/eventsource/dist/index.cjs +279 -0
- package/node_modules/@instantdb/eventsource/dist/index.cjs.map +1 -0
- package/node_modules/@instantdb/eventsource/dist/index.d.cts +346 -0
- package/node_modules/@instantdb/eventsource/dist/index.d.ts +346 -0
- package/node_modules/@instantdb/eventsource/dist/index.js +279 -0
- package/node_modules/@instantdb/eventsource/dist/index.js.map +1 -0
- package/node_modules/@instantdb/eventsource/package.json +128 -0
- package/node_modules/@instantdb/eventsource/src/EventSource.ts +614 -0
- package/node_modules/@instantdb/eventsource/src/errors.ts +141 -0
- package/node_modules/@instantdb/eventsource/src/index.ts +3 -0
- package/node_modules/@instantdb/eventsource/src/types.ts +164 -0
- package/node_modules/@instantdb/react/LICENSE +202 -0
- package/node_modules/@instantdb/react/dist/esm/Cursors.d.ts +18 -0
- package/node_modules/@instantdb/react/dist/esm/Cursors.js +103 -0
- package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.d.ts +5 -0
- package/node_modules/@instantdb/react/dist/esm/InstantReactWebDatabase.js +5 -0
- package/node_modules/@instantdb/react/dist/esm/index.d.ts +6 -0
- package/node_modules/@instantdb/react/dist/esm/index.js +22 -0
- package/node_modules/@instantdb/react/dist/esm/init.d.ts +40 -0
- package/node_modules/@instantdb/react/dist/esm/init.js +49 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.d.ts +65 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/HydrationStreamProvider.js +96 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.d.ts +11 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantNextDatabase.js +31 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.d.ts +24 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/InstantSuspenseProvider.js +162 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.d.ts +9 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/getUserFromInstantCookie.js +16 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.d.ts +2 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/htmlescape.js +20 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/index.d.ts +29 -0
- package/node_modules/@instantdb/react/dist/esm/next-ssr/index.js +34 -0
- package/node_modules/@instantdb/react/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/react/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/react/package.json +24 -0
- package/node_modules/@instantdb/react-common/LICENSE +202 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.d.ts +282 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactAbstractDatabase.js +386 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.d.ts +182 -0
- package/node_modules/@instantdb/react-common/dist/esm/InstantReactRoom.js +280 -0
- package/node_modules/@instantdb/react-common/dist/esm/index.d.ts +4 -0
- package/node_modules/@instantdb/react-common/dist/esm/index.js +3 -0
- package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.d.ts +27 -0
- package/node_modules/@instantdb/react-common/dist/esm/useInfiniteQuerySubscription.js +53 -0
- package/node_modules/@instantdb/react-common/dist/esm/useQuery.d.ts +6 -0
- package/node_modules/@instantdb/react-common/dist/esm/useQuery.js +75 -0
- package/node_modules/@instantdb/react-common/dist/esm/useTimeout.d.ts +4 -0
- package/node_modules/@instantdb/react-common/dist/esm/useTimeout.js +17 -0
- package/node_modules/@instantdb/react-common/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/react-common/dist/esm/version.js +2 -0
- package/node_modules/@instantdb/react-common/package.json +22 -0
- package/node_modules/@instantdb/version/LICENSE +202 -0
- package/node_modules/@instantdb/version/dist/esm/index.d.ts +2 -0
- package/node_modules/@instantdb/version/dist/esm/index.js +2 -0
- package/node_modules/@instantdb/version/dist/esm/version.d.ts +2 -0
- package/node_modules/@instantdb/version/dist/esm/version.js +5 -0
- package/node_modules/@instantdb/version/package.json +16 -0
- package/node_modules/@instantdb/webhooks/LICENSE +202 -0
- package/node_modules/@instantdb/webhooks/dist/esm/index.d.ts +587 -0
- package/node_modules/@instantdb/webhooks/dist/esm/index.js +748 -0
- package/node_modules/@instantdb/webhooks/package.json +18 -0
- package/node_modules/cookie/LICENSE +24 -0
- package/node_modules/cookie/README.md +295 -0
- package/node_modules/cookie/dist/index.d.ts +143 -0
- package/node_modules/cookie/dist/index.js +355 -0
- package/node_modules/cookie/dist/index.js.map +1 -0
- package/node_modules/cookie/package.json +57 -0
- package/node_modules/eventsource/LICENSE +22 -0
- package/node_modules/eventsource/README.md +252 -0
- package/node_modules/eventsource/dist/EventSource.d.ts +128 -0
- package/node_modules/eventsource/dist/EventSource.d.ts.map +1 -0
- package/node_modules/eventsource/dist/EventSource.js +556 -0
- package/node_modules/eventsource/dist/EventSource.js.map +1 -0
- package/node_modules/eventsource/dist/errors.d.ts +53 -0
- package/node_modules/eventsource/dist/errors.d.ts.map +1 -0
- package/node_modules/eventsource/dist/errors.js +120 -0
- package/node_modules/eventsource/dist/errors.js.map +1 -0
- package/node_modules/eventsource/dist/index.d.ts +4 -0
- package/node_modules/eventsource/dist/index.d.ts.map +1 -0
- package/node_modules/eventsource/dist/index.js +3 -0
- package/node_modules/eventsource/dist/index.js.map +1 -0
- package/node_modules/eventsource/dist/types.d.ts +156 -0
- package/node_modules/eventsource/dist/types.d.ts.map +1 -0
- package/node_modules/eventsource/dist/types.js +2 -0
- package/node_modules/eventsource/dist/types.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/LICENSE +21 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/README.md +177 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts +35 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js +16 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/errors.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts +4 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js +3 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts +12 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js +509 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/parse.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts +76 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js +59 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts +130 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.d.ts.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/dist/types.js.map +1 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/package.json +96 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/errors.ts +44 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/index.ts +3 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/parse.ts +576 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/stream.ts +118 -0
- package/node_modules/eventsource/node_modules/eventsource-parser/src/types.ts +138 -0
- package/node_modules/eventsource/package.json +103 -0
- package/node_modules/eventsource/src/EventSource.ts +844 -0
- package/node_modules/eventsource/src/errors.ts +141 -0
- package/node_modules/eventsource/src/index.ts +3 -0
- package/node_modules/eventsource/src/types.ts +166 -0
- package/node_modules/eventsource-parser/LICENSE +21 -0
- package/node_modules/eventsource-parser/README.md +157 -0
- package/node_modules/eventsource-parser/dist/index.cjs +177 -0
- package/node_modules/eventsource-parser/dist/index.cjs.map +1 -0
- package/node_modules/eventsource-parser/dist/index.d.cts +169 -0
- package/node_modules/eventsource-parser/dist/index.d.ts +169 -0
- package/node_modules/eventsource-parser/dist/index.js +177 -0
- package/node_modules/eventsource-parser/dist/index.js.map +1 -0
- package/node_modules/eventsource-parser/dist/stream.cjs +29 -0
- package/node_modules/eventsource-parser/dist/stream.cjs.map +1 -0
- package/node_modules/eventsource-parser/dist/stream.d.cts +134 -0
- package/node_modules/eventsource-parser/dist/stream.d.ts +134 -0
- package/node_modules/eventsource-parser/dist/stream.js +30 -0
- package/node_modules/eventsource-parser/dist/stream.js.map +1 -0
- package/node_modules/eventsource-parser/package.json +92 -0
- package/node_modules/eventsource-parser/src/errors.ts +44 -0
- package/node_modules/eventsource-parser/src/index.ts +8 -0
- package/node_modules/eventsource-parser/src/parse.ts +439 -0
- package/node_modules/eventsource-parser/src/stream.ts +107 -0
- package/node_modules/eventsource-parser/src/types.ts +122 -0
- package/node_modules/eventsource-parser/stream.js +2 -0
- package/node_modules/mutative/LICENSE +21 -0
- package/node_modules/mutative/README.md +870 -0
- package/node_modules/mutative/dist/apply.d.ts +31 -0
- package/node_modules/mutative/dist/array.d.ts +45 -0
- package/node_modules/mutative/dist/constant.d.ts +8 -0
- package/node_modules/mutative/dist/create.d.ts +46 -0
- package/node_modules/mutative/dist/current.d.ts +23 -0
- package/node_modules/mutative/dist/draft.d.ts +3 -0
- package/node_modules/mutative/dist/draftify.d.ts +2 -0
- package/node_modules/mutative/dist/error.d.ts +54 -0
- package/node_modules/mutative/dist/index.d.mts +1 -0
- package/node_modules/mutative/dist/index.d.ts +12 -0
- package/node_modules/mutative/dist/index.js +8 -0
- package/node_modules/mutative/dist/index.mjs +3 -0
- package/node_modules/mutative/dist/interface.d.ts +200 -0
- package/node_modules/mutative/dist/internal.d.ts +4 -0
- package/node_modules/mutative/dist/makeCreator.d.ts +54 -0
- package/node_modules/mutative/dist/map.d.ts +15 -0
- package/node_modules/mutative/dist/mutative.cjs.development.js +2126 -0
- package/node_modules/mutative/dist/mutative.cjs.development.js.map +1 -0
- package/node_modules/mutative/dist/mutative.cjs.production.min.js +2 -0
- package/node_modules/mutative/dist/mutative.cjs.production.min.js.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.js +2123 -0
- package/node_modules/mutative/dist/mutative.esm.js.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.mjs +2123 -0
- package/node_modules/mutative/dist/mutative.esm.mjs.map +1 -0
- package/node_modules/mutative/dist/mutative.esm.production.min.mjs +2 -0
- package/node_modules/mutative/dist/mutative.esm.production.min.mjs.map +1 -0
- package/node_modules/mutative/dist/mutative.umd.development.js +2132 -0
- package/node_modules/mutative/dist/mutative.umd.development.js.map +1 -0
- package/node_modules/mutative/dist/mutative.umd.production.min.js +2 -0
- package/node_modules/mutative/dist/mutative.umd.production.min.js.map +1 -0
- package/node_modules/mutative/dist/original.d.ts +19 -0
- package/node_modules/mutative/dist/patch.d.ts +2 -0
- package/node_modules/mutative/dist/rawReturn.d.ts +19 -0
- package/node_modules/mutative/dist/set.d.ts +14 -0
- package/node_modules/mutative/dist/unsafe.d.ts +34 -0
- package/node_modules/mutative/dist/utils/cast.d.ts +13 -0
- package/node_modules/mutative/dist/utils/copy.d.ts +5 -0
- package/node_modules/mutative/dist/utils/deepFreeze.d.ts +1 -0
- package/node_modules/mutative/dist/utils/draft.d.ts +27 -0
- package/node_modules/mutative/dist/utils/finalize.d.ts +13 -0
- package/node_modules/mutative/dist/utils/forEach.d.ts +1 -0
- package/node_modules/mutative/dist/utils/index.d.ts +7 -0
- package/node_modules/mutative/dist/utils/mark.d.ts +2 -0
- package/node_modules/mutative/dist/utils/marker.d.ts +5 -0
- package/node_modules/mutative/dist/utils/proto.d.ts +10 -0
- package/node_modules/mutative/package.json +142 -0
- package/node_modules/mutative/src/apply.ts +239 -0
- package/node_modules/mutative/src/array.ts +679 -0
- package/node_modules/mutative/src/constant.ts +17 -0
- package/node_modules/mutative/src/create.ts +27 -0
- package/node_modules/mutative/src/current.ts +206 -0
- package/node_modules/mutative/src/draft.ts +489 -0
- package/node_modules/mutative/src/draftify.ts +57 -0
- package/node_modules/mutative/src/error.ts +129 -0
- package/node_modules/mutative/src/index.ts +21 -0
- package/node_modules/mutative/src/interface.ts +321 -0
- package/node_modules/mutative/src/internal.ts +5 -0
- package/node_modules/mutative/src/makeCreator.ts +382 -0
- package/node_modules/mutative/src/map.ts +160 -0
- package/node_modules/mutative/src/original.ts +28 -0
- package/node_modules/mutative/src/patch.ts +386 -0
- package/node_modules/mutative/src/rawReturn.ts +41 -0
- package/node_modules/mutative/src/set.ts +201 -0
- package/node_modules/mutative/src/unsafe.ts +66 -0
- package/node_modules/mutative/src/utils/cast.ts +22 -0
- package/node_modules/mutative/src/utils/copy.ts +224 -0
- package/node_modules/mutative/src/utils/deepFreeze.ts +103 -0
- package/node_modules/mutative/src/utils/draft.ts +189 -0
- package/node_modules/mutative/src/utils/finalize.ts +232 -0
- package/node_modules/mutative/src/utils/forEach.ts +24 -0
- package/node_modules/mutative/src/utils/index.ts +7 -0
- package/node_modules/mutative/src/utils/mark.ts +11 -0
- package/node_modules/mutative/src/utils/marker.ts +34 -0
- package/node_modules/mutative/src/utils/proto.ts +38 -0
- package/node_modules/uuid/LICENSE.md +9 -0
- package/node_modules/uuid/README.md +491 -0
- package/node_modules/uuid/dist/index.d.ts +15 -0
- package/node_modules/uuid/dist/index.js +14 -0
- package/node_modules/uuid/dist/max.d.ts +2 -0
- package/node_modules/uuid/dist/max.js +1 -0
- package/node_modules/uuid/dist/md5.d.ts +2 -0
- package/node_modules/uuid/dist/md5.js +135 -0
- package/node_modules/uuid/dist/nil.d.ts +2 -0
- package/node_modules/uuid/dist/nil.js +1 -0
- package/node_modules/uuid/dist/parse.d.ts +3 -0
- package/node_modules/uuid/dist/parse.js +9 -0
- package/node_modules/uuid/dist/regex.d.ts +2 -0
- package/node_modules/uuid/dist/regex.js +1 -0
- package/node_modules/uuid/dist/rng.d.ts +1 -0
- package/node_modules/uuid/dist/rng.js +4 -0
- package/node_modules/uuid/dist/sha1.d.ts +2 -0
- package/node_modules/uuid/dist/sha1.js +70 -0
- package/node_modules/uuid/dist/stringify.d.ts +3 -0
- package/node_modules/uuid/dist/stringify.js +35 -0
- package/node_modules/uuid/dist/types.d.ts +22 -0
- package/node_modules/uuid/dist/types.js +1 -0
- package/node_modules/uuid/dist/uuid-bin.d.ts +1 -0
- package/node_modules/uuid/dist/uuid-bin.js +70 -0
- package/node_modules/uuid/dist/v1.d.ts +11 -0
- package/node_modules/uuid/dist/v1.js +87 -0
- package/node_modules/uuid/dist/v1ToV6.d.ts +3 -0
- package/node_modules/uuid/dist/v1ToV6.js +10 -0
- package/node_modules/uuid/dist/v3.d.ts +9 -0
- package/node_modules/uuid/dist/v3.js +9 -0
- package/node_modules/uuid/dist/v35.d.ts +7 -0
- package/node_modules/uuid/dist/v35.js +39 -0
- package/node_modules/uuid/dist/v4.d.ts +4 -0
- package/node_modules/uuid/dist/v4.js +29 -0
- package/node_modules/uuid/dist/v5.d.ts +9 -0
- package/node_modules/uuid/dist/v5.js +9 -0
- package/node_modules/uuid/dist/v6.d.ts +4 -0
- package/node_modules/uuid/dist/v6.js +20 -0
- package/node_modules/uuid/dist/v6ToV1.d.ts +2 -0
- package/node_modules/uuid/dist/v6ToV1.js +10 -0
- package/node_modules/uuid/dist/v7.d.ts +9 -0
- package/node_modules/uuid/dist/v7.js +68 -0
- package/node_modules/uuid/dist/validate.d.ts +2 -0
- package/node_modules/uuid/dist/validate.js +5 -0
- package/node_modules/uuid/dist/version.d.ts +2 -0
- package/node_modules/uuid/dist/version.js +8 -0
- package/node_modules/uuid/dist-node/bin/uuid +2 -0
- package/node_modules/uuid/dist-node/index.js +14 -0
- package/node_modules/uuid/dist-node/max.js +1 -0
- package/node_modules/uuid/dist-node/md5.js +11 -0
- package/node_modules/uuid/dist-node/nil.js +1 -0
- package/node_modules/uuid/dist-node/parse.js +9 -0
- package/node_modules/uuid/dist-node/regex.js +1 -0
- package/node_modules/uuid/dist-node/rng.js +4 -0
- package/node_modules/uuid/dist-node/sha1.js +11 -0
- package/node_modules/uuid/dist-node/stringify.js +35 -0
- package/node_modules/uuid/dist-node/types.js +1 -0
- package/node_modules/uuid/dist-node/uuid-bin.js +70 -0
- package/node_modules/uuid/dist-node/v1.js +87 -0
- package/node_modules/uuid/dist-node/v1ToV6.js +10 -0
- package/node_modules/uuid/dist-node/v3.js +9 -0
- package/node_modules/uuid/dist-node/v35.js +39 -0
- package/node_modules/uuid/dist-node/v4.js +29 -0
- package/node_modules/uuid/dist-node/v5.js +9 -0
- package/node_modules/uuid/dist-node/v6.js +20 -0
- package/node_modules/uuid/dist-node/v6ToV1.js +10 -0
- package/node_modules/uuid/dist-node/v7.js +68 -0
- package/node_modules/uuid/dist-node/validate.js +5 -0
- package/node_modules/uuid/dist-node/version.js +8 -0
- package/node_modules/uuid/package.json +115 -0
- package/package.json +80 -4
- package/release.json +78 -0
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
import type { RoomSchemaShape } from './presence.ts';
|
|
2
|
+
import { Expand } from './queryTypes.ts';
|
|
3
|
+
export declare class DataAttrDef<ValueType, IsRequired extends RequirementKind, IsIndexed extends boolean, IsUnique extends boolean = false> {
|
|
4
|
+
valueType: ValueTypes;
|
|
5
|
+
required: IsRequired;
|
|
6
|
+
isIndexed: IsIndexed;
|
|
7
|
+
config: {
|
|
8
|
+
indexed: boolean;
|
|
9
|
+
unique: boolean;
|
|
10
|
+
};
|
|
11
|
+
metadata: Record<string, unknown>;
|
|
12
|
+
constructor(valueType: ValueTypes, required: IsRequired, isIndexed: IsIndexed, config?: {
|
|
13
|
+
indexed: boolean;
|
|
14
|
+
unique: boolean;
|
|
15
|
+
});
|
|
16
|
+
/**
|
|
17
|
+
* @deprecated Only use this temporarily for attributes that you want
|
|
18
|
+
* to treat as required in frontend code but can’t yet mark as required
|
|
19
|
+
* and enforced for backend
|
|
20
|
+
*/
|
|
21
|
+
clientRequired(): DataAttrDef<ValueType, true, IsIndexed, IsUnique>;
|
|
22
|
+
optional(): DataAttrDef<ValueType, false, IsIndexed, IsUnique>;
|
|
23
|
+
unique(): DataAttrDef<ValueType, IsRequired, IsIndexed, true>;
|
|
24
|
+
indexed(): DataAttrDef<ValueType, IsRequired, true, IsUnique>;
|
|
25
|
+
}
|
|
26
|
+
export declare class LinkAttrDef<Cardinality extends CardinalityKind, EntityName extends string> {
|
|
27
|
+
cardinality: Cardinality;
|
|
28
|
+
entityName: EntityName;
|
|
29
|
+
constructor(cardinality: Cardinality, entityName: EntityName);
|
|
30
|
+
}
|
|
31
|
+
export interface IContainEntitiesAndLinks<Entities extends EntitiesDef, Links extends LinksDef<Entities>> {
|
|
32
|
+
entities: Entities;
|
|
33
|
+
links: Links;
|
|
34
|
+
}
|
|
35
|
+
export type ValueTypes = 'string' | 'number' | 'boolean' | 'date' | 'json';
|
|
36
|
+
export type CardinalityKind = 'one' | 'many';
|
|
37
|
+
export type RequirementKind = true | false;
|
|
38
|
+
export type AttrsDefs = Record<string, DataAttrDef<any, any, any, boolean>>;
|
|
39
|
+
export declare class EntityDef<Attrs extends AttrsDefs, Links extends Record<string, LinkAttrDef<any, any>>, AsType> {
|
|
40
|
+
attrs: Attrs;
|
|
41
|
+
links: Links;
|
|
42
|
+
constructor(attrs: Attrs, links: Links);
|
|
43
|
+
asType<_AsType extends Partial<MappedAttrs<Attrs, boolean>>>(): EntityDef<Attrs, Links, _AsType>;
|
|
44
|
+
}
|
|
45
|
+
export type EntityDefFromSchema<S extends IContainEntitiesAndLinks<any, any>, K extends keyof S['entities']> = {
|
|
46
|
+
[k in keyof S['entities'][K]['attrs']]: S['entities'][K] extends EntityDef<any, any, any> ? S['entities'][K]['attrs'][k] : never;
|
|
47
|
+
};
|
|
48
|
+
export type EntitiesDef = Record<string, EntityDef<any, any, any>>;
|
|
49
|
+
export type LinksDef<Entities extends EntitiesDef> = Record<string, LinkDef<Entities, keyof Entities, string, CardinalityKind, keyof Entities, string, CardinalityKind>>;
|
|
50
|
+
export type LinkDef<Entities extends EntitiesDef, FwdEntity extends keyof Entities, FwdAttr extends string, FwdCardinality extends CardinalityKind, RevEntity extends keyof Entities, RevAttr extends string, RevCardinality extends CardinalityKind> = {
|
|
51
|
+
forward: {
|
|
52
|
+
on: FwdEntity;
|
|
53
|
+
label: FwdAttr;
|
|
54
|
+
has: FwdCardinality;
|
|
55
|
+
required?: RequirementKind;
|
|
56
|
+
onDelete?: 'cascade';
|
|
57
|
+
};
|
|
58
|
+
reverse: {
|
|
59
|
+
on: RevEntity;
|
|
60
|
+
label: RevAttr;
|
|
61
|
+
has: RevCardinality;
|
|
62
|
+
onDelete?: 'cascade';
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
type IsEmptyOrIndexSignature<T> = keyof T extends never ? true : string extends keyof T ? true : false;
|
|
66
|
+
export type EntitiesWithLinks<Entities extends EntitiesDef, Links extends LinksDef<Entities>> = {
|
|
67
|
+
[EntityName in keyof Entities]: EntityDef<Entities[EntityName]['attrs'], EntityForwardLinksMap<EntityName, Entities, Links> & EntityReverseLinksMap<EntityName, Entities, Links>, Entities[EntityName] extends EntityDef<any, any, infer O> ? O extends void ? void : O : void>;
|
|
68
|
+
};
|
|
69
|
+
type EntityForwardLinksMap<EntityName extends keyof Entities, Entities extends EntitiesDef, Links extends LinksDef<Entities>, LinkIndexFwd = LinksIndexedByEntity<Entities, Links, 'reverse'>> = IsEmptyOrIndexSignature<Links> extends true ? {} : EntityName extends keyof LinkIndexFwd ? {
|
|
70
|
+
[LinkName in keyof LinkIndexFwd[EntityName]]: LinkIndexFwd[EntityName][LinkName] extends LinkDef<Entities, infer RelatedEntityName, any, any, any, any, infer Cardinality> ? {
|
|
71
|
+
entityName: RelatedEntityName;
|
|
72
|
+
cardinality: Cardinality;
|
|
73
|
+
} : never;
|
|
74
|
+
} : {};
|
|
75
|
+
type EntityReverseLinksMap<EntityName extends keyof Entities, Entities extends EntitiesDef, Links extends LinksDef<Entities>, RevLinkIndex = LinksIndexedByEntity<Entities, Links, 'forward'>> = IsEmptyOrIndexSignature<Links> extends true ? {} : EntityName extends keyof RevLinkIndex ? {
|
|
76
|
+
[LinkName in keyof RevLinkIndex[EntityName]]: RevLinkIndex[EntityName][LinkName] extends LinkDef<Entities, any, any, infer Cardinality, infer RelatedEntityName, any, any> ? {
|
|
77
|
+
entityName: RelatedEntityName;
|
|
78
|
+
cardinality: Cardinality;
|
|
79
|
+
} : never;
|
|
80
|
+
} : {};
|
|
81
|
+
type LinksIndexedByEntity<Entities extends EntitiesDef, Links extends LinksDef<Entities>, Direction extends 'forward' | 'reverse'> = {
|
|
82
|
+
[FwdEntity in keyof Entities]: {
|
|
83
|
+
[LinkName in keyof Links as Links[LinkName][Direction]['on'] extends FwdEntity ? Links[LinkName][Direction]['label'] : never]: Links[LinkName] extends LinkDef<Entities, infer FwdEntity, infer FwdAttr, infer FwdCardinality, infer RevEntity, infer RevAttr, infer RevCardinality> ? LinkDef<Entities, FwdEntity, FwdAttr, FwdCardinality, RevEntity, RevAttr, RevCardinality> : never;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
type RequiredKeys<Attrs extends AttrsDefs> = {
|
|
87
|
+
[K in keyof Attrs]: Attrs[K] extends DataAttrDef<any, infer R, any, boolean> ? R extends true ? K : never : never;
|
|
88
|
+
}[keyof Attrs];
|
|
89
|
+
export type UniqueKeys<Attrs extends AttrsDefs> = {
|
|
90
|
+
[K in keyof Attrs]: Attrs[K] extends DataAttrDef<any, any, any, infer U> ? U extends true ? K : never : never;
|
|
91
|
+
}[keyof Attrs];
|
|
92
|
+
type OptionalKeys<Attrs extends AttrsDefs> = {
|
|
93
|
+
[K in keyof Attrs]: Attrs[K] extends DataAttrDef<any, infer R, any, boolean> ? R extends false ? K : never : never;
|
|
94
|
+
}[keyof Attrs];
|
|
95
|
+
/**
|
|
96
|
+
* MappedAttrs:
|
|
97
|
+
* - Required keys => `key: ValueType`
|
|
98
|
+
* - Optional keys => `key?: ValueType`
|
|
99
|
+
*/
|
|
100
|
+
type MappedAttrs<Attrs extends AttrsDefs, UseDates extends boolean> = {
|
|
101
|
+
[K in RequiredKeys<Attrs>]: Attrs[K] extends DataAttrDef<infer V, any, any, boolean> ? V extends Date ? UseDates extends true ? V : string | number : V : never;
|
|
102
|
+
} & {
|
|
103
|
+
[K in OptionalKeys<Attrs>]?: Attrs[K] extends DataAttrDef<infer V, any, any, boolean> ? V extends Date ? UseDates extends true ? V : string | number : V : never;
|
|
104
|
+
};
|
|
105
|
+
export type ResolveEntityAttrs<EDef extends EntityDef<any, any, any>, UseDates extends boolean = false, ResolvedAttrs = MappedAttrs<EDef['attrs'], UseDates>> = EDef extends EntityDef<any, any, infer AsType> ? AsType extends void ? ResolvedAttrs : Omit<ResolvedAttrs, keyof AsType> & AsType : ResolvedAttrs;
|
|
106
|
+
export type ResolveAttrs<Entities extends EntitiesDef, EntityName extends keyof Entities, UseDates extends boolean> = ResolveEntityAttrs<Entities[EntityName], UseDates>;
|
|
107
|
+
export type RoomsFromDef<RDef extends RoomsDef> = {
|
|
108
|
+
[RoomName in keyof RDef]: {
|
|
109
|
+
presence: Expand<ResolveEntityAttrs<RDef[RoomName]['presence']>>;
|
|
110
|
+
topics: {
|
|
111
|
+
[TopicName in keyof RDef[RoomName]['topics']]: Expand<ResolveEntityAttrs<NonNullable<RDef[RoomName]['topics']>[TopicName]>>;
|
|
112
|
+
};
|
|
113
|
+
};
|
|
114
|
+
};
|
|
115
|
+
export type RoomsOf<S> = S extends InstantSchemaDef<any, any, infer RDef> ? RoomsFromDef<RDef> : never;
|
|
116
|
+
export type PresenceOf<S, RoomType extends keyof RoomsOf<S>> = RoomsOf<S>[RoomType] extends {
|
|
117
|
+
presence: infer P;
|
|
118
|
+
} ? P : {};
|
|
119
|
+
export type TopicsOf<S, RoomType extends keyof RoomsOf<S>> = RoomsOf<S>[RoomType] extends {
|
|
120
|
+
topics: infer T;
|
|
121
|
+
} ? T : {};
|
|
122
|
+
export type TopicOf<S, RoomType extends keyof RoomsOf<S>, TopicType extends keyof TopicsOf<S, RoomType>> = TopicsOf<S, RoomType>[TopicType];
|
|
123
|
+
interface RoomDef {
|
|
124
|
+
presence: EntityDef<any, any, any>;
|
|
125
|
+
topics?: {
|
|
126
|
+
[TopicName: string]: EntityDef<any, any, any>;
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
export interface RoomsDef {
|
|
130
|
+
[RoomType: string]: RoomDef;
|
|
131
|
+
}
|
|
132
|
+
export declare class InstantSchemaDef<Entities extends EntitiesDef, Links extends LinksDef<Entities>, Rooms extends RoomsDef> implements IContainEntitiesAndLinks<Entities, Links> {
|
|
133
|
+
entities: Entities;
|
|
134
|
+
links: Links;
|
|
135
|
+
rooms: Rooms;
|
|
136
|
+
constructor(entities: Entities, links: Links, rooms: Rooms);
|
|
137
|
+
/**
|
|
138
|
+
* @deprecated
|
|
139
|
+
* `withRoomSchema` is deprecated. Define your schema in `rooms` directly:
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* // Before:
|
|
143
|
+
* const schema = i.schema({
|
|
144
|
+
* // ...
|
|
145
|
+
* }).withRoomSchema<RoomSchema>()
|
|
146
|
+
*
|
|
147
|
+
* // After
|
|
148
|
+
* const schema = i.schema({
|
|
149
|
+
* rooms: {
|
|
150
|
+
* // ...
|
|
151
|
+
* }
|
|
152
|
+
* })
|
|
153
|
+
*
|
|
154
|
+
* @see https://instantdb.com/docs/presence-and-topics#typesafety
|
|
155
|
+
*/
|
|
156
|
+
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantSchemaDef<Entities, Links, RoomDefFromShape<_RoomSchema>>;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* @deprecated
|
|
160
|
+
* `i.graph` is deprecated. Use `i.schema` instead.
|
|
161
|
+
*
|
|
162
|
+
* @see https://instantdb.com/docs/modeling-data
|
|
163
|
+
*/
|
|
164
|
+
export declare class InstantGraph<Entities extends EntitiesDef, Links extends LinksDef<Entities>, RoomSchema extends RoomSchemaShape = {}> implements IContainEntitiesAndLinks<Entities, Links> {
|
|
165
|
+
entities: Entities;
|
|
166
|
+
links: Links;
|
|
167
|
+
constructor(entities: Entities, links: Links);
|
|
168
|
+
withRoomSchema<_RoomSchema extends RoomSchemaShape>(): InstantGraph<Entities, Links, _RoomSchema>;
|
|
169
|
+
}
|
|
170
|
+
type EntityDefFromRoomSlice<Shape extends {
|
|
171
|
+
[k: string]: any;
|
|
172
|
+
}> = EntityDef<{
|
|
173
|
+
[AttrName in keyof Shape]: DataAttrDef<Shape[AttrName], Shape[AttrName] extends undefined ? false : true, any, boolean>;
|
|
174
|
+
}, any, void>;
|
|
175
|
+
type RoomDefFromShape<RoomSchema extends RoomSchemaShape> = {
|
|
176
|
+
[RoomName in keyof RoomSchema]: {
|
|
177
|
+
presence: EntityDefFromRoomSlice<NonNullable<RoomSchema[RoomName]['presence']>>;
|
|
178
|
+
topics: {
|
|
179
|
+
[TopicName in keyof RoomSchema[RoomName]['topics']]: EntityDefFromRoomSlice<NonNullable<RoomSchema[RoomName]['topics'][TopicName]>>;
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
};
|
|
183
|
+
type EntityDefFromShape<Shape, K extends keyof Shape> = EntityDef<{
|
|
184
|
+
[AttrName in keyof Shape[K]]: DataAttrDef<Shape[K][AttrName], Shape[K][AttrName] extends undefined ? false : true, any, boolean>;
|
|
185
|
+
}, {
|
|
186
|
+
[LinkName in keyof Shape]: LinkAttrDef<'many', LinkName extends string ? LinkName : string>;
|
|
187
|
+
}, void>;
|
|
188
|
+
/**
|
|
189
|
+
* If you were using the old `schema` types, you can use this to help you
|
|
190
|
+
* migrate.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* // Before
|
|
194
|
+
* const db = init<Schema, Rooms>({...})
|
|
195
|
+
*
|
|
196
|
+
* // After
|
|
197
|
+
* const db = init<BackwardsCompatibleSchema<Schema, Rooms>>({...})
|
|
198
|
+
*/
|
|
199
|
+
export type BackwardsCompatibleSchema<Shape extends {
|
|
200
|
+
[k: string]: any;
|
|
201
|
+
}, RoomSchema extends RoomSchemaShape = {}> = InstantSchemaDef<{
|
|
202
|
+
[K in keyof Shape]: EntityDefFromShape<Shape, K>;
|
|
203
|
+
}, UnknownLinks<EntitiesDef>, RoomDefFromShape<RoomSchema>>;
|
|
204
|
+
export type UnknownEntity = EntityDef<{
|
|
205
|
+
id: DataAttrDef<string, true, true, boolean>;
|
|
206
|
+
[AttrName: string]: DataAttrDef<any, boolean, boolean, boolean>;
|
|
207
|
+
}, {
|
|
208
|
+
[LinkName: string]: LinkAttrDef<'many', string>;
|
|
209
|
+
}, void>;
|
|
210
|
+
export type UnknownEntities = {
|
|
211
|
+
[EntityName: string]: UnknownEntity;
|
|
212
|
+
};
|
|
213
|
+
export interface UnknownLinks<Entities extends EntitiesDef> {
|
|
214
|
+
[LinkName: string]: LinkDef<Entities, string, string, 'many', string, string, 'many'>;
|
|
215
|
+
}
|
|
216
|
+
export interface UnknownRooms {
|
|
217
|
+
[RoomName: string]: {
|
|
218
|
+
presence: EntityDef<any, any, any>;
|
|
219
|
+
topics: {
|
|
220
|
+
[TopicName: string]: EntityDef<any, any, any>;
|
|
221
|
+
};
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
export declare class InstantUnknownSchemaDef extends InstantSchemaDef<UnknownEntities, UnknownLinks<UnknownEntities>, UnknownRooms> {
|
|
225
|
+
}
|
|
226
|
+
export type InstantUnknownSchema = InstantUnknownSchemaDef;
|
|
227
|
+
export type CreateParams<Schema extends IContainEntitiesAndLinks<any, any>, EntityName extends keyof Schema['entities']> = {
|
|
228
|
+
[AttrName in RequiredKeys<Schema['entities'][EntityName]['attrs']>]: Schema['entities'][EntityName]['attrs'][AttrName] extends DataAttrDef<infer ValueType, any, any, any> ? ValueType extends Date ? string | number | Date : ValueType : never;
|
|
229
|
+
} & {
|
|
230
|
+
[AttrName in OptionalKeys<Schema['entities'][EntityName]['attrs']>]?: Schema['entities'][EntityName]['attrs'][AttrName] extends DataAttrDef<infer ValueType, false, any, any> ? (ValueType extends Date ? string | number | Date : ValueType) | null : never;
|
|
231
|
+
};
|
|
232
|
+
export type UpdateParams<Schema extends IContainEntitiesAndLinks<any, any>, EntityName extends keyof Schema['entities']> = {
|
|
233
|
+
[AttrName in keyof Schema['entities'][EntityName]['attrs']]?: Schema['entities'][EntityName]['attrs'][AttrName] extends DataAttrDef<infer ValueType, infer IsRequired, any, any> ? IsRequired extends true ? ValueType extends Date ? string | number | Date : ValueType : (ValueType extends Date ? string | number | Date : ValueType) | null : never;
|
|
234
|
+
};
|
|
235
|
+
export type UpdateOpts = {
|
|
236
|
+
upsert?: boolean | undefined;
|
|
237
|
+
};
|
|
238
|
+
export type LinkParams<Schema extends IContainEntitiesAndLinks<any, any>, EntityName extends keyof Schema['entities']> = {
|
|
239
|
+
[LinkName in keyof Schema['entities'][EntityName]['links']]?: Schema['entities'][EntityName]['links'][LinkName] extends LinkAttrDef<infer Cardinality, any> ? Cardinality extends 'one' ? string : string | string[] : never;
|
|
240
|
+
};
|
|
241
|
+
export type RuleParams = {
|
|
242
|
+
[key: string]: any;
|
|
243
|
+
};
|
|
244
|
+
export {};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
export class DataAttrDef {
|
|
2
|
+
valueType;
|
|
3
|
+
required;
|
|
4
|
+
isIndexed;
|
|
5
|
+
config;
|
|
6
|
+
metadata = {};
|
|
7
|
+
constructor(valueType, required, isIndexed, config = { indexed: false, unique: false }) {
|
|
8
|
+
this.valueType = valueType;
|
|
9
|
+
this.required = required;
|
|
10
|
+
this.isIndexed = isIndexed;
|
|
11
|
+
this.config = config;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* @deprecated Only use this temporarily for attributes that you want
|
|
15
|
+
* to treat as required in frontend code but can’t yet mark as required
|
|
16
|
+
* and enforced for backend
|
|
17
|
+
*/
|
|
18
|
+
clientRequired() {
|
|
19
|
+
return new DataAttrDef(this.valueType, false, this.isIndexed, this.config);
|
|
20
|
+
}
|
|
21
|
+
optional() {
|
|
22
|
+
return new DataAttrDef(this.valueType, false, this.isIndexed, this.config);
|
|
23
|
+
}
|
|
24
|
+
unique() {
|
|
25
|
+
return new DataAttrDef(this.valueType, this.required, this.isIndexed, {
|
|
26
|
+
...this.config,
|
|
27
|
+
unique: true,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
indexed() {
|
|
31
|
+
return new DataAttrDef(this.valueType, this.required, true, {
|
|
32
|
+
...this.config,
|
|
33
|
+
indexed: true,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
export class LinkAttrDef {
|
|
38
|
+
cardinality;
|
|
39
|
+
entityName;
|
|
40
|
+
constructor(cardinality, entityName) {
|
|
41
|
+
this.cardinality = cardinality;
|
|
42
|
+
this.entityName = entityName;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
export class EntityDef {
|
|
46
|
+
attrs;
|
|
47
|
+
links;
|
|
48
|
+
constructor(attrs, links) {
|
|
49
|
+
this.attrs = attrs;
|
|
50
|
+
this.links = links;
|
|
51
|
+
}
|
|
52
|
+
asType() {
|
|
53
|
+
return new EntityDef(this.attrs, this.links);
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export class InstantSchemaDef {
|
|
57
|
+
entities;
|
|
58
|
+
links;
|
|
59
|
+
rooms;
|
|
60
|
+
constructor(entities, links, rooms) {
|
|
61
|
+
this.entities = entities;
|
|
62
|
+
this.links = links;
|
|
63
|
+
this.rooms = rooms;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated
|
|
67
|
+
* `withRoomSchema` is deprecated. Define your schema in `rooms` directly:
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // Before:
|
|
71
|
+
* const schema = i.schema({
|
|
72
|
+
* // ...
|
|
73
|
+
* }).withRoomSchema<RoomSchema>()
|
|
74
|
+
*
|
|
75
|
+
* // After
|
|
76
|
+
* const schema = i.schema({
|
|
77
|
+
* rooms: {
|
|
78
|
+
* // ...
|
|
79
|
+
* }
|
|
80
|
+
* })
|
|
81
|
+
*
|
|
82
|
+
* @see https://instantdb.com/docs/presence-and-topics#typesafety
|
|
83
|
+
*/
|
|
84
|
+
withRoomSchema() {
|
|
85
|
+
return new InstantSchemaDef(this.entities, this.links, {});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* @deprecated
|
|
90
|
+
* `i.graph` is deprecated. Use `i.schema` instead.
|
|
91
|
+
*
|
|
92
|
+
* @see https://instantdb.com/docs/modeling-data
|
|
93
|
+
*/
|
|
94
|
+
export class InstantGraph {
|
|
95
|
+
entities;
|
|
96
|
+
links;
|
|
97
|
+
constructor(entities, links) {
|
|
98
|
+
this.entities = entities;
|
|
99
|
+
this.links = links;
|
|
100
|
+
}
|
|
101
|
+
withRoomSchema() {
|
|
102
|
+
return new InstantGraph(this.entities, this.links);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
export class InstantUnknownSchemaDef extends InstantSchemaDef {
|
|
106
|
+
}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { InstantDBAttr } from './attrTypes.ts';
|
|
2
|
+
import { LinkIndex } from './utils/linkIndex.ts';
|
|
3
|
+
type Triple = [string, string, any, number];
|
|
4
|
+
type Attrs = Record<string, InstantDBAttr>;
|
|
5
|
+
export type Store = {
|
|
6
|
+
eav: Map<string, Map<string, Map<any, Triple>>>;
|
|
7
|
+
aev: Map<string, Map<string, Map<any, Triple>>>;
|
|
8
|
+
vae: Map<any, Map<string, Map<string, Triple>>>;
|
|
9
|
+
useDateObjects: boolean | null | undefined;
|
|
10
|
+
cardinalityInference: boolean | null | undefined;
|
|
11
|
+
};
|
|
12
|
+
type StoreJsonVersion0 = {
|
|
13
|
+
__type: 'store';
|
|
14
|
+
attrs: Attrs;
|
|
15
|
+
triples: Triple[];
|
|
16
|
+
cardinalityInference: boolean | null | undefined;
|
|
17
|
+
linkIndex: LinkIndex | null;
|
|
18
|
+
useDateObjects: boolean | null | undefined;
|
|
19
|
+
};
|
|
20
|
+
type StoreJsonVersion1 = {
|
|
21
|
+
triples: Triple[];
|
|
22
|
+
cardinalityInference: boolean | null | undefined;
|
|
23
|
+
useDateObjects: boolean | null | undefined;
|
|
24
|
+
version: 1;
|
|
25
|
+
};
|
|
26
|
+
export type StoreJson = StoreJsonVersion0 | StoreJsonVersion1;
|
|
27
|
+
export type AttrsStoreJson = {
|
|
28
|
+
attrs: Attrs;
|
|
29
|
+
linkIndex: LinkIndex | null;
|
|
30
|
+
};
|
|
31
|
+
export interface AttrsStore {
|
|
32
|
+
attrs: Attrs;
|
|
33
|
+
linkIndex: LinkIndex | null;
|
|
34
|
+
resetAttrIndexes(): void;
|
|
35
|
+
addAttr(attr: InstantDBAttr): void;
|
|
36
|
+
deleteAttr(attrId: string): void;
|
|
37
|
+
updateAttr(partialAttr: Partial<InstantDBAttr> & {
|
|
38
|
+
id: string;
|
|
39
|
+
}): void;
|
|
40
|
+
getAttr(id: string): InstantDBAttr | undefined;
|
|
41
|
+
blobAttrs: Map<string, Map<string, InstantDBAttr>>;
|
|
42
|
+
primaryKeys: Map<string, InstantDBAttr>;
|
|
43
|
+
forwardIdents: Map<string, Map<string, InstantDBAttr>>;
|
|
44
|
+
revIdents: Map<string, Map<string, InstantDBAttr>>;
|
|
45
|
+
toJSON(): AttrsStoreJson;
|
|
46
|
+
}
|
|
47
|
+
export declare class AttrsStoreClass implements AttrsStore {
|
|
48
|
+
attrs: Attrs;
|
|
49
|
+
linkIndex: LinkIndex | null;
|
|
50
|
+
private _blobAttrs;
|
|
51
|
+
private _primaryKeys;
|
|
52
|
+
private _forwardIdents;
|
|
53
|
+
private _revIdents;
|
|
54
|
+
constructor(attrs: Attrs, linkIndex: LinkIndex | null);
|
|
55
|
+
resetAttrIndexes(): void;
|
|
56
|
+
addAttr(attr: InstantDBAttr): void;
|
|
57
|
+
deleteAttr(attrId: string): void;
|
|
58
|
+
updateAttr(partialAttr: Partial<InstantDBAttr> & {
|
|
59
|
+
id: string;
|
|
60
|
+
}): void;
|
|
61
|
+
getAttr(id: string): InstantDBAttr | undefined;
|
|
62
|
+
get blobAttrs(): Map<string, Map<string, InstantDBAttr>>;
|
|
63
|
+
get primaryKeys(): Map<string, InstantDBAttr>;
|
|
64
|
+
get forwardIdents(): Map<string, Map<string, InstantDBAttr>>;
|
|
65
|
+
get revIdents(): Map<string, Map<string, InstantDBAttr>>;
|
|
66
|
+
toJSON(): AttrsStoreJson;
|
|
67
|
+
}
|
|
68
|
+
export declare function isBlob(attr: InstantDBAttr): boolean;
|
|
69
|
+
export declare function getInMap(obj: any, path: any): any;
|
|
70
|
+
export declare function toJSON(store: Store): StoreJsonVersion1;
|
|
71
|
+
export declare function fromJSON(attrsStore: AttrsStore, storeJSON: StoreJson): Store;
|
|
72
|
+
export declare function attrsStoreFromJSON(attrsStoreJSON: AttrsStoreJson | null, storeJSON: StoreJson | null): AttrsStore | undefined;
|
|
73
|
+
export declare function hasTriple(store: Store, [e, a, v]: [string, string, any]): boolean;
|
|
74
|
+
export declare function hasEntity(store: Store, e: string): boolean;
|
|
75
|
+
export declare function createStore(attrsStore: AttrsStore, triples: Triple[], enableCardinalityInference?: boolean | null, useDateObjects?: boolean | null): Store;
|
|
76
|
+
export declare function retractTriple(store: Store, attrsStore: AttrsStore, rawTriple: Triple): void;
|
|
77
|
+
export declare function addTriple(store: Store, attrsStore: AttrsStore, rawTriple: Triple): void;
|
|
78
|
+
export declare function allMapValues(m: any, level: any, res?: any[]): any[];
|
|
79
|
+
export declare function getTriples(store: any, [e, a, v]: [any, any, any]): any[];
|
|
80
|
+
export declare function getAsObject(store: Store, attrs: Map<string, InstantDBAttr> | undefined, e: string): {};
|
|
81
|
+
export declare function getAttrByFwdIdentName(attrsStore: AttrsStore, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
|
|
82
|
+
export declare function getAttrByReverseIdentName(attrsStore: AttrsStore, inputEtype: string, inputLabel: string): InstantDBAttr | undefined;
|
|
83
|
+
export declare function getBlobAttrs(attrsStore: AttrsStore, etype: string): Map<string, InstantDBAttr> | undefined;
|
|
84
|
+
export declare function getPrimaryKeyAttr(attrsStore: AttrsStore, etype: string): InstantDBAttr | undefined;
|
|
85
|
+
export declare function transact(store: Store, attrsStore: AttrsStore, txSteps: any): {
|
|
86
|
+
store: Store;
|
|
87
|
+
attrsStore: AttrsStore;
|
|
88
|
+
};
|
|
89
|
+
export {};
|