@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,211 @@
|
|
|
1
|
+
import { pgTimezoneMatch, pgTimezoneAbbrevs } from './pgtime.js';
|
|
2
|
+
// Date parsing functions
|
|
3
|
+
function zonedDateTimeStrToInstant(s) {
|
|
4
|
+
return new Date(s);
|
|
5
|
+
}
|
|
6
|
+
function localDateTimeStrToInstant(s) {
|
|
7
|
+
// Parse as UTC since there's no timezone info
|
|
8
|
+
return new Date(s + 'Z');
|
|
9
|
+
}
|
|
10
|
+
const localDateStrRe = /^(\d+)[\./-](\d+)[\./-](\d+)$/;
|
|
11
|
+
function localDateStrToInstant(s) {
|
|
12
|
+
const match = s.match(localDateStrRe);
|
|
13
|
+
if (!match) {
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
const [_, part1, part2, part3] = match;
|
|
17
|
+
if (part1 <= 0 || part2 <= 0 || part3 <= 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
if (part1 > 999) {
|
|
21
|
+
return new Date(Date.UTC(part1, part2 - 1, part3, 0, 0, 0, 0));
|
|
22
|
+
}
|
|
23
|
+
return new Date(Date.UTC(part3, part1 - 1, part2, 0, 0, 0, 0));
|
|
24
|
+
}
|
|
25
|
+
// Custom date formatters
|
|
26
|
+
function offioDateStrToInstant(s) {
|
|
27
|
+
// Format: "yyyy-MM-dd HH:mm:ss"
|
|
28
|
+
// Treat as UTC
|
|
29
|
+
const [datePart, timePart] = s.split(' ');
|
|
30
|
+
return new Date(datePart + 'T' + timePart + 'Z');
|
|
31
|
+
}
|
|
32
|
+
function zenecaDateStrToInstant(s) {
|
|
33
|
+
// Format: "yyyy-MM-dd HH:mm:ss.n"
|
|
34
|
+
// Treat as UTC
|
|
35
|
+
const [datePart, timeWithNanos] = s.split(' ');
|
|
36
|
+
// JavaScript Date can handle fractional seconds
|
|
37
|
+
return new Date(datePart + 'T' + timeWithNanos + 'Z');
|
|
38
|
+
}
|
|
39
|
+
function rfc1123ToInstant(s) {
|
|
40
|
+
// RFC 1123 format is natively supported by Date constructor
|
|
41
|
+
return new Date(s);
|
|
42
|
+
}
|
|
43
|
+
function dowMonDayYearStrToInstant(s) {
|
|
44
|
+
// Format: "EEE MMM dd yyyy" (e.g., "Wed Jan 15 2025")
|
|
45
|
+
//Only parse if the string is in the correct format
|
|
46
|
+
const regex = /^(\w{3}) (\w{3}) (\d{2}) (\d{4})$/;
|
|
47
|
+
const match = s.match(regex);
|
|
48
|
+
if (!match) {
|
|
49
|
+
throw new Error(`Unable to parse \`${s}\` as a date.`);
|
|
50
|
+
}
|
|
51
|
+
const date = new Date(s + ' UTC'); // Force UTC parsing
|
|
52
|
+
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate(), 0, 0, 0, 0));
|
|
53
|
+
}
|
|
54
|
+
function iso8601IncompleteOffsetToInstant(s) {
|
|
55
|
+
// Format: "2025-01-02T00:00:00-08" (missing minutes in timezone offset)
|
|
56
|
+
// Convert to proper ISO 8601 format by adding ":00" to the timezone offset
|
|
57
|
+
const regex = /^(.+T.+)([+-])(\d{2})$/;
|
|
58
|
+
const match = s.match(regex);
|
|
59
|
+
if (match) {
|
|
60
|
+
const [, dateTimePart, sign, hours] = match;
|
|
61
|
+
const correctedString = `${dateTimePart}${sign}${hours}:00`;
|
|
62
|
+
return new Date(correctedString);
|
|
63
|
+
}
|
|
64
|
+
return null;
|
|
65
|
+
}
|
|
66
|
+
function iso8601SingleDigitToInstant(s) {
|
|
67
|
+
// Format: "2025-11-2T00:00:00.000Z" or "2025-1-2T00:00:00Z" (single-digit month/day)
|
|
68
|
+
// Also handles space separator: "2025-1-2 00:00:00"
|
|
69
|
+
// Also handles single-digit hours/minutes/seconds: "2026-04-28T04:7:00.000Z"
|
|
70
|
+
// Normalize to proper ISO 8601 format with two-digit values
|
|
71
|
+
const regex = /^(\d+)-(\d{1,2})-(\d{1,2})([ T])(\d{1,2})(?::(\d{1,2}))?(?::(\d{1,2}))?(.*)$/;
|
|
72
|
+
const match = s.match(regex);
|
|
73
|
+
if (match) {
|
|
74
|
+
const [, year, month, day, _separator, hours, minutes, seconds, rest] = match;
|
|
75
|
+
const paddedMonth = month.padStart(2, '0');
|
|
76
|
+
const paddedDay = day.padStart(2, '0');
|
|
77
|
+
let timeStr = hours.padStart(2, '0');
|
|
78
|
+
if (minutes !== undefined) {
|
|
79
|
+
timeStr += `:${minutes.padStart(2, '0')}`;
|
|
80
|
+
}
|
|
81
|
+
if (seconds !== undefined) {
|
|
82
|
+
timeStr += `:${seconds.padStart(2, '0')}`;
|
|
83
|
+
}
|
|
84
|
+
const correctedString = `${year}-${paddedMonth}-${paddedDay}T${timeStr}${rest}`;
|
|
85
|
+
return new Date(correctedString);
|
|
86
|
+
}
|
|
87
|
+
return null;
|
|
88
|
+
}
|
|
89
|
+
function usDateTimeStrToInstant(s) {
|
|
90
|
+
// Format: "M/d/yyyy, h:mm:ss a" (e.g., "8/4/2025, 11:02:31 PM")
|
|
91
|
+
const [datePart, timePart] = s.split(', ');
|
|
92
|
+
const [month, day, year] = datePart.split('/').map(Number);
|
|
93
|
+
// Parse time with AM/PM
|
|
94
|
+
const timeMatch = timePart.match(/(\d{1,2}):(\d{2}):(\d{2}) (AM|PM)/);
|
|
95
|
+
if (!timeMatch) {
|
|
96
|
+
throw new Error(`Unable to parse time from: ${s}`);
|
|
97
|
+
}
|
|
98
|
+
let [, hours, minutes, seconds, ampm] = timeMatch;
|
|
99
|
+
hours = Number(hours);
|
|
100
|
+
minutes = Number(minutes);
|
|
101
|
+
seconds = Number(seconds);
|
|
102
|
+
// Convert 12-hour to 24-hour format
|
|
103
|
+
if (ampm === 'PM' && hours !== 12) {
|
|
104
|
+
hours += 12;
|
|
105
|
+
}
|
|
106
|
+
else if (ampm === 'AM' && hours === 12) {
|
|
107
|
+
hours = 0;
|
|
108
|
+
}
|
|
109
|
+
// Create date in UTC
|
|
110
|
+
return new Date(Date.UTC(year, month - 1, day, hours, minutes, seconds));
|
|
111
|
+
}
|
|
112
|
+
// https://www.postgresql.org/docs/17/datatype-datetime.html#DATATYPE-DATETIME-SPECIAL-VALUES
|
|
113
|
+
function specialStrToInstant(s) {
|
|
114
|
+
switch (s) {
|
|
115
|
+
case 'epoch':
|
|
116
|
+
return new Date(0);
|
|
117
|
+
// These are not implemented yet because we need some way for the
|
|
118
|
+
// client and server to aggree on the values
|
|
119
|
+
case 'infinity':
|
|
120
|
+
case '-infinity':
|
|
121
|
+
case 'today':
|
|
122
|
+
case 'tomorrow':
|
|
123
|
+
case 'yesterday':
|
|
124
|
+
return null;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function pgTimezoneStrToInstant(s) {
|
|
128
|
+
const match = s.match(pgTimezoneMatch);
|
|
129
|
+
if (!match) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
const [tz] = match;
|
|
133
|
+
const offset = pgTimezoneAbbrevs[tz];
|
|
134
|
+
const baseDate = new Date(s.replace(pgTimezoneMatch, 'Z'));
|
|
135
|
+
return new Date(baseDate.getTime() - offset * 1000);
|
|
136
|
+
}
|
|
137
|
+
// Array of parsers
|
|
138
|
+
const dateParsers = [
|
|
139
|
+
localDateStrToInstant,
|
|
140
|
+
zenecaDateStrToInstant,
|
|
141
|
+
dowMonDayYearStrToInstant,
|
|
142
|
+
usDateTimeStrToInstant,
|
|
143
|
+
localDateTimeStrToInstant,
|
|
144
|
+
iso8601IncompleteOffsetToInstant,
|
|
145
|
+
offioDateStrToInstant,
|
|
146
|
+
zonedDateTimeStrToInstant,
|
|
147
|
+
specialStrToInstant,
|
|
148
|
+
pgTimezoneStrToInstant,
|
|
149
|
+
iso8601SingleDigitToInstant,
|
|
150
|
+
rfc1123ToInstant,
|
|
151
|
+
];
|
|
152
|
+
// Try to parse with a specific parser
|
|
153
|
+
function tryParseDateString(parser, s) {
|
|
154
|
+
try {
|
|
155
|
+
const result = parser(s);
|
|
156
|
+
// Check if result is valid date
|
|
157
|
+
if (result instanceof Date && !isNaN(result.getTime())) {
|
|
158
|
+
return result;
|
|
159
|
+
}
|
|
160
|
+
return null;
|
|
161
|
+
}
|
|
162
|
+
catch (e) {
|
|
163
|
+
return null;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
// Try all parsers until one succeeds
|
|
167
|
+
function dateStrToInstant(s) {
|
|
168
|
+
for (const parser of dateParsers) {
|
|
169
|
+
const instant = tryParseDateString(parser, s);
|
|
170
|
+
if (instant) {
|
|
171
|
+
return instant;
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
return null;
|
|
175
|
+
}
|
|
176
|
+
// Parse JSON string and then try date parsing
|
|
177
|
+
function jsonStrToInstant(maybeJson) {
|
|
178
|
+
try {
|
|
179
|
+
const s = JSON.parse(maybeJson);
|
|
180
|
+
if (typeof s === 'string') {
|
|
181
|
+
return dateStrToInstant(s);
|
|
182
|
+
}
|
|
183
|
+
return null;
|
|
184
|
+
}
|
|
185
|
+
catch (e) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
// Main parse function that handles strings and numbers
|
|
190
|
+
export function coerceToDate(x) {
|
|
191
|
+
if (x === undefined) {
|
|
192
|
+
return undefined;
|
|
193
|
+
}
|
|
194
|
+
if (x === null) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
if (x instanceof Date) {
|
|
198
|
+
return x;
|
|
199
|
+
}
|
|
200
|
+
if (typeof x === 'string') {
|
|
201
|
+
const result = dateStrToInstant(x) || jsonStrToInstant(x) || dateStrToInstant(x.trim());
|
|
202
|
+
if (!result) {
|
|
203
|
+
throw new Error(`Unable to parse \`${x}\` as a date.`);
|
|
204
|
+
}
|
|
205
|
+
return result;
|
|
206
|
+
}
|
|
207
|
+
else if (typeof x === 'number') {
|
|
208
|
+
return new Date(x);
|
|
209
|
+
}
|
|
210
|
+
throw new Error(`Invalid date value \`${x}\`. Expected a date, number, or string, got type ${typeof x}.`);
|
|
211
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { InstantError } from '../InstantError.ts';
|
|
2
|
+
type InstantIssueBody = {
|
|
3
|
+
type: 'param-missing';
|
|
4
|
+
message: string;
|
|
5
|
+
hint: {
|
|
6
|
+
in: string[];
|
|
7
|
+
};
|
|
8
|
+
} | {
|
|
9
|
+
type: 'param-malformed';
|
|
10
|
+
message: string;
|
|
11
|
+
hint: {
|
|
12
|
+
in: string[];
|
|
13
|
+
};
|
|
14
|
+
} | {
|
|
15
|
+
type: 'record-not-found';
|
|
16
|
+
message: string;
|
|
17
|
+
hint: {
|
|
18
|
+
'record-type': string;
|
|
19
|
+
};
|
|
20
|
+
} | {
|
|
21
|
+
type: 'record-not-unique';
|
|
22
|
+
message: string;
|
|
23
|
+
hint: {
|
|
24
|
+
'record-type': string;
|
|
25
|
+
};
|
|
26
|
+
} | {
|
|
27
|
+
type: 'validation-failed';
|
|
28
|
+
message: string;
|
|
29
|
+
hint: {
|
|
30
|
+
'data-type': string;
|
|
31
|
+
errors: any[];
|
|
32
|
+
};
|
|
33
|
+
} | {
|
|
34
|
+
type: 'record-expired';
|
|
35
|
+
message: string;
|
|
36
|
+
hint: {
|
|
37
|
+
'record-type': string;
|
|
38
|
+
};
|
|
39
|
+
} | {
|
|
40
|
+
type: 'record-foreign-key-invalid';
|
|
41
|
+
message: string;
|
|
42
|
+
hint: {
|
|
43
|
+
table?: string;
|
|
44
|
+
condition?: string;
|
|
45
|
+
constraint?: string;
|
|
46
|
+
};
|
|
47
|
+
} | {
|
|
48
|
+
type: 'record-check-violation';
|
|
49
|
+
message: string;
|
|
50
|
+
hint: {
|
|
51
|
+
table?: string;
|
|
52
|
+
condition?: string;
|
|
53
|
+
constraint?: string;
|
|
54
|
+
};
|
|
55
|
+
} | {
|
|
56
|
+
type: 'permission-denied';
|
|
57
|
+
message: string;
|
|
58
|
+
hint: {
|
|
59
|
+
input: any;
|
|
60
|
+
expected: string;
|
|
61
|
+
};
|
|
62
|
+
} | {
|
|
63
|
+
type: 'permission-evaluation-failed';
|
|
64
|
+
message: string;
|
|
65
|
+
hint: {
|
|
66
|
+
rule: [string, string];
|
|
67
|
+
error?: {
|
|
68
|
+
type: string;
|
|
69
|
+
message: string;
|
|
70
|
+
hint: any;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
} | {
|
|
74
|
+
type: 'sql-raise';
|
|
75
|
+
message: string;
|
|
76
|
+
hint: {
|
|
77
|
+
table?: string;
|
|
78
|
+
condition?: string;
|
|
79
|
+
constraint?: string;
|
|
80
|
+
};
|
|
81
|
+
} | {
|
|
82
|
+
type: 'sql-exception';
|
|
83
|
+
message: string;
|
|
84
|
+
hint: {
|
|
85
|
+
table?: string;
|
|
86
|
+
condition?: string;
|
|
87
|
+
constraint?: string;
|
|
88
|
+
};
|
|
89
|
+
} | {
|
|
90
|
+
type: 'rate-limited';
|
|
91
|
+
message: string;
|
|
92
|
+
hint: {
|
|
93
|
+
'retry-at'?: string;
|
|
94
|
+
'retry-after'?: number;
|
|
95
|
+
'remaining-tokens'?: number;
|
|
96
|
+
};
|
|
97
|
+
} | {
|
|
98
|
+
type: 'session-missing';
|
|
99
|
+
message: string;
|
|
100
|
+
hint: {
|
|
101
|
+
'sess-id': string;
|
|
102
|
+
};
|
|
103
|
+
} | {
|
|
104
|
+
type: 'socket-missing';
|
|
105
|
+
message: string;
|
|
106
|
+
hint: {
|
|
107
|
+
'sess-id': string;
|
|
108
|
+
'exception-message'?: string;
|
|
109
|
+
};
|
|
110
|
+
} | {
|
|
111
|
+
type: undefined;
|
|
112
|
+
[k: string]: any;
|
|
113
|
+
} | undefined;
|
|
114
|
+
export type InstantIssue = {
|
|
115
|
+
body: InstantIssueBody;
|
|
116
|
+
status: number;
|
|
117
|
+
};
|
|
118
|
+
export declare class InstantAPIError extends InstantError {
|
|
119
|
+
body: InstantIssueBody;
|
|
120
|
+
status: number;
|
|
121
|
+
constructor(error: InstantIssue);
|
|
122
|
+
get [Symbol.toStringTag](): string;
|
|
123
|
+
}
|
|
124
|
+
export declare function jsonFetch(input: RequestInfo, init: RequestInit | undefined): Promise<any>;
|
|
125
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { InstantError } from '../InstantError.js';
|
|
2
|
+
export class InstantAPIError extends InstantError {
|
|
3
|
+
body;
|
|
4
|
+
status;
|
|
5
|
+
constructor(error) {
|
|
6
|
+
// Create a descriptive message based on the error
|
|
7
|
+
const message = error.body?.message || `API Error (${error.status})`;
|
|
8
|
+
super(message, error.body.hint, error.body?.traceId || error.body['trace-id']);
|
|
9
|
+
const actualProto = new.target.prototype;
|
|
10
|
+
if (Object.setPrototypeOf) {
|
|
11
|
+
Object.setPrototypeOf(this, actualProto);
|
|
12
|
+
}
|
|
13
|
+
// Maintain proper stack trace for where our error was thrown
|
|
14
|
+
if (Error.captureStackTrace) {
|
|
15
|
+
Error.captureStackTrace(this, InstantAPIError);
|
|
16
|
+
}
|
|
17
|
+
this.name = 'InstantAPIError';
|
|
18
|
+
this.status = error.status;
|
|
19
|
+
this.body = error.body;
|
|
20
|
+
}
|
|
21
|
+
get [Symbol.toStringTag]() {
|
|
22
|
+
return 'InstantAPIError';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
export async function jsonFetch(input, init) {
|
|
26
|
+
const res = await fetch(input, init);
|
|
27
|
+
const json = await res.json();
|
|
28
|
+
return res.status === 200
|
|
29
|
+
? Promise.resolve(json)
|
|
30
|
+
: Promise.reject(new InstantAPIError({ status: res.status, body: json }));
|
|
31
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let devBackend = false;
|
|
2
|
+
let instantLogs = false;
|
|
3
|
+
let devtoolLocalDashboard = false;
|
|
4
|
+
if (typeof window !== 'undefined' &&
|
|
5
|
+
typeof window.localStorage !== 'undefined') {
|
|
6
|
+
devBackend = !!window.localStorage.getItem('devBackend');
|
|
7
|
+
instantLogs = !!window.localStorage.getItem('__instantLogging');
|
|
8
|
+
devtoolLocalDashboard = !!window.localStorage.getItem('__devtoolLocalDash');
|
|
9
|
+
}
|
|
10
|
+
export { devBackend, instantLogs, devtoolLocalDashboard };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { v4 } from 'uuid';
|
|
2
|
+
function uuidToByteArray(uuid) {
|
|
3
|
+
const hex = uuid.replace(/-/g, '');
|
|
4
|
+
const bytes = [];
|
|
5
|
+
for (let i = 0; i < hex.length; i += 2) {
|
|
6
|
+
bytes.push(parseInt(hex.substring(i, i + 2), 16));
|
|
7
|
+
}
|
|
8
|
+
return bytes;
|
|
9
|
+
}
|
|
10
|
+
function compareByteArrays(a, b) {
|
|
11
|
+
for (let i = 0; i < a.length; i++) {
|
|
12
|
+
if (a[i] < b[i])
|
|
13
|
+
return -1;
|
|
14
|
+
if (a[i] > b[i])
|
|
15
|
+
return 1;
|
|
16
|
+
}
|
|
17
|
+
return 0;
|
|
18
|
+
}
|
|
19
|
+
export function uuidCompare(uuid_a, uuid_b) {
|
|
20
|
+
return compareByteArrays(uuidToByteArray(uuid_a), uuidToByteArray(uuid_b));
|
|
21
|
+
}
|
|
22
|
+
function id() {
|
|
23
|
+
return v4();
|
|
24
|
+
}
|
|
25
|
+
export default id;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { InstantGraph, LinkDef, LinksDef } from '../schemaTypes.ts';
|
|
2
|
+
export type LinkIndex = Record<string, Record<string, {
|
|
3
|
+
isForward: boolean;
|
|
4
|
+
isSingular: boolean;
|
|
5
|
+
link: LinkDef<any, any, any, any, any, any, any>;
|
|
6
|
+
}>>;
|
|
7
|
+
export declare function createLinkIndex(schema: InstantGraph<any, LinksDef<{}>>): LinkIndex;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export function createLinkIndex(schema) {
|
|
2
|
+
return Object.values(schema.links).reduce((linkIndex, link) => {
|
|
3
|
+
linkIndex[link.forward.on] ??= {};
|
|
4
|
+
linkIndex[link.forward.on][link.forward.label] = {
|
|
5
|
+
isForward: true,
|
|
6
|
+
isSingular: link.forward.has === 'one',
|
|
7
|
+
link,
|
|
8
|
+
};
|
|
9
|
+
linkIndex[link.reverse.on] ??= {};
|
|
10
|
+
linkIndex[link.reverse.on][link.reverse.label] = {
|
|
11
|
+
isForward: false,
|
|
12
|
+
isSingular: link.reverse.has === 'one',
|
|
13
|
+
link,
|
|
14
|
+
};
|
|
15
|
+
return linkIndex;
|
|
16
|
+
}, {});
|
|
17
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export default function createLogger(isEnabled, getStats, baseLogger = console) {
|
|
2
|
+
return {
|
|
3
|
+
info: isEnabled
|
|
4
|
+
? (...args) => baseLogger.info(...args, getStats())
|
|
5
|
+
: () => { },
|
|
6
|
+
debug: isEnabled
|
|
7
|
+
? (...args) => baseLogger.debug(...args, getStats())
|
|
8
|
+
: () => { },
|
|
9
|
+
error: isEnabled
|
|
10
|
+
? (...args) => baseLogger.error(...args, getStats())
|
|
11
|
+
: () => { },
|
|
12
|
+
};
|
|
13
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function areObjectKeysEqual(a: any, b: any): boolean;
|
|
2
|
+
export declare function areObjectsShallowEqual(obj1: any, obj2: any): boolean;
|
|
3
|
+
export declare function areObjectsDeepEqual(obj1: any, obj2: any): any;
|
|
4
|
+
export declare function immutableRemoveUndefined(obj: any): any;
|
|
5
|
+
export declare function immutableDeepMerge(target: any, source: any): any;
|
|
6
|
+
export declare function immutableDeepReplace(target: any, replaceValue: any, replacementValue: any): any;
|
|
7
|
+
export declare function isObject(val: any): boolean;
|
|
8
|
+
export declare function immutableOmitValue(obj: any, v: any): void;
|
|
9
|
+
/**
|
|
10
|
+
* Like `assocInMutative`, but
|
|
11
|
+
*
|
|
12
|
+
* - for arrays: inserts the value at the specified index, instead of replacing it
|
|
13
|
+
*/
|
|
14
|
+
export declare function insertInMutative(obj: any, path: any, value: any): void;
|
|
15
|
+
export declare function assocInMutative(obj: any, path: any, value: any): void;
|
|
16
|
+
export declare function dissocInMutative(obj: any, path: any): void;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
export function areObjectKeysEqual(a, b) {
|
|
2
|
+
const ak = Object.keys(a);
|
|
3
|
+
const bk = Object.keys(b);
|
|
4
|
+
return (ak.length === bk.length && Object.keys(a).every((k) => b.hasOwnProperty(k)));
|
|
5
|
+
}
|
|
6
|
+
export function areObjectsShallowEqual(obj1, obj2) {
|
|
7
|
+
return (Object.keys(obj1).length === Object.keys(obj2).length &&
|
|
8
|
+
Object.keys(obj1).every((key) => obj2.hasOwnProperty(key) && obj1[key] === obj2[key]));
|
|
9
|
+
}
|
|
10
|
+
export function areObjectsDeepEqual(obj1, obj2) {
|
|
11
|
+
if (typeof obj1 !== 'object' ||
|
|
12
|
+
typeof obj2 !== 'object' ||
|
|
13
|
+
obj1 === null ||
|
|
14
|
+
obj2 === null) {
|
|
15
|
+
return obj1 === obj2;
|
|
16
|
+
}
|
|
17
|
+
if (!areObjectKeysEqual(obj1, obj2)) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
return Object.keys(obj1).every((key) => areObjectsDeepEqual(obj1[key], obj2[key]));
|
|
21
|
+
}
|
|
22
|
+
export function immutableRemoveUndefined(obj) {
|
|
23
|
+
if (!isObject(obj)) {
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
const result = {};
|
|
27
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
28
|
+
if (value === undefined)
|
|
29
|
+
continue;
|
|
30
|
+
result[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return result;
|
|
33
|
+
}
|
|
34
|
+
export function immutableDeepMerge(target, source) {
|
|
35
|
+
if (!isObject(target) || !isObject(source)) {
|
|
36
|
+
return source;
|
|
37
|
+
}
|
|
38
|
+
const result = { ...target };
|
|
39
|
+
for (const key of Object.keys(source)) {
|
|
40
|
+
if (source[key] === undefined)
|
|
41
|
+
continue;
|
|
42
|
+
if (source[key] === null) {
|
|
43
|
+
delete result[key];
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const areBothObjects = isObject(target[key]) && isObject(source[key]);
|
|
47
|
+
result[key] = areBothObjects
|
|
48
|
+
? immutableDeepMerge(target[key], source[key])
|
|
49
|
+
: source[key];
|
|
50
|
+
}
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
export function immutableDeepReplace(target, replaceValue, replacementValue) {
|
|
54
|
+
if (!isObject(target)) {
|
|
55
|
+
return target;
|
|
56
|
+
}
|
|
57
|
+
const result = {};
|
|
58
|
+
for (const [key, value] of Object.entries(target)) {
|
|
59
|
+
result[key] = isObject(value)
|
|
60
|
+
? immutableDeepReplace(value, replaceValue, replacementValue)
|
|
61
|
+
: value === replaceValue
|
|
62
|
+
? replacementValue
|
|
63
|
+
: value;
|
|
64
|
+
}
|
|
65
|
+
return result;
|
|
66
|
+
}
|
|
67
|
+
export function isObject(val) {
|
|
68
|
+
return typeof val === 'object' && val !== null && !Array.isArray(val);
|
|
69
|
+
}
|
|
70
|
+
export function immutableOmitValue(obj, v) { }
|
|
71
|
+
/**
|
|
72
|
+
* Like `assocInMutative`, but
|
|
73
|
+
*
|
|
74
|
+
* - for arrays: inserts the value at the specified index, instead of replacing it
|
|
75
|
+
*/
|
|
76
|
+
export function insertInMutative(obj, path, value) {
|
|
77
|
+
if (!obj) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (path.length === 0) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
let current = obj || {};
|
|
84
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
85
|
+
const key = path[i];
|
|
86
|
+
if (!(key in current) || typeof current[key] !== 'object') {
|
|
87
|
+
current[key] = typeof path[i + 1] === 'number' ? [] : {};
|
|
88
|
+
}
|
|
89
|
+
current = current[key];
|
|
90
|
+
}
|
|
91
|
+
const key = path[path.length - 1];
|
|
92
|
+
if (Array.isArray(current) && typeof key === 'number') {
|
|
93
|
+
current.splice(key, 0, value);
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
current[key] = value;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
export function assocInMutative(obj, path, value) {
|
|
100
|
+
if (!obj) {
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
if (path.length === 0) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
let current = obj || {};
|
|
107
|
+
for (let i = 0; i < path.length - 1; i++) {
|
|
108
|
+
const key = path[i];
|
|
109
|
+
if (!(key in current) || typeof current[key] !== 'object') {
|
|
110
|
+
current[key] = typeof path[i + 1] === 'number' ? [] : {};
|
|
111
|
+
}
|
|
112
|
+
current = current[key];
|
|
113
|
+
}
|
|
114
|
+
current[path[path.length - 1]] = value;
|
|
115
|
+
}
|
|
116
|
+
export function dissocInMutative(obj, path) {
|
|
117
|
+
if (!obj) {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
if (path.length === 0) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const [key, ...restPath] = path;
|
|
124
|
+
if (!(key in obj)) {
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (restPath.length === 0) {
|
|
128
|
+
if (Array.isArray(obj)) {
|
|
129
|
+
obj.splice(key, 1);
|
|
130
|
+
}
|
|
131
|
+
else {
|
|
132
|
+
delete obj[key];
|
|
133
|
+
}
|
|
134
|
+
return;
|
|
135
|
+
}
|
|
136
|
+
dissocInMutative(obj[key], restPath);
|
|
137
|
+
if (isEmpty(obj[key])) {
|
|
138
|
+
delete obj[key];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
function isEmpty(obj) {
|
|
142
|
+
return obj && Object.keys(obj).length === 0;
|
|
143
|
+
}
|