remult 0.22.6 → 0.22.7-exp.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/SseSubscriptionServer.d.ts +3 -3
- package/ably.d.ts +1 -1
- package/esm/SseSubscriptionServer.d.ts +3 -3
- package/esm/ably.d.ts +1 -1
- package/esm/graphql.d.ts +1 -1
- package/esm/graphql.js +32 -31
- package/esm/index.d.ts +6 -2
- package/esm/index.js +5 -5
- package/esm/live-query/data-provider-live-query-storage.d.ts +4 -3
- package/esm/live-query/data-provider-live-query-storage.js +2 -1
- package/esm/postgres/postgres-data-provider.d.ts +3 -3
- package/esm/postgres/postgres-data-provider.js +1 -1
- package/esm/postgres/schema-builder.d.ts +8 -5
- package/esm/postgres/schema-builder.js +52 -15
- package/esm/remult-fastify.d.ts +1 -1
- package/esm/remult-fresh.d.ts +1 -1
- package/esm/remult-fresh.js +1 -1
- package/esm/remult-knex/index.d.ts +5 -4
- package/esm/remult-knex/index.js +13 -9
- package/esm/remult-mongo.d.ts +3 -3
- package/esm/remult-mongo.js +5 -4
- package/esm/remult-next.d.ts +2 -2
- package/esm/remult-next.js +1 -1
- package/esm/remult-sveltekit.d.ts +2 -2
- package/esm/remult-sveltekit.js +1 -1
- package/esm/server/JsonEntityFileStorage.d.ts +2 -1
- package/esm/server/JsonEntityFileStorage.js +1 -1
- package/esm/server/expressBridge.d.ts +7 -5
- package/esm/server/expressBridge.js +11 -8
- package/esm/server/index.d.ts +4 -4
- package/esm/server/index.js +3 -3
- package/esm/server/initDataProvider.d.ts +1 -1
- package/esm/src/CompoundIdField.d.ts +27 -0
- package/esm/src/CompoundIdField.js +41 -0
- package/esm/src/buildRestDataProvider.d.ts +1 -1
- package/esm/src/column-interfaces.d.ts +10 -4
- package/esm/src/column.d.ts +2 -29
- package/esm/src/column.js +2 -58
- package/esm/src/context.d.ts +5 -5
- package/esm/src/context.js +3 -3
- package/esm/src/data-api.d.ts +2 -2
- package/esm/src/data-api.js +5 -4
- package/esm/src/data-interfaces.d.ts +2 -2
- package/esm/src/data-providers/array-entity-data-provider.d.ts +2 -2
- package/esm/src/data-providers/array-entity-data-provider.js +2 -2
- package/esm/src/data-providers/in-memory-database.d.ts +3 -3
- package/esm/src/data-providers/json-data-provider.d.ts +2 -2
- package/esm/src/data-providers/rest-data-provider.d.ts +3 -3
- package/esm/src/data-providers/rest-data-provider.js +2 -2
- package/esm/src/data-providers/sql-database.d.ts +6 -5
- package/esm/src/data-providers/sql-database.js +5 -5
- package/esm/src/data-providers/web-sql-data-provider.d.ts +4 -4
- package/esm/src/data-providers/web-sql-data-provider.js +2 -2
- package/esm/src/entity.d.ts +7 -3
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.d.ts +5 -5
- package/esm/src/filter/filter-consumer-bridge-to-sql-request.js +1 -1
- package/esm/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
- package/esm/src/filter/filter-consumer-bridge-to-url-builder.js +0 -1
- package/esm/src/filter/filter-interfaces.d.ts +4 -3
- package/esm/src/filter/filter-interfaces.js +24 -1
- package/esm/src/live-query/LiveQueryClient.js +3 -3
- package/esm/src/live-query/SseSubscriptionClient.d.ts +1 -1
- package/esm/src/live-query/SseSubscriptionClient.js +2 -2
- package/esm/src/live-query/SubscriptionChannel.d.ts +1 -1
- package/esm/src/live-query/SubscriptionChannel.js +2 -1
- package/esm/src/remult-proxy.js +9 -2
- package/esm/src/remult3/DecoratorReplacer.d.ts +1 -1
- package/esm/src/remult3/RepositoryImplementation.d.ts +9 -40
- package/esm/src/remult3/RepositoryImplementation.js +20 -132
- package/esm/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -0
- package/esm/src/remult3/__updateEntityBasedOnWhere.js +24 -0
- package/esm/src/remult3/entity.d.ts +28 -0
- package/esm/src/remult3/entity.js +70 -0
- package/esm/src/remult3/getEntityRef.d.ts +9 -0
- package/esm/src/remult3/getEntityRef.js +27 -0
- package/esm/src/remult3/remult3.d.ts +7 -7
- package/esm/src/resultCompoundIdFilter.d.ts +3 -0
- package/esm/src/resultCompoundIdFilter.js +16 -0
- package/esm/src/server-action-info.d.ts +10 -0
- package/esm/src/server-action-info.js +12 -0
- package/esm/src/server-action.d.ts +4 -13
- package/esm/src/server-action.js +4 -14
- package/esm/src/sort.d.ts +2 -2
- package/esm/src/sort.js +1 -1
- package/esm/src/sql-command.d.ts +1 -1
- package/esm/src/validators.d.ts +1 -1
- package/esm/src/valueConverters.d.ts +1 -1
- package/graphql.d.ts +1 -1
- package/graphql.js +5 -4
- package/index.d.ts +6 -2
- package/index.js +19 -19
- package/live-query/data-provider-live-query-storage.d.ts +4 -3
- package/live-query/data-provider-live-query-storage.js +8 -7
- package/package.json +1 -1
- package/postgres/postgres-data-provider.d.ts +3 -3
- package/postgres/postgres-data-provider.js +1 -1
- package/postgres/schema-builder.d.ts +8 -5
- package/postgres/schema-builder.js +54 -13
- package/remult-fastify.d.ts +1 -1
- package/remult-fresh.d.ts +1 -1
- package/remult-knex/index.d.ts +5 -4
- package/remult-knex/index.js +15 -13
- package/remult-mongo.d.ts +3 -3
- package/remult-mongo.js +4 -3
- package/remult-next.d.ts +2 -2
- package/remult-sveltekit.d.ts +2 -2
- package/server/JsonEntityFileStorage.d.ts +2 -1
- package/server/JsonEntityFileStorage.js +1 -1
- package/server/expressBridge.d.ts +7 -5
- package/server/expressBridge.js +25 -22
- package/server/index.d.ts +4 -4
- package/server/index.js +5 -5
- package/server/initDataProvider.d.ts +1 -1
- package/src/CompoundIdField.d.ts +27 -0
- package/src/CompoundIdField.js +54 -0
- package/src/buildRestDataProvider.d.ts +1 -1
- package/src/column-interfaces.d.ts +10 -4
- package/src/column.d.ts +2 -29
- package/src/column.js +5 -72
- package/src/context.d.ts +5 -5
- package/src/context.js +5 -5
- package/src/data-api.d.ts +2 -2
- package/src/data-api.js +7 -6
- package/src/data-interfaces.d.ts +2 -2
- package/src/data-providers/array-entity-data-provider.d.ts +2 -2
- package/src/data-providers/array-entity-data-provider.js +2 -2
- package/src/data-providers/in-memory-database.d.ts +3 -3
- package/src/data-providers/json-data-provider.d.ts +2 -2
- package/src/data-providers/rest-data-provider.d.ts +3 -3
- package/src/data-providers/rest-data-provider.js +3 -3
- package/src/data-providers/sql-database.d.ts +6 -5
- package/src/data-providers/sql-database.js +6 -6
- package/src/data-providers/web-sql-data-provider.d.ts +4 -4
- package/src/data-providers/web-sql-data-provider.js +4 -4
- package/src/entity.d.ts +7 -3
- package/src/filter/filter-consumer-bridge-to-sql-request.d.ts +5 -5
- package/src/filter/filter-consumer-bridge-to-sql-request.js +2 -2
- package/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
- package/src/filter/filter-consumer-bridge-to-url-builder.js +0 -2
- package/src/filter/filter-interfaces.d.ts +4 -3
- package/src/filter/filter-interfaces.js +28 -4
- package/src/live-query/LiveQueryClient.js +2 -2
- package/src/live-query/SseSubscriptionClient.d.ts +1 -1
- package/src/live-query/SseSubscriptionClient.js +3 -3
- package/src/live-query/SubscriptionChannel.d.ts +1 -1
- package/src/live-query/SubscriptionChannel.js +5 -4
- package/src/remult-proxy.js +9 -2
- package/src/remult3/DecoratorReplacer.d.ts +1 -1
- package/src/remult3/RepositoryImplementation.d.ts +9 -40
- package/src/remult3/RepositoryImplementation.js +57 -188
- package/src/remult3/__updateEntityBasedOnWhere.d.ts +2 -0
- package/src/remult3/__updateEntityBasedOnWhere.js +28 -0
- package/src/remult3/entity.d.ts +28 -0
- package/src/remult3/entity.js +88 -0
- package/src/remult3/getEntityRef.d.ts +9 -0
- package/src/remult3/getEntityRef.js +35 -0
- package/src/remult3/remult3.d.ts +7 -7
- package/src/resultCompoundIdFilter.d.ts +3 -0
- package/src/resultCompoundIdFilter.js +20 -0
- package/src/server-action-info.d.ts +10 -0
- package/src/server-action-info.js +15 -0
- package/src/server-action.d.ts +4 -13
- package/src/server-action.js +21 -31
- package/src/sort.d.ts +2 -2
- package/src/sort.js +3 -3
- package/src/sql-command.d.ts +1 -1
- package/src/validators.d.ts +1 -1
- package/src/valueConverters.d.ts +1 -1
- package/esm/angular/interfaces/index.d.ts +0 -1
- package/esm/angular/interfaces/index.js +0 -1
- package/esm/angular/interfaces/src/column-collection.d.ts +0 -70
- package/esm/angular/interfaces/src/column-collection.js +0 -341
- package/esm/angular/interfaces/src/data-area-settings.d.ts +0 -15
- package/esm/angular/interfaces/src/data-area-settings.js +0 -35
- package/esm/angular/interfaces/src/data-control-interfaces.d.ts +0 -36
- package/esm/angular/interfaces/src/data-control-interfaces.js +0 -57
- package/esm/angular/interfaces/src/dataList.d.ts +0 -13
- package/esm/angular/interfaces/src/dataList.js +0 -42
- package/esm/angular/interfaces/src/filter-helper.d.ts +0 -13
- package/esm/angular/interfaces/src/filter-helper.js +0 -59
- package/esm/angular/interfaces/src/grid-settings.d.ts +0 -145
- package/esm/angular/interfaces/src/grid-settings.js +0 -387
- package/esm/angular/interfaces/src/public_api.d.ts +0 -4
- package/esm/angular/interfaces/src/public_api.js +0 -4
- package/esm/angular/src/angular/RemultAngularPluginsService.d.ts +0 -4
- package/esm/angular/src/angular/RemultAngularPluginsService.js +0 -3
- package/esm/angular/src/angular/data-control/data-control2.component.d.ts +0 -49
- package/esm/angular/src/angular/data-control/data-control2.component.js +0 -138
- package/esm/core/SseSubscriptionServer.d.ts +0 -33
- package/esm/core/SseSubscriptionServer.js +0 -107
- package/esm/core/assign.d.ts +0 -1
- package/esm/core/assign.js +0 -5
- package/esm/core/classType.d.ts +0 -3
- package/esm/core/classType.js +0 -1
- package/esm/core/index.d.ts +0 -27
- package/esm/core/index.js +0 -25
- package/esm/core/inputTypes.d.ts +0 -9
- package/esm/core/inputTypes.js +0 -9
- package/esm/core/live-query/data-provider-live-query-storage.d.ts +0 -22
- package/esm/core/live-query/data-provider-live-query-storage.js +0 -71
- package/esm/core/postgres/index.d.ts +0 -2
- package/esm/core/postgres/index.js +0 -2
- package/esm/core/postgres/postgres-data-provider.d.ts +0 -36
- package/esm/core/postgres/postgres-data-provider.js +0 -120
- package/esm/core/postgres/schema-builder.d.ts +0 -17
- package/esm/core/postgres/schema-builder.js +0 -153
- package/esm/core/remult-fresh.d.ts +0 -17
- package/esm/core/remult-fresh.js +0 -29
- package/esm/core/remult-knex/index.d.ts +0 -30
- package/esm/core/remult-knex/index.js +0 -446
- package/esm/core/remult-mongo.d.ts +0 -24
- package/esm/core/remult-mongo.js +0 -254
- package/esm/core/server/JsonEntityFileStorage.d.ts +0 -10
- package/esm/core/server/JsonEntityFileStorage.js +0 -25
- package/esm/core/server/core.d.ts +0 -4
- package/esm/core/server/core.js +0 -4
- package/esm/core/server/expressBridge.d.ts +0 -182
- package/esm/core/server/expressBridge.js +0 -938
- package/esm/core/server/index.d.ts +0 -6
- package/esm/core/server/index.js +0 -9
- package/esm/core/server/initAsyncHooks.d.ts +0 -1
- package/esm/core/server/initAsyncHooks.js +0 -9
- package/esm/core/server/initDataProvider.d.ts +0 -2
- package/esm/core/server/initDataProvider.js +0 -14
- package/esm/core/src/__EntityValueProvider.d.ts +0 -11
- package/esm/core/src/__EntityValueProvider.js +0 -1
- package/esm/core/src/__RowsOfDataForTesting.d.ts +0 -3
- package/esm/core/src/__RowsOfDataForTesting.js +0 -1
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -6
- package/esm/core/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -147
- package/esm/core/src/backend-tests/my-test.backend-spec.d.ts +0 -1
- package/esm/core/src/backend-tests/my-test.backend-spec.js +0 -197
- package/esm/core/src/backend-tests/test-http-server.backend-spec.d.ts +0 -1
- package/esm/core/src/backend-tests/test-http-server.backend-spec.js +0 -167
- package/esm/core/src/buildRestDataProvider.d.ts +0 -31
- package/esm/core/src/buildRestDataProvider.js +0 -113
- package/esm/core/src/column-interfaces.d.ts +0 -154
- package/esm/core/src/column-interfaces.js +0 -7
- package/esm/core/src/column.d.ts +0 -58
- package/esm/core/src/column.js +0 -174
- package/esm/core/src/context.d.ts +0 -134
- package/esm/core/src/context.js +0 -286
- package/esm/core/src/data-api.d.ts +0 -39
- package/esm/core/src/data-api.js +0 -279
- package/esm/core/src/data-interfaces.d.ts +0 -41
- package/esm/core/src/data-interfaces.js +0 -12
- package/esm/core/src/data-providers/array-entity-data-provider.d.ts +0 -22
- package/esm/core/src/data-providers/array-entity-data-provider.js +0 -252
- package/esm/core/src/data-providers/in-memory-database.d.ts +0 -9
- package/esm/core/src/data-providers/in-memory-database.js +0 -14
- package/esm/core/src/data-providers/json-data-provider.d.ts +0 -12
- package/esm/core/src/data-providers/json-data-provider.js +0 -55
- package/esm/core/src/data-providers/rest-data-provider.d.ts +0 -49
- package/esm/core/src/data-providers/rest-data-provider.js +0 -256
- package/esm/core/src/data-providers/sql-database.d.ts +0 -33
- package/esm/core/src/data-providers/sql-database.js +0 -384
- package/esm/core/src/data-providers/web-sql-data-provider.d.ts +0 -24
- package/esm/core/src/data-providers/web-sql-data-provider.js +0 -143
- package/esm/core/src/entity.d.ts +0 -91
- package/esm/core/src/entity.js +0 -1
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.d.ts +0 -50
- package/esm/core/src/filter/filter-consumer-bridge-to-sql-request.js +0 -150
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.d.ts +0 -1
- package/esm/core/src/filter/filter-consumer-bridge-to-url-builder.js +0 -1
- package/esm/core/src/filter/filter-interfaces.d.ts +0 -85
- package/esm/core/src/filter/filter-interfaces.js +0 -477
- package/esm/core/src/live-query/LiveQueryClient.d.ts +0 -20
- package/esm/core/src/live-query/LiveQueryClient.js +0 -188
- package/esm/core/src/live-query/SseSubscriptionClient.d.ts +0 -5
- package/esm/core/src/live-query/SseSubscriptionClient.js +0 -86
- package/esm/core/src/live-query/SubscriptionChannel.d.ts +0 -72
- package/esm/core/src/live-query/SubscriptionChannel.js +0 -123
- package/esm/core/src/live-query/SubscriptionServer.d.ts +0 -53
- package/esm/core/src/live-query/SubscriptionServer.js +0 -111
- package/esm/core/src/live-query/live-query-tests.spec.d.ts +0 -6
- package/esm/core/src/live-query/live-query-tests.spec.js +0 -952
- package/esm/core/src/remult-proxy.d.ts +0 -35
- package/esm/core/src/remult-proxy.js +0 -113
- package/esm/core/src/remult3/DecoratorReplacer.d.ts +0 -10
- package/esm/core/src/remult3/DecoratorReplacer.js +0 -20
- package/esm/core/src/remult3/RepositoryImplementation.d.ts +0 -355
- package/esm/core/src/remult3/RepositoryImplementation.js +0 -2109
- package/esm/core/src/remult3/index.d.ts +0 -2
- package/esm/core/src/remult3/index.js +0 -2
- package/esm/core/src/remult3/remult3.d.ts +0 -395
- package/esm/core/src/remult3/remult3.js +0 -2
- package/esm/core/src/server-action.d.ts +0 -81
- package/esm/core/src/server-action.js +0 -394
- package/esm/core/src/shared-tests/db-tests-setup.d.ts +0 -32
- package/esm/core/src/shared-tests/db-tests-setup.js +0 -78
- package/esm/core/src/shared-tests/db-tests.db-tests.d.ts +0 -25
- package/esm/core/src/shared-tests/db-tests.db-tests.js +0 -810
- package/esm/core/src/shared-tests/deleteAll.d.ts +0 -2
- package/esm/core/src/shared-tests/deleteAll.js +0 -4
- package/esm/core/src/shared-tests/entityWithValidations.d.ts +0 -14
- package/esm/core/src/shared-tests/entityWithValidations.js +0 -43
- package/esm/core/src/shared-tests/index.d.ts +0 -4
- package/esm/core/src/shared-tests/index.js +0 -4
- package/esm/core/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
- package/esm/core/src/shared-tests/test-custom-id-column.spec.js +0 -67
- package/esm/core/src/shared-tests/test-special-value.spec.d.ts +0 -10
- package/esm/core/src/shared-tests/test-special-value.spec.js +0 -73
- package/esm/core/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
- package/esm/core/src/shared-tests/test-update-with-null.spec.js +0 -31
- package/esm/core/src/sort.d.ts +0 -16
- package/esm/core/src/sort.js +0 -103
- package/esm/core/src/sql-command.d.ts +0 -19
- package/esm/core/src/sql-command.js +0 -1
- package/esm/core/src/test.d.ts +0 -3
- package/esm/core/src/test.js +0 -12
- package/esm/core/src/tests/Done.d.ts +0 -5
- package/esm/core/src/tests/Done.js +0 -9
- package/esm/core/src/tests/RowProvider.spec.d.ts +0 -16
- package/esm/core/src/tests/RowProvider.spec.js +0 -631
- package/esm/core/src/tests/TestDataApiResponse.d.ts +0 -10
- package/esm/core/src/tests/TestDataApiResponse.js +0 -22
- package/esm/core/src/tests/basicRowFunctionality.spec.d.ts +0 -8
- package/esm/core/src/tests/basicRowFunctionality.spec.js +0 -2103
- package/esm/core/src/tests/c.d.ts +0 -8
- package/esm/core/src/tests/c.js +0 -13
- package/esm/core/src/tests/createData.d.ts +0 -7
- package/esm/core/src/tests/createData.js +0 -22
- package/esm/core/src/tests/d.d.ts +0 -6
- package/esm/core/src/tests/d.js +0 -11
- package/esm/core/src/tests/dWithPrefilter.d.ts +0 -7
- package/esm/core/src/tests/dWithPrefilter.js +0 -18
- package/esm/core/src/tests/entityForCustomFilter.d.ts +0 -16
- package/esm/core/src/tests/entityForCustomFilter.js +0 -33
- package/esm/core/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
- package/esm/core/src/tests/entityWithValidationsOnColumn.js +0 -13
- package/esm/core/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
- package/esm/core/src/tests/frontend-database-tests-setup.spec.js +0 -37
- package/esm/core/src/tests/h.d.ts +0 -6
- package/esm/core/src/tests/h.js +0 -24
- package/esm/core/src/tests/remult-3-basic-tests.spec.d.ts +0 -1
- package/esm/core/src/tests/remult-3-basic-tests.spec.js +0 -236
- package/esm/core/src/tests/remult-3-entities.d.ts +0 -23
- package/esm/core/src/tests/remult-3-entities.js +0 -39
- package/esm/core/src/tests/tasks.d.ts +0 -6
- package/esm/core/src/tests/tasks.js +0 -10
- package/esm/core/src/tests/test-context-as-storage.spec.d.ts +0 -0
- package/esm/core/src/tests/test-context-as-storage.spec.js +0 -1
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.d.ts +0 -1
- package/esm/core/src/tests/test-data-api/predefined-filter.spec.js +0 -389
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.d.ts +0 -5
- package/esm/core/src/tests/test-data-api/test-put-with-validation.spec.js +0 -152
- package/esm/core/src/tests/test-decorator-precedence.spec.d.ts +0 -1
- package/esm/core/src/tests/test-decorator-precedence.spec.js +0 -38
- package/esm/core/src/tests/test-default-value.spec.d.ts +0 -1
- package/esm/core/src/tests/test-default-value.spec.js +0 -33
- package/esm/core/src/tests/test-entity-inheritance.spec.d.ts +0 -14
- package/esm/core/src/tests/test-entity-inheritance.spec.js +0 -82
- package/esm/core/src/tests/test-exceptions.spec.d.ts +0 -1
- package/esm/core/src/tests/test-exceptions.spec.js +0 -375
- package/esm/core/src/tests/test-json.spec.d.ts +0 -1
- package/esm/core/src/tests/test-json.spec.js +0 -115
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.d.ts +0 -9
- package/esm/core/src/tests/test-many-to-one-relation-in-entity.spec.js +0 -809
- package/esm/core/src/tests/test-non-active-record.spec.d.ts +0 -1
- package/esm/core/src/tests/test-non-active-record.spec.js +0 -66
- package/esm/core/src/tests/test-object-column.spec.d.ts +0 -1
- package/esm/core/src/tests/test-object-column.spec.js +0 -189
- package/esm/core/src/tests/test-paged-foreach.spec.d.ts +0 -1
- package/esm/core/src/tests/test-paged-foreach.spec.js +0 -328
- package/esm/core/src/tests/test-remult-angular.spec.d.ts +0 -1
- package/esm/core/src/tests/test-remult-angular.spec.js +0 -23
- package/esm/core/src/tests/test-server-controller.spec.d.ts +0 -7
- package/esm/core/src/tests/test-server-controller.spec.js +0 -489
- package/esm/core/src/tests/test-server-expressions.spec.d.ts +0 -1
- package/esm/core/src/tests/test-server-expressions.spec.js +0 -178
- package/esm/core/src/tests/test-server-method-on-entity.spec.d.ts +0 -1
- package/esm/core/src/tests/test-server-method-on-entity.spec.js +0 -306
- package/esm/core/src/tests/test-sql-expression.spec.d.ts +0 -5
- package/esm/core/src/tests/test-sql-expression.spec.js +0 -205
- package/esm/core/src/tests/test-sql.spec.d.ts +0 -1
- package/esm/core/src/tests/test-sql.spec.js +0 -170
- package/esm/core/src/tests/test-subscribe.spec.d.ts +0 -1
- package/esm/core/src/tests/test-subscribe.spec.js +0 -135
- package/esm/core/src/tests/test-type-recovery.spec.d.ts +0 -1
- package/esm/core/src/tests/test-type-recovery.spec.js +0 -49
- package/esm/core/src/tests/test-where-api.spec.d.ts +0 -1
- package/esm/core/src/tests/test-where-api.spec.js +0 -434
- package/esm/core/src/tests/testHelper.spec.d.ts +0 -36
- package/esm/core/src/tests/testHelper.spec.js +0 -226
- package/esm/core/src/tests/testModel/models.d.ts +0 -16
- package/esm/core/src/tests/testModel/models.js +0 -25
- package/esm/core/src/validators.d.ts +0 -14
- package/esm/core/src/validators.js +0 -33
- package/esm/core/src/valueConverters.d.ts +0 -13
- package/esm/core/src/valueConverters.js +0 -197
- package/esm/core/urlBuilder.d.ts +0 -6
- package/esm/core/urlBuilder.js +0 -20
- package/esm/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -7
- package/esm/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -233
- package/esm/src/remult3/index.d.ts +0 -2
- package/esm/src/remult3/index.js +0 -2
- package/esm/src/shared-tests/db-tests-setup.d.ts +0 -34
- package/esm/src/shared-tests/db-tests-setup.js +0 -80
- package/esm/src/shared-tests/db-tests.db-tests.d.ts +0 -25
- package/esm/src/shared-tests/db-tests.db-tests.js +0 -1176
- package/esm/src/shared-tests/deleteAll.d.ts +0 -2
- package/esm/src/shared-tests/deleteAll.js +0 -4
- package/esm/src/shared-tests/entityWithValidations.d.ts +0 -14
- package/esm/src/shared-tests/entityWithValidations.js +0 -53
- package/esm/src/shared-tests/index.d.ts +0 -4
- package/esm/src/shared-tests/index.js +0 -4
- package/esm/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
- package/esm/src/shared-tests/test-custom-id-column.spec.js +0 -63
- package/esm/src/shared-tests/test-special-value.spec.d.ts +0 -10
- package/esm/src/shared-tests/test-special-value.spec.js +0 -88
- package/esm/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
- package/esm/src/shared-tests/test-update-with-null.spec.js +0 -49
- package/esm/src/tests/Done.d.ts +0 -5
- package/esm/src/tests/Done.js +0 -11
- package/esm/src/tests/TestDataApiResponse.d.ts +0 -10
- package/esm/src/tests/TestDataApiResponse.js +0 -21
- package/esm/src/tests/c.d.ts +0 -8
- package/esm/src/tests/c.js +0 -22
- package/esm/src/tests/createData.d.ts +0 -7
- package/esm/src/tests/createData.js +0 -22
- package/esm/src/tests/d.d.ts +0 -6
- package/esm/src/tests/d.js +0 -19
- package/esm/src/tests/dWithPrefilter.d.ts +0 -7
- package/esm/src/tests/dWithPrefilter.js +0 -32
- package/esm/src/tests/entityForCustomFilter.d.ts +0 -16
- package/esm/src/tests/entityForCustomFilter.js +0 -51
- package/esm/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
- package/esm/src/tests/entityWithValidationsOnColumn.js +0 -21
- package/esm/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
- package/esm/src/tests/frontend-database-tests-setup.spec.js +0 -37
- package/esm/src/tests/h.d.ts +0 -6
- package/esm/src/tests/h.js +0 -35
- package/esm/src/tests/remult-3-entities.d.ts +0 -23
- package/esm/src/tests/remult-3-entities.js +0 -72
- package/esm/src/tests/tasks.d.ts +0 -6
- package/esm/src/tests/tasks.js +0 -24
- package/esm/src/tests/testHelper.spec.d.ts +0 -36
- package/esm/src/tests/testHelper.spec.js +0 -236
- package/esm/src/tests/testModel/models.d.ts +0 -16
- package/esm/src/tests/testModel/models.js +0 -31
- package/esm/test-servers/shared/Task.d.ts +0 -9
- package/esm/test-servers/shared/Task.js +0 -32
- package/esm/test.d.ts +0 -5
- package/esm/test.js +0 -6
- package/src/backend-tests/backend-database-test-setup.backend-spec.d.ts +0 -7
- package/src/backend-tests/backend-database-test-setup.backend-spec.js +0 -454
- package/src/remult3/index.d.ts +0 -2
- package/src/remult3/index.js +0 -5
- package/src/shared-tests/db-tests-setup.d.ts +0 -34
- package/src/shared-tests/db-tests-setup.js +0 -185
- package/src/shared-tests/db-tests.db-tests.d.ts +0 -25
- package/src/shared-tests/db-tests.db-tests.js +0 -2540
- package/src/shared-tests/deleteAll.d.ts +0 -2
- package/src/shared-tests/deleteAll.js +0 -21
- package/src/shared-tests/entityWithValidations.d.ts +0 -14
- package/src/shared-tests/entityWithValidations.js +0 -80
- package/src/shared-tests/index.d.ts +0 -4
- package/src/shared-tests/index.js +0 -6
- package/src/shared-tests/test-custom-id-column.spec.d.ts +0 -1
- package/src/shared-tests/test-custom-id-column.spec.js +0 -111
- package/src/shared-tests/test-special-value.spec.d.ts +0 -10
- package/src/shared-tests/test-special-value.spec.js +0 -128
- package/src/shared-tests/test-update-with-null.spec.d.ts +0 -1
- package/src/shared-tests/test-update-with-null.spec.js +0 -91
- package/src/tests/Done.d.ts +0 -5
- package/src/tests/Done.js +0 -17
- package/src/tests/TestDataApiResponse.d.ts +0 -10
- package/src/tests/TestDataApiResponse.js +0 -28
- package/src/tests/c.d.ts +0 -8
- package/src/tests/c.js +0 -28
- package/src/tests/createData.d.ts +0 -7
- package/src/tests/createData.js +0 -50
- package/src/tests/d.d.ts +0 -6
- package/src/tests/d.js +0 -27
- package/src/tests/dWithPrefilter.d.ts +0 -7
- package/src/tests/dWithPrefilter.js +0 -45
- package/src/tests/entityForCustomFilter.d.ts +0 -16
- package/src/tests/entityForCustomFilter.js +0 -77
- package/src/tests/entityWithValidationsOnColumn.d.ts +0 -5
- package/src/tests/entityWithValidationsOnColumn.js +0 -29
- package/src/tests/frontend-database-tests-setup.spec.d.ts +0 -4
- package/src/tests/frontend-database-tests-setup.spec.js +0 -100
- package/src/tests/h.d.ts +0 -6
- package/src/tests/h.js +0 -44
- package/src/tests/remult-3-entities.d.ts +0 -23
- package/src/tests/remult-3-entities.js +0 -85
- package/src/tests/tasks.d.ts +0 -6
- package/src/tests/tasks.js +0 -30
- package/src/tests/testHelper.spec.d.ts +0 -36
- package/src/tests/testHelper.spec.js +0 -395
- package/src/tests/testModel/models.d.ts +0 -16
- package/src/tests/testModel/models.js +0 -39
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { remult as defaultRemult, Sort } from '../../index';
|
|
2
1
|
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import { Sort } from '../sort';
|
|
3
|
+
import { remult as defaultRemult } from '../remult-proxy';
|
|
3
4
|
export const streamUrl = 'stream';
|
|
4
5
|
//@internal
|
|
5
6
|
export class LiveQuerySubscriber {
|
package/esm/src/remult-proxy.js
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
|
+
let defaultRemult;
|
|
2
|
+
function defaultFactory() {
|
|
3
|
+
if (!defaultRemult) {
|
|
4
|
+
defaultRemult = RemultProxy.defaultRemultFactory();
|
|
5
|
+
}
|
|
6
|
+
return defaultRemult;
|
|
7
|
+
}
|
|
1
8
|
/*@internal*/
|
|
2
9
|
export class RemultProxy {
|
|
3
10
|
constructor() {
|
|
4
11
|
/*@internal*/
|
|
5
|
-
this.remultFactory = () =>
|
|
12
|
+
this.remultFactory = () => defaultFactory();
|
|
6
13
|
this.repoCache = new Map();
|
|
7
14
|
//@ts-ignore
|
|
8
15
|
this.repo = (...args) => {
|
|
@@ -147,7 +154,7 @@ export class RemultProxy {
|
|
|
147
154
|
}
|
|
148
155
|
/*@internal*/
|
|
149
156
|
resetFactory() {
|
|
150
|
-
this.remultFactory = () =>
|
|
157
|
+
this.remultFactory = () => defaultFactory();
|
|
151
158
|
}
|
|
152
159
|
get user() {
|
|
153
160
|
return this.remultFactory().user;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { EntityOptions } from '../entity';
|
|
1
|
+
import type { ClassType } from '../../classType';
|
|
3
2
|
import { LookupColumn } from '../column';
|
|
4
|
-
import {
|
|
5
|
-
import { ClassType } from '../../classType';
|
|
3
|
+
import type { FieldMetadata, FieldOptions, ValueConverter, ValueListItem } from '../column-interfaces';
|
|
6
4
|
import { Remult } from '../context';
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { RefSubscriber } from '
|
|
10
|
-
import {
|
|
5
|
+
import type { EntityOptions } from '../entity';
|
|
6
|
+
import type { ControllerRef, EntityFilter, EntityMetadata, EntityOrderBy, EntityRef, FieldRef, FieldsMetadata, FieldsRef, FindFirstOptions, FindFirstOptionsBase, FindOptions, IdMetadata, OmitEB, QueryOptions, QueryResult, Repository, Subscribable } from './remult3';
|
|
7
|
+
import type { RefSubscriber } from './remult3';
|
|
8
|
+
import type { entityEventListener } from '../__EntityValueProvider';
|
|
9
|
+
import type { DataProvider, EntityDataProvider, EntityDataProviderFindOptions, ErrorInfo } from '../data-interfaces';
|
|
10
|
+
import type { Unsubscribe } from '../live-query/SubscriptionChannel';
|
|
11
11
|
export declare class RepositoryImplementation<entityType> implements Repository<entityType> {
|
|
12
12
|
private entity;
|
|
13
13
|
remult: Remult;
|
|
@@ -45,7 +45,7 @@ export declare class RepositoryImplementation<entityType> implements Repository<
|
|
|
45
45
|
private getRefForExistingRow;
|
|
46
46
|
save(item: Partial<OmitEB<entityType>>[]): Promise<entityType[]>;
|
|
47
47
|
save(item: Partial<OmitEB<entityType>>): Promise<entityType>;
|
|
48
|
-
liveQuery(options?: FindOptions<entityType>):
|
|
48
|
+
liveQuery(options?: FindOptions<entityType>): any;
|
|
49
49
|
find(options: FindOptions<entityType>, skipOrderByAndLimit?: boolean): Promise<entityType[]>;
|
|
50
50
|
buildEntityDataProviderFindOptions(options: FindOptions<entityType>): Promise<EntityDataProviderFindOptions>;
|
|
51
51
|
fromJsonArray(jsonItems: any[], load?: (entity: FieldsMetadata<entityType>) => FieldMetadata[]): Promise<entityType[]>;
|
|
@@ -61,12 +61,7 @@ export declare class RepositoryImplementation<entityType> implements Repository<
|
|
|
61
61
|
fixTypes(item: any): Promise<any>;
|
|
62
62
|
findId(id: any, options?: FindFirstOptionsBase<entityType>): Promise<entityType>;
|
|
63
63
|
}
|
|
64
|
-
export declare function __updateEntityBasedOnWhere<T>(entityDefs: EntityMetadata<T>, where: EntityFilter<T>, r: T): void;
|
|
65
64
|
export declare type EntityOptionsFactory = (remult: Remult) => EntityOptions;
|
|
66
|
-
export declare const entityInfo: unique symbol;
|
|
67
|
-
export declare const entityInfo_key: unique symbol;
|
|
68
|
-
export declare function getEntitySettings<T>(entity: ClassType<T>, throwError?: boolean): EntityOptionsFactory;
|
|
69
|
-
export declare function getEntityKey(entity: ClassType<any>): string;
|
|
70
65
|
export declare const columnsOfType: Map<any, columnInfo[]>;
|
|
71
66
|
export declare function createOldEntity<T>(entity: ClassType<T>, remult: Remult): EntityFullInfo<T>;
|
|
72
67
|
declare abstract class rowHelperBase<T> {
|
|
@@ -174,7 +169,6 @@ export declare class FieldRefImplementation<entityType, valueType> implements Fi
|
|
|
174
169
|
__performValidation(): Promise<void>;
|
|
175
170
|
validate(): Promise<boolean>;
|
|
176
171
|
}
|
|
177
|
-
export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;
|
|
178
172
|
export declare const CaptionTransformer: {
|
|
179
173
|
transformCaption: (remult: Remult, key: string, caption: string) => string;
|
|
180
174
|
};
|
|
@@ -303,31 +297,6 @@ interface columnInfo {
|
|
|
303
297
|
key: string;
|
|
304
298
|
settings: (remult: Remult) => FieldOptions;
|
|
305
299
|
}
|
|
306
|
-
/**Decorates classes that should be used as entities.
|
|
307
|
-
* Receives a key and an array of EntityOptions.
|
|
308
|
-
* @example
|
|
309
|
-
* import { Entity, Fields } from "remult";
|
|
310
|
-
* @Entity("tasks", {
|
|
311
|
-
* allowApiCrud: true
|
|
312
|
-
* })
|
|
313
|
-
* export class Task {
|
|
314
|
-
* @Fields.uuid()
|
|
315
|
-
* id!: string;
|
|
316
|
-
* @Fields.string()
|
|
317
|
-
* title = '';
|
|
318
|
-
* @Fields.boolean()
|
|
319
|
-
* completed = false;
|
|
320
|
-
* }
|
|
321
|
-
* @note
|
|
322
|
-
* EntityOptions can be set in two ways:
|
|
323
|
-
* @example
|
|
324
|
-
* // as an object
|
|
325
|
-
* @Entity("tasks",{ allowApiCrud:true })
|
|
326
|
-
* @example
|
|
327
|
-
* // as an arrow function that receives `remult` as a parameter
|
|
328
|
-
* @Entity("tasks", (options,remult) => options.allowApiCrud = true)
|
|
329
|
-
*/
|
|
330
|
-
export declare function Entity<entityType>(key: string, ...options: (EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType> | ((options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>, remult: Remult) => void))[]): (target: any, info?: ClassDecoratorContextStub<entityType extends new (...args: any) => any ? entityType : never>) => any;
|
|
331
300
|
export declare class EntityBase {
|
|
332
301
|
get _(): EntityRef<this>;
|
|
333
302
|
save(): Promise<this>;
|
|
@@ -1,18 +1,21 @@
|
|
|
1
1
|
import { __decorate, __metadata } from "tslib";
|
|
2
|
-
import { CompoundIdField, LookupColumn, makeTitle } from '../column';
|
|
3
|
-
import { allEntities, Remult, isBackend, queryConfig as queryConfig, setControllerSettings, } from '../context';
|
|
4
|
-
import { Filter, } from '../filter/filter-interfaces';
|
|
5
|
-
import { Sort } from '../sort';
|
|
6
|
-
import { v4 as uuid } from 'uuid';
|
|
7
2
|
import { createId } from '@paralleldrive/cuid2';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
3
|
+
import { v4 as uuid } from 'uuid';
|
|
4
|
+
import { LookupColumn, makeTitle } from '../column';
|
|
5
|
+
import { CompoundIdField } from '../CompoundIdField';
|
|
6
|
+
import { Remult, isBackend, queryConfig } from '../context';
|
|
7
|
+
import { Filter } from '../filter/filter-interfaces';
|
|
8
|
+
import { Sort } from '../sort';
|
|
10
9
|
import { assign } from '../../assign';
|
|
11
|
-
import {
|
|
10
|
+
import { filterHelper } from '../filter/filter-interfaces';
|
|
11
|
+
import { ValueConverters } from '../valueConverters';
|
|
12
12
|
import { findOptionsToJson } from '../data-providers/rest-data-provider';
|
|
13
|
-
|
|
13
|
+
import { remult as defaultRemult } from '../remult-proxy';
|
|
14
|
+
import { entityMember, getEntityKey, getEntityRef, getEntitySettings, } from './getEntityRef';
|
|
15
|
+
import { __updateEntityBasedOnWhere } from './__updateEntityBasedOnWhere';
|
|
16
|
+
//import { remult } from "../remult-proxy";
|
|
14
17
|
let classValidatorValidate = undefined;
|
|
15
|
-
// import("class-validator".toString())
|
|
18
|
+
// import ("class-validator".toString())
|
|
16
19
|
// .then((v) => {
|
|
17
20
|
// classValidatorValidate = (item, ref) => {
|
|
18
21
|
// return v.validate(item).then(errors => {
|
|
@@ -507,7 +510,7 @@ export class RepositoryImplementation {
|
|
|
507
510
|
}
|
|
508
511
|
/* @internal*/
|
|
509
512
|
async translateWhereToFilter(where) {
|
|
510
|
-
if (this.metadata.options.backendPrefilter &&
|
|
513
|
+
if (this.metadata.options.backendPrefilter && !this.dataProvider.isProxy) {
|
|
511
514
|
let z = where;
|
|
512
515
|
where = {
|
|
513
516
|
$and: [z, await Filter.resolve(this.metadata.options.backendPrefilter)],
|
|
@@ -520,48 +523,6 @@ export class RepositoryImplementation {
|
|
|
520
523
|
return r;
|
|
521
524
|
}
|
|
522
525
|
}
|
|
523
|
-
export function __updateEntityBasedOnWhere(entityDefs, where, r) {
|
|
524
|
-
let w = Filter.fromEntityFilter(entityDefs, where);
|
|
525
|
-
const emptyFunction = () => { };
|
|
526
|
-
if (w) {
|
|
527
|
-
w.__applyToConsumer({
|
|
528
|
-
custom: emptyFunction,
|
|
529
|
-
databaseCustom: emptyFunction,
|
|
530
|
-
containsCaseInsensitive: emptyFunction,
|
|
531
|
-
isDifferentFrom: emptyFunction,
|
|
532
|
-
isEqualTo: (col, val) => {
|
|
533
|
-
r[col.key] = val;
|
|
534
|
-
},
|
|
535
|
-
isGreaterOrEqualTo: emptyFunction,
|
|
536
|
-
isGreaterThan: emptyFunction,
|
|
537
|
-
isIn: emptyFunction,
|
|
538
|
-
isLessOrEqualTo: emptyFunction,
|
|
539
|
-
isLessThan: emptyFunction,
|
|
540
|
-
isNotNull: emptyFunction,
|
|
541
|
-
isNull: emptyFunction,
|
|
542
|
-
or: emptyFunction,
|
|
543
|
-
});
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
export const entityInfo = Symbol('entityInfo');
|
|
547
|
-
export const entityInfo_key = Symbol('entityInfo_key');
|
|
548
|
-
const entityMember = Symbol('entityMember');
|
|
549
|
-
export function getEntitySettings(entity, throwError = true) {
|
|
550
|
-
if (entity === undefined)
|
|
551
|
-
if (throwError) {
|
|
552
|
-
throw new Error('Undefined is not an entity :)');
|
|
553
|
-
}
|
|
554
|
-
else
|
|
555
|
-
return undefined;
|
|
556
|
-
let info = Reflect.getMetadata(entityInfo, entity);
|
|
557
|
-
if (!info && throwError)
|
|
558
|
-
throw new Error(entity.prototype.constructor.name +
|
|
559
|
-
" is not a known entity, did you forget to set @Entity() or did you forget to add the '@' before the call to Entity?");
|
|
560
|
-
return info;
|
|
561
|
-
}
|
|
562
|
-
export function getEntityKey(entity) {
|
|
563
|
-
return Reflect.getMetadata(entityInfo_key, entity);
|
|
564
|
-
}
|
|
565
526
|
export const columnsOfType = new Map();
|
|
566
527
|
export function createOldEntity(entity, remult) {
|
|
567
528
|
let r = columnsOfType.get(entity);
|
|
@@ -937,7 +898,9 @@ export class rowHelperImplementation extends rowHelperBase {
|
|
|
937
898
|
if (this.wasDeleted())
|
|
938
899
|
throw new Error('cannot save a deleted row');
|
|
939
900
|
this.isLoading = true;
|
|
940
|
-
if (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject ===
|
|
901
|
+
if (onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject ===
|
|
902
|
+
undefined)
|
|
903
|
+
// no need
|
|
941
904
|
await this.__validateEntity();
|
|
942
905
|
let doNotSave = false;
|
|
943
906
|
for (const col of this.fields) {
|
|
@@ -952,7 +915,8 @@ export class rowHelperImplementation extends rowHelperBase {
|
|
|
952
915
|
let ignoreKeys = [];
|
|
953
916
|
for (const field of this.metadata.fields) {
|
|
954
917
|
if (field.dbReadOnly ||
|
|
955
|
-
(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject !==
|
|
918
|
+
(onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject !==
|
|
919
|
+
undefined &&
|
|
956
920
|
!onlyTheseFieldsSentOnlyInTheCaseOfProxySaveWithPartialObject.includes(field.key))) {
|
|
957
921
|
d[field.key] = undefined;
|
|
958
922
|
ignoreKeys.push(field.key);
|
|
@@ -1287,14 +1251,6 @@ export class FieldRefImplementation {
|
|
|
1287
1251
|
return !!!this.error;
|
|
1288
1252
|
}
|
|
1289
1253
|
}
|
|
1290
|
-
export function getEntityRef(entity, throwException = true) {
|
|
1291
|
-
let x = entity[entityMember];
|
|
1292
|
-
if (!x && throwException)
|
|
1293
|
-
throw new Error('item ' +
|
|
1294
|
-
entity.constructor.name +
|
|
1295
|
-
' was not initialized using a context');
|
|
1296
|
-
return x;
|
|
1297
|
-
}
|
|
1298
1254
|
export const CaptionTransformer = {
|
|
1299
1255
|
transformCaption: (remult, key, caption) => caption,
|
|
1300
1256
|
};
|
|
@@ -1754,7 +1710,7 @@ export function getValueList(type) {
|
|
|
1754
1710
|
* title='';
|
|
1755
1711
|
*/
|
|
1756
1712
|
export function Field(valueType, ...options) {
|
|
1757
|
-
//
|
|
1713
|
+
// import ANT!!!! if you call this in another decorator, make sure to set It's return type correctly with the | undefined
|
|
1758
1714
|
return (target, context, c) => {
|
|
1759
1715
|
const key = typeof context === 'string' ? context : context.name.toString();
|
|
1760
1716
|
let factory = (remult) => {
|
|
@@ -1898,74 +1854,6 @@ export function decorateColumnSettings(settings, remult) {
|
|
|
1898
1854
|
}
|
|
1899
1855
|
return settings;
|
|
1900
1856
|
}
|
|
1901
|
-
//[ ] YONI - in Typescript 5 I do get the name of the class, what would we like to change because of that?
|
|
1902
|
-
/**Decorates classes that should be used as entities.
|
|
1903
|
-
* Receives a key and an array of EntityOptions.
|
|
1904
|
-
* @example
|
|
1905
|
-
* import { Entity, Fields } from "remult";
|
|
1906
|
-
* @Entity("tasks", {
|
|
1907
|
-
* allowApiCrud: true
|
|
1908
|
-
* })
|
|
1909
|
-
* export class Task {
|
|
1910
|
-
* @Fields.uuid()
|
|
1911
|
-
* id!: string;
|
|
1912
|
-
* @Fields.string()
|
|
1913
|
-
* title = '';
|
|
1914
|
-
* @Fields.boolean()
|
|
1915
|
-
* completed = false;
|
|
1916
|
-
* }
|
|
1917
|
-
* @note
|
|
1918
|
-
* EntityOptions can be set in two ways:
|
|
1919
|
-
* @example
|
|
1920
|
-
* // as an object
|
|
1921
|
-
* @Entity("tasks",{ allowApiCrud:true })
|
|
1922
|
-
* @example
|
|
1923
|
-
* // as an arrow function that receives `remult` as a parameter
|
|
1924
|
-
* @Entity("tasks", (options,remult) => options.allowApiCrud = true)
|
|
1925
|
-
*/
|
|
1926
|
-
export function Entity(key, ...options) {
|
|
1927
|
-
return (target, info) => {
|
|
1928
|
-
for (const rawFilterMember in target) {
|
|
1929
|
-
if (Object.prototype.hasOwnProperty.call(target, rawFilterMember)) {
|
|
1930
|
-
const element = target[rawFilterMember];
|
|
1931
|
-
if (element?.rawFilterInfo?.rawFilterTranslator) {
|
|
1932
|
-
if (!element.rawFilterInfo.key)
|
|
1933
|
-
element.rawFilterInfo.key = rawFilterMember;
|
|
1934
|
-
}
|
|
1935
|
-
}
|
|
1936
|
-
}
|
|
1937
|
-
let factory = (remult) => {
|
|
1938
|
-
let r = {};
|
|
1939
|
-
for (const o of options) {
|
|
1940
|
-
if (o) {
|
|
1941
|
-
if (typeof o === 'function')
|
|
1942
|
-
o(r, remult);
|
|
1943
|
-
else
|
|
1944
|
-
Object.assign(r, o);
|
|
1945
|
-
}
|
|
1946
|
-
}
|
|
1947
|
-
let base = Object.getPrototypeOf(target);
|
|
1948
|
-
if (base) {
|
|
1949
|
-
let baseFactory = getEntitySettings(base, false);
|
|
1950
|
-
if (baseFactory) {
|
|
1951
|
-
let opt = baseFactory(remult);
|
|
1952
|
-
if (opt) {
|
|
1953
|
-
r = {
|
|
1954
|
-
...opt,
|
|
1955
|
-
...r,
|
|
1956
|
-
};
|
|
1957
|
-
}
|
|
1958
|
-
}
|
|
1959
|
-
}
|
|
1960
|
-
return r;
|
|
1961
|
-
};
|
|
1962
|
-
allEntities.push(target);
|
|
1963
|
-
setControllerSettings(target, { key });
|
|
1964
|
-
Reflect.defineMetadata(entityInfo, factory, target);
|
|
1965
|
-
Reflect.defineMetadata(entityInfo_key, key, target);
|
|
1966
|
-
return target;
|
|
1967
|
-
};
|
|
1968
|
-
}
|
|
1969
1857
|
export class EntityBase {
|
|
1970
1858
|
get _() {
|
|
1971
1859
|
return getEntityRef(this);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Filter } from '../filter/filter-interfaces';
|
|
2
|
+
export function __updateEntityBasedOnWhere(entityDefs, where, r) {
|
|
3
|
+
let w = Filter.fromEntityFilter(entityDefs, where);
|
|
4
|
+
const emptyFunction = () => { };
|
|
5
|
+
if (w) {
|
|
6
|
+
w.__applyToConsumer({
|
|
7
|
+
custom: emptyFunction,
|
|
8
|
+
databaseCustom: emptyFunction,
|
|
9
|
+
containsCaseInsensitive: emptyFunction,
|
|
10
|
+
isDifferentFrom: emptyFunction,
|
|
11
|
+
isEqualTo: (col, val) => {
|
|
12
|
+
r[col.key] = val;
|
|
13
|
+
},
|
|
14
|
+
isGreaterOrEqualTo: emptyFunction,
|
|
15
|
+
isGreaterThan: emptyFunction,
|
|
16
|
+
isIn: emptyFunction,
|
|
17
|
+
isLessOrEqualTo: emptyFunction,
|
|
18
|
+
isLessThan: emptyFunction,
|
|
19
|
+
isNotNull: emptyFunction,
|
|
20
|
+
isNull: emptyFunction,
|
|
21
|
+
or: emptyFunction,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { Remult } from '../context';
|
|
2
|
+
import type { EntityOptions } from '../entity';
|
|
3
|
+
import type { ClassDecoratorContextStub } from './RepositoryImplementation';
|
|
4
|
+
/**Decorates classes that should be used as entities.
|
|
5
|
+
* Receives a key and an array of EntityOptions.
|
|
6
|
+
* @example
|
|
7
|
+
* import { Entity, Fields } from "remult";
|
|
8
|
+
* @Entity("tasks", {
|
|
9
|
+
* allowApiCrud: true
|
|
10
|
+
* })
|
|
11
|
+
* export class Task {
|
|
12
|
+
* @Fields.uuid()
|
|
13
|
+
* id!: string;
|
|
14
|
+
* @Fields.string()
|
|
15
|
+
* title = '';
|
|
16
|
+
* @Fields.boolean()
|
|
17
|
+
* completed = false;
|
|
18
|
+
* }
|
|
19
|
+
* @note
|
|
20
|
+
* EntityOptions can be set in two ways:
|
|
21
|
+
* @example
|
|
22
|
+
* // as an object
|
|
23
|
+
* @Entity("tasks",{ allowApiCrud:true })
|
|
24
|
+
* @example
|
|
25
|
+
* // as an arrow function that receives `remult` as a parameter
|
|
26
|
+
* @Entity("tasks", (options,remult) => options.allowApiCrud = true)
|
|
27
|
+
*/
|
|
28
|
+
export declare function Entity<entityType>(key: string, ...options: (EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType> | ((options: EntityOptions<entityType extends new (...args: any) => any ? InstanceType<entityType> : entityType>, remult: Remult) => void))[]): (target: any, info?: ClassDecoratorContextStub<entityType extends new (...args: any) => any ? entityType : never>) => any;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { allEntities, setControllerSettings } from '../context';
|
|
2
|
+
import { entityInfo, entityInfo_key, getEntitySettings } from './getEntityRef';
|
|
3
|
+
//[ ] YONI - in Typescript 5 I do get the name of the class, what would we like to change because of that?
|
|
4
|
+
/**Decorates classes that should be used as entities.
|
|
5
|
+
* Receives a key and an array of EntityOptions.
|
|
6
|
+
* @example
|
|
7
|
+
* import { Entity, Fields } from "remult";
|
|
8
|
+
* @Entity("tasks", {
|
|
9
|
+
* allowApiCrud: true
|
|
10
|
+
* })
|
|
11
|
+
* export class Task {
|
|
12
|
+
* @Fields.uuid()
|
|
13
|
+
* id!: string;
|
|
14
|
+
* @Fields.string()
|
|
15
|
+
* title = '';
|
|
16
|
+
* @Fields.boolean()
|
|
17
|
+
* completed = false;
|
|
18
|
+
* }
|
|
19
|
+
* @note
|
|
20
|
+
* EntityOptions can be set in two ways:
|
|
21
|
+
* @example
|
|
22
|
+
* // as an object
|
|
23
|
+
* @Entity("tasks",{ allowApiCrud:true })
|
|
24
|
+
* @example
|
|
25
|
+
* // as an arrow function that receives `remult` as a parameter
|
|
26
|
+
* @Entity("tasks", (options,remult) => options.allowApiCrud = true)
|
|
27
|
+
*/
|
|
28
|
+
export function Entity(key, ...options) {
|
|
29
|
+
return (target, info) => {
|
|
30
|
+
for (const rawFilterMember in target) {
|
|
31
|
+
if (Object.prototype.hasOwnProperty.call(target, rawFilterMember)) {
|
|
32
|
+
const element = target[rawFilterMember];
|
|
33
|
+
if (element?.rawFilterInfo?.rawFilterTranslator) {
|
|
34
|
+
if (!element.rawFilterInfo.key)
|
|
35
|
+
element.rawFilterInfo.key = rawFilterMember;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
let factory = (remult) => {
|
|
40
|
+
let r = {};
|
|
41
|
+
for (const o of options) {
|
|
42
|
+
if (o) {
|
|
43
|
+
if (typeof o === 'function')
|
|
44
|
+
o(r, remult);
|
|
45
|
+
else
|
|
46
|
+
Object.assign(r, o);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
let base = Object.getPrototypeOf(target);
|
|
50
|
+
if (base) {
|
|
51
|
+
let baseFactory = getEntitySettings(base, false);
|
|
52
|
+
if (baseFactory) {
|
|
53
|
+
let opt = baseFactory(remult);
|
|
54
|
+
if (opt) {
|
|
55
|
+
r = {
|
|
56
|
+
...opt,
|
|
57
|
+
...r,
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return r;
|
|
63
|
+
};
|
|
64
|
+
allEntities.push(target);
|
|
65
|
+
setControllerSettings(target, { key });
|
|
66
|
+
Reflect.defineMetadata(entityInfo, factory, target);
|
|
67
|
+
Reflect.defineMetadata(entityInfo_key, key, target);
|
|
68
|
+
return target;
|
|
69
|
+
};
|
|
70
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ClassType } from '../../classType';
|
|
2
|
+
import type { EntityOptionsFactory } from './RepositoryImplementation';
|
|
3
|
+
import type { EntityRef } from './remult3';
|
|
4
|
+
export declare function getEntityRef<entityType>(entity: entityType, throwException?: boolean): EntityRef<entityType>;
|
|
5
|
+
export declare const entityMember: unique symbol;
|
|
6
|
+
export declare const entityInfo: unique symbol;
|
|
7
|
+
export declare const entityInfo_key: unique symbol;
|
|
8
|
+
export declare function getEntitySettings<T>(entity: ClassType<T>, throwError?: boolean): EntityOptionsFactory;
|
|
9
|
+
export declare function getEntityKey(entity: ClassType<any>): string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export function getEntityRef(entity, throwException = true) {
|
|
2
|
+
let x = entity[entityMember];
|
|
3
|
+
if (!x && throwException)
|
|
4
|
+
throw new Error('item ' +
|
|
5
|
+
entity.constructor.name +
|
|
6
|
+
' was not initialized using a context');
|
|
7
|
+
return x;
|
|
8
|
+
}
|
|
9
|
+
export const entityMember = Symbol('entityMember');
|
|
10
|
+
export const entityInfo = Symbol('entityInfo');
|
|
11
|
+
export const entityInfo_key = Symbol('entityInfo_key');
|
|
12
|
+
export function getEntitySettings(entity, throwError = true) {
|
|
13
|
+
if (entity === undefined)
|
|
14
|
+
if (throwError) {
|
|
15
|
+
throw new Error('Undefined is not an entity :)');
|
|
16
|
+
}
|
|
17
|
+
else
|
|
18
|
+
return undefined;
|
|
19
|
+
let info = Reflect.getMetadata(entityInfo, entity);
|
|
20
|
+
if (!info && throwError)
|
|
21
|
+
throw new Error(entity.prototype.constructor.name +
|
|
22
|
+
" is not a known entity, did you forget to set @Entity() or did you forget to add the '@' before the call to Entity?");
|
|
23
|
+
return info;
|
|
24
|
+
}
|
|
25
|
+
export function getEntityKey(entity) {
|
|
26
|
+
return Reflect.getMetadata(entityInfo_key, entity);
|
|
27
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import type { ErrorInfo } from '../..';
|
|
2
|
+
import type { ClassType } from '../../classType';
|
|
3
|
+
import type { entityEventListener } from '../__EntityValueProvider';
|
|
4
|
+
import type { FieldMetadata } from '../column-interfaces';
|
|
5
|
+
import type { EntityOptions } from '../entity';
|
|
6
|
+
import type { LiveQueryChange, SubscriptionListener, Unsubscribe } from '../live-query/SubscriptionChannel';
|
|
7
|
+
import type { SortSegment } from '../sort';
|
|
8
8
|
export interface EntityRef<entityType> extends Subscribable {
|
|
9
9
|
hasErrors(): boolean;
|
|
10
10
|
undoChanges(): any;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Filter } from './filter/filter-interfaces';
|
|
2
|
+
export function resultCompoundIdFilter(idField, id, data) {
|
|
3
|
+
return new Filter((add) => {
|
|
4
|
+
let idParts = [];
|
|
5
|
+
if (id != undefined)
|
|
6
|
+
idParts = id.split(',');
|
|
7
|
+
idField.fields.forEach((c, i) => {
|
|
8
|
+
let val = undefined;
|
|
9
|
+
if (i < idParts.length)
|
|
10
|
+
val = idParts[i];
|
|
11
|
+
if (data[c.key] != undefined)
|
|
12
|
+
val = data[c.key];
|
|
13
|
+
add.isEqualTo(c, val);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const actionInfo: {
|
|
2
|
+
allActions: any[];
|
|
3
|
+
runningOnServer: boolean;
|
|
4
|
+
runActionWithoutBlockingUI: <T>(what: () => Promise<T>) => Promise<T>;
|
|
5
|
+
startBusyWithProgress: () => {
|
|
6
|
+
progress: (percent: number) => void;
|
|
7
|
+
close: () => void;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
export declare const serverActionField: unique symbol;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const actionInfo = {
|
|
2
|
+
allActions: [],
|
|
3
|
+
runningOnServer: false,
|
|
4
|
+
runActionWithoutBlockingUI: (what) => {
|
|
5
|
+
return what();
|
|
6
|
+
},
|
|
7
|
+
startBusyWithProgress: () => ({
|
|
8
|
+
progress: (percent) => { },
|
|
9
|
+
close: () => { },
|
|
10
|
+
}),
|
|
11
|
+
};
|
|
12
|
+
export const serverActionField = Symbol('serverActionField');
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { AllowedForInstance } from './context';
|
|
3
|
+
import { Remult } from './context';
|
|
4
|
+
import type { DataApiResponse } from './data-api';
|
|
5
|
+
import type { DataProvider, RestDataProviderHttpProvider } from './data-interfaces';
|
|
5
6
|
interface inArgs {
|
|
6
7
|
args: any[];
|
|
7
8
|
}
|
|
@@ -44,16 +45,6 @@ export interface BackendMethodOptions<type> {
|
|
|
44
45
|
blockUser?: boolean;
|
|
45
46
|
paramTypes?: any[];
|
|
46
47
|
}
|
|
47
|
-
export declare const actionInfo: {
|
|
48
|
-
allActions: any[];
|
|
49
|
-
runningOnServer: boolean;
|
|
50
|
-
runActionWithoutBlockingUI: <T>(what: () => Promise<T>) => Promise<T>;
|
|
51
|
-
startBusyWithProgress: () => {
|
|
52
|
-
progress: (percent: number) => void;
|
|
53
|
-
close: () => void;
|
|
54
|
-
};
|
|
55
|
-
};
|
|
56
|
-
export declare const serverActionField: unique symbol;
|
|
57
48
|
export declare function Controller(key: string): (target: any, context?: any) => any;
|
|
58
49
|
export interface ClassMethodDecoratorContextStub<This = unknown, Value extends (this: This, ...args: any) => any = (this: This, ...args: any) => any> {
|
|
59
50
|
readonly kind: 'method';
|
package/esm/src/server-action.js
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import 'reflect-metadata';
|
|
2
|
-
import { Remult, allEntities, classHelpers, ClassHelper, setControllerSettings, doTransaction, isBackend, } from './context';
|
|
3
2
|
import { buildRestDataProvider } from './buildRestDataProvider';
|
|
3
|
+
import { ClassHelper, Remult, allEntities, classHelpers, doTransaction, isBackend, setControllerSettings, } from './context';
|
|
4
4
|
import { SqlDatabase } from './data-providers/sql-database';
|
|
5
|
-
import { getEntityRef, decorateColumnSettings, getEntitySettings, getControllerRef, checkTarget, } from './remult3';
|
|
6
5
|
import { remult } from './remult-proxy';
|
|
6
|
+
import { checkTarget, decorateColumnSettings, getControllerRef, } from './remult3/RepositoryImplementation';
|
|
7
|
+
import { getEntityRef, getEntitySettings } from './remult3/getEntityRef';
|
|
8
|
+
import { actionInfo, serverActionField } from './server-action-info';
|
|
7
9
|
export class Action {
|
|
8
10
|
constructor(actionUrl, queue, allowed) {
|
|
9
11
|
this.actionUrl = actionUrl;
|
|
@@ -92,18 +94,6 @@ export class myServerAction extends Action {
|
|
|
92
94
|
return result;
|
|
93
95
|
}
|
|
94
96
|
}
|
|
95
|
-
export const actionInfo = {
|
|
96
|
-
allActions: [],
|
|
97
|
-
runningOnServer: false,
|
|
98
|
-
runActionWithoutBlockingUI: (what) => {
|
|
99
|
-
return what();
|
|
100
|
-
},
|
|
101
|
-
startBusyWithProgress: () => ({
|
|
102
|
-
progress: (percent) => { },
|
|
103
|
-
close: () => { },
|
|
104
|
-
}),
|
|
105
|
-
};
|
|
106
|
-
export const serverActionField = Symbol('serverActionField');
|
|
107
97
|
const classOptions = new Map();
|
|
108
98
|
export function Controller(key) {
|
|
109
99
|
return function (target, context) {
|
package/esm/src/sort.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FieldMetadata } from './column-interfaces';
|
|
2
|
-
import { EntityMetadata, EntityOrderBy } from './remult3';
|
|
1
|
+
import type { FieldMetadata } from './column-interfaces';
|
|
2
|
+
import type { EntityMetadata, EntityOrderBy } from './remult3/remult3';
|
|
3
3
|
export declare class Sort {
|
|
4
4
|
toEntityOrderBy(): EntityOrderBy<any>;
|
|
5
5
|
constructor(...segments: SortSegment[]);
|
package/esm/src/sort.js
CHANGED
package/esm/src/sql-command.d.ts
CHANGED