prostgles-server 4.2.178 → 4.2.180
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/.vscode/settings.json +10 -1
- package/dist/DboBuilder/TableHandler/DataValidator.d.ts +1 -1
- package/dist/DboBuilder/TableHandler/DataValidator.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/DataValidator.js +4 -4
- package/dist/DboBuilder/TableHandler/DataValidator.js.map +1 -1
- package/dist/DboBuilder/TableHandler/TableHandler.d.ts +1 -1
- package/dist/DboBuilder/TableHandler/TableHandler.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/insert.js +3 -3
- package/dist/DboBuilder/TableHandler/insert.js.map +1 -1
- package/dist/DboBuilder/TableHandler/update.d.ts.map +1 -1
- package/dist/DboBuilder/TableHandler/update.js +45 -19
- package/dist/DboBuilder/TableHandler/update.js.map +1 -1
- package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts +1 -1
- package/dist/DboBuilder/ViewHandler/ViewHandler.d.ts.map +1 -1
- package/dist/DboBuilder/ViewHandler/ViewHandler.js +2 -2
- package/dist/DboBuilder/ViewHandler/ViewHandler.js.map +1 -1
- package/dist/DboBuilder/parseUpdateRules.js +1 -1
- package/dist/DboBuilder/parseUpdateRules.js.map +1 -1
- package/dist/Logging.d.ts +10 -3
- package/dist/Logging.d.ts.map +1 -1
- package/dist/Prostgles.d.ts +2 -2
- package/dist/Prostgles.d.ts.map +1 -1
- package/dist/Prostgles.js +118 -53
- package/dist/Prostgles.js.map +1 -1
- package/dist/ProstglesTypes.d.ts +77 -23
- package/dist/ProstglesTypes.d.ts.map +1 -1
- package/dist/ProstglesTypes.js.map +1 -1
- package/dist/SyncReplication.js +2 -2
- package/dist/SyncReplication.js.map +1 -1
- package/dist/initProstgles.d.ts +9 -2
- package/dist/initProstgles.d.ts.map +1 -1
- package/dist/initProstgles.js +65 -57
- package/dist/initProstgles.js.map +1 -1
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js.map +1 -1
- package/documentation/CLIENT.md +542 -0
- package/documentation/SERVER.md +104 -0
- package/documentation/utils/clientTypes.ts +8436 -0
- package/documentation/utils/dist/clientTypes.d.ts +7705 -0
- package/documentation/utils/dist/clientTypes.d.ts.map +1 -0
- package/documentation/utils/dist/clientTypes.js +8438 -0
- package/documentation/utils/dist/definitions.d.ts +7705 -0
- package/documentation/utils/dist/definitions.d.ts.map +1 -0
- package/documentation/utils/dist/definitions.js +8438 -0
- package/documentation/utils/dist/generateClientDocs.d.ts +3 -0
- package/documentation/utils/dist/generateClientDocs.d.ts.map +1 -0
- package/documentation/utils/dist/generateClientDocs.js +115 -0
- package/documentation/utils/dist/generateDocs.d.ts +2 -0
- package/documentation/utils/dist/generateDocs.d.ts.map +1 -0
- package/documentation/utils/dist/generateDocs.js +6 -0
- package/documentation/utils/dist/generateMarkdown.d.ts +2 -0
- package/documentation/utils/dist/generateMarkdown.d.ts.map +1 -0
- package/documentation/utils/dist/generateMarkdown.js +68 -0
- package/documentation/utils/dist/generateServerDocs.d.ts +2 -0
- package/documentation/utils/dist/generateServerDocs.d.ts.map +1 -0
- package/documentation/utils/dist/generateServerDocs.js +80 -0
- package/documentation/utils/dist/getResolvedTypes.d.ts +15 -0
- package/documentation/utils/dist/getResolvedTypes.d.ts.map +1 -0
- package/documentation/utils/dist/getResolvedTypes.js +29 -0
- package/documentation/utils/dist/getSerializableType.d.ts +69 -0
- package/documentation/utils/dist/getSerializableType.d.ts.map +1 -0
- package/documentation/utils/dist/getSerializableType.js +273 -0
- package/documentation/utils/dist/getSymbolComments.d.ts +11 -0
- package/documentation/utils/dist/getSymbolComments.d.ts.map +1 -0
- package/documentation/utils/dist/getSymbolComments.js +60 -0
- package/documentation/utils/dist/loadTsFile.d.ts +7 -0
- package/documentation/utils/dist/loadTsFile.d.ts.map +1 -0
- package/documentation/utils/dist/loadTsFile.js +33 -0
- package/documentation/utils/dist/moduleResolver.d.ts +9 -0
- package/documentation/utils/dist/moduleResolver.d.ts.map +1 -0
- package/documentation/utils/dist/moduleResolver.js +27 -0
- package/documentation/utils/dist/serverTypes.d.ts +307 -0
- package/documentation/utils/dist/serverTypes.d.ts.map +1 -0
- package/documentation/utils/dist/serverTypes.js +347 -0
- package/documentation/utils/generateClientDocs.ts +142 -0
- package/documentation/utils/generateDocs.ts +4 -0
- package/documentation/utils/generateServerDocs.ts +82 -0
- package/documentation/utils/getResolvedTypes.ts +45 -0
- package/documentation/utils/getSerializableType.ts +479 -0
- package/documentation/utils/loadTsFile.ts +45 -0
- package/documentation/utils/moduleResolver.ts +31 -0
- package/documentation/utils/node_modules/.package-lock.json +67 -0
- package/documentation/utils/node_modules/@types/node/LICENSE +21 -0
- package/documentation/utils/node_modules/@types/node/README.md +15 -0
- package/documentation/utils/node_modules/@types/node/assert/strict.d.ts +8 -0
- package/documentation/utils/node_modules/@types/node/assert.d.ts +1040 -0
- package/documentation/utils/node_modules/@types/node/async_hooks.d.ts +541 -0
- package/documentation/utils/node_modules/@types/node/buffer.buffer.d.ts +385 -0
- package/documentation/utils/node_modules/@types/node/buffer.d.ts +1934 -0
- package/documentation/utils/node_modules/@types/node/child_process.d.ts +1548 -0
- package/documentation/utils/node_modules/@types/node/cluster.d.ts +578 -0
- package/documentation/utils/node_modules/@types/node/compatibility/disposable.d.ts +16 -0
- package/documentation/utils/node_modules/@types/node/compatibility/index.d.ts +9 -0
- package/documentation/utils/node_modules/@types/node/compatibility/indexable.d.ts +20 -0
- package/documentation/utils/node_modules/@types/node/compatibility/iterators.d.ts +21 -0
- package/documentation/utils/node_modules/@types/node/console.d.ts +452 -0
- package/documentation/utils/node_modules/@types/node/constants.d.ts +19 -0
- package/documentation/utils/node_modules/@types/node/crypto.d.ts +4519 -0
- package/documentation/utils/node_modules/@types/node/dgram.d.ts +596 -0
- package/documentation/utils/node_modules/@types/node/diagnostics_channel.d.ts +554 -0
- package/documentation/utils/node_modules/@types/node/dns/promises.d.ts +477 -0
- package/documentation/utils/node_modules/@types/node/dns.d.ts +864 -0
- package/documentation/utils/node_modules/@types/node/dom-events.d.ts +124 -0
- package/documentation/utils/node_modules/@types/node/domain.d.ts +170 -0
- package/documentation/utils/node_modules/@types/node/events.d.ts +931 -0
- package/documentation/utils/node_modules/@types/node/fs/promises.d.ts +1245 -0
- package/documentation/utils/node_modules/@types/node/fs.d.ts +4317 -0
- package/documentation/utils/node_modules/@types/node/globals.d.ts +468 -0
- package/documentation/utils/node_modules/@types/node/globals.typedarray.d.ts +21 -0
- package/documentation/utils/node_modules/@types/node/http.d.ts +1944 -0
- package/documentation/utils/node_modules/@types/node/http2.d.ts +2555 -0
- package/documentation/utils/node_modules/@types/node/https.d.ts +544 -0
- package/documentation/utils/node_modules/@types/node/index.d.ts +91 -0
- package/documentation/utils/node_modules/@types/node/inspector.d.ts +3696 -0
- package/documentation/utils/node_modules/@types/node/module.d.ts +315 -0
- package/documentation/utils/node_modules/@types/node/net.d.ts +1005 -0
- package/documentation/utils/node_modules/@types/node/os.d.ts +495 -0
- package/documentation/utils/node_modules/@types/node/package.json +220 -0
- package/documentation/utils/node_modules/@types/node/path.d.ts +200 -0
- package/documentation/utils/node_modules/@types/node/perf_hooks.d.ts +934 -0
- package/documentation/utils/node_modules/@types/node/process.d.ts +1879 -0
- package/documentation/utils/node_modules/@types/node/punycode.d.ts +117 -0
- package/documentation/utils/node_modules/@types/node/querystring.d.ts +153 -0
- package/documentation/utils/node_modules/@types/node/readline/promises.d.ts +162 -0
- package/documentation/utils/node_modules/@types/node/readline.d.ts +589 -0
- package/documentation/utils/node_modules/@types/node/repl.d.ts +430 -0
- package/documentation/utils/node_modules/@types/node/sea.d.ts +153 -0
- package/documentation/utils/node_modules/@types/node/stream/consumers.d.ts +12 -0
- package/documentation/utils/node_modules/@types/node/stream/promises.d.ts +90 -0
- package/documentation/utils/node_modules/@types/node/stream/web.d.ts +524 -0
- package/documentation/utils/node_modules/@types/node/stream.d.ts +1726 -0
- package/documentation/utils/node_modules/@types/node/string_decoder.d.ts +67 -0
- package/documentation/utils/node_modules/@types/node/test.d.ts +1938 -0
- package/documentation/utils/node_modules/@types/node/timers/promises.d.ts +97 -0
- package/documentation/utils/node_modules/@types/node/timers.d.ts +240 -0
- package/documentation/utils/node_modules/@types/node/tls.d.ts +1217 -0
- package/documentation/utils/node_modules/@types/node/trace_events.d.ts +197 -0
- package/documentation/utils/node_modules/@types/node/ts5.6/buffer.buffer.d.ts +385 -0
- package/documentation/utils/node_modules/@types/node/ts5.6/globals.typedarray.d.ts +19 -0
- package/documentation/utils/node_modules/@types/node/ts5.6/index.d.ts +91 -0
- package/documentation/utils/node_modules/@types/node/tty.d.ts +208 -0
- package/documentation/utils/node_modules/@types/node/url.d.ts +955 -0
- package/documentation/utils/node_modules/@types/node/util.d.ts +2306 -0
- package/documentation/utils/node_modules/@types/node/v8.d.ts +808 -0
- package/documentation/utils/node_modules/@types/node/vm.d.ts +922 -0
- package/documentation/utils/node_modules/@types/node/wasi.d.ts +181 -0
- package/documentation/utils/node_modules/@types/node/worker_threads.d.ts +694 -0
- package/documentation/utils/node_modules/@types/node/zlib.d.ts +539 -0
- package/documentation/utils/node_modules/undici-types/LICENSE +21 -0
- package/documentation/utils/node_modules/undici-types/README.md +6 -0
- package/documentation/utils/node_modules/undici-types/agent.d.ts +31 -0
- package/documentation/utils/node_modules/undici-types/api.d.ts +43 -0
- package/documentation/utils/node_modules/undici-types/balanced-pool.d.ts +29 -0
- package/documentation/utils/node_modules/undici-types/cache.d.ts +36 -0
- package/documentation/utils/node_modules/undici-types/client.d.ts +108 -0
- package/documentation/utils/node_modules/undici-types/connector.d.ts +34 -0
- package/documentation/utils/node_modules/undici-types/content-type.d.ts +21 -0
- package/documentation/utils/node_modules/undici-types/cookies.d.ts +28 -0
- package/documentation/utils/node_modules/undici-types/diagnostics-channel.d.ts +66 -0
- package/documentation/utils/node_modules/undici-types/dispatcher.d.ts +255 -0
- package/documentation/utils/node_modules/undici-types/env-http-proxy-agent.d.ts +21 -0
- package/documentation/utils/node_modules/undici-types/errors.d.ts +149 -0
- package/documentation/utils/node_modules/undici-types/eventsource.d.ts +63 -0
- package/documentation/utils/node_modules/undici-types/fetch.d.ts +209 -0
- package/documentation/utils/node_modules/undici-types/file.d.ts +39 -0
- package/documentation/utils/node_modules/undici-types/filereader.d.ts +54 -0
- package/documentation/utils/node_modules/undici-types/formdata.d.ts +108 -0
- package/documentation/utils/node_modules/undici-types/global-dispatcher.d.ts +9 -0
- package/documentation/utils/node_modules/undici-types/global-origin.d.ts +7 -0
- package/documentation/utils/node_modules/undici-types/handlers.d.ts +15 -0
- package/documentation/utils/node_modules/undici-types/header.d.ts +4 -0
- package/documentation/utils/node_modules/undici-types/index.d.ts +71 -0
- package/documentation/utils/node_modules/undici-types/interceptors.d.ts +15 -0
- package/documentation/utils/node_modules/undici-types/mock-agent.d.ts +50 -0
- package/documentation/utils/node_modules/undici-types/mock-client.d.ts +25 -0
- package/documentation/utils/node_modules/undici-types/mock-errors.d.ts +12 -0
- package/documentation/utils/node_modules/undici-types/mock-interceptor.d.ts +93 -0
- package/documentation/utils/node_modules/undici-types/mock-pool.d.ts +25 -0
- package/documentation/utils/node_modules/undici-types/package.json +55 -0
- package/documentation/utils/node_modules/undici-types/patch.d.ts +71 -0
- package/documentation/utils/node_modules/undici-types/pool-stats.d.ts +19 -0
- package/documentation/utils/node_modules/undici-types/pool.d.ts +39 -0
- package/documentation/utils/node_modules/undici-types/proxy-agent.d.ts +28 -0
- package/documentation/utils/node_modules/undici-types/readable.d.ts +60 -0
- package/documentation/utils/node_modules/undici-types/retry-agent.d.ts +8 -0
- package/documentation/utils/node_modules/undici-types/retry-handler.d.ts +116 -0
- package/documentation/utils/node_modules/undici-types/util.d.ts +18 -0
- package/documentation/utils/node_modules/undici-types/webidl.d.ts +222 -0
- package/documentation/utils/node_modules/undici-types/websocket.d.ts +152 -0
- package/documentation/utils/package-lock.json +75 -0
- package/documentation/utils/package.json +14 -0
- package/documentation/utils/serverTypes.ts +345 -0
- package/documentation/utils/tsconfig.json +28 -0
- package/examples/full-example-typescript/DBoGenerated.d.ts +2 -2
- package/examples/full-example-typescript/DBoGenerated.ts +2 -2
- package/examples/full-example-typescript/index.ts +39 -45
- package/examples/full-example-vanilla/index.js +51 -53
- package/examples/server/typescript/index.ts +24 -30
- package/lib/DboBuilder/TableHandler/DataValidator.ts +5 -5
- package/lib/DboBuilder/TableHandler/TableHandler.ts +1 -1
- package/lib/DboBuilder/TableHandler/insert.ts +3 -3
- package/lib/DboBuilder/TableHandler/update.ts +106 -48
- package/lib/DboBuilder/ViewHandler/ViewHandler.ts +2 -2
- package/lib/DboBuilder/parseUpdateRules.ts +1 -1
- package/lib/Logging.ts +7 -3
- package/lib/Prostgles.ts +209 -142
- package/lib/ProstglesTypes.ts +130 -51
- package/lib/SyncReplication.ts +2 -2
- package/lib/initProstgles.ts +145 -111
- package/lib/utils.ts +4 -5
- package/package.json +3 -2
- package/examples/server/typescript/index.d.ts +0 -2
- package/examples/server/typescript/index.d.ts.map +0 -1
- package/examples/server/typescript/index.js +0 -54
- package/examples/server/typescript/index.js.map +0 -1
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
## getInfo()
|
|
2
|
+
Retrieves the table/view info
|
|
3
|
+
```typescript
|
|
4
|
+
getInfo: (lang?: string): Promise<TableInfo>
|
|
5
|
+
```
|
|
6
|
+
#### Arguments
|
|
7
|
+
|
|
8
|
+
- **lang**: `string` - Language code for i18n data. ```typescript. "en". ```.
|
|
9
|
+
#### Return type
|
|
10
|
+
`TableInfo`
|
|
11
|
+
- **oid**: `number` - OID from the postgres database. Useful in handling renamed tables.
|
|
12
|
+
- **comment**: `string` - Comment from the postgres database.
|
|
13
|
+
- **isFileTable**: `{ allowedNestedInserts?: { table: string; column: string; }[] | undefined; }` - Defined if this is the fileTable.
|
|
14
|
+
- **allowedNestedInserts**: `{ table: string; column: string; }`
|
|
15
|
+
- **table**: `string`
|
|
16
|
+
- **column**: `string`
|
|
17
|
+
- **hasFiles**: `false` - True if fileTable is enabled and this table references the fileTable.
|
|
18
|
+
- **isView**: `false`
|
|
19
|
+
- **fileTableName**: `string` - Name of the fileTable (if enabled).
|
|
20
|
+
- **dynamicRules**: `{ update?: boolean | undefined; }` - See dynamicFields from Update rules.
|
|
21
|
+
- **update**: `false`
|
|
22
|
+
- **info**: `{ label?: string | undefined; }` - Additional table info provided through TableConfig.
|
|
23
|
+
- **label**: `string`
|
|
24
|
+
- **uniqueColumnGroups**: `string[][] | undefined` -
|
|
25
|
+
|
|
26
|
+
## getColumns()
|
|
27
|
+
Retrieves columns metadata of the table/view
|
|
28
|
+
```typescript
|
|
29
|
+
getColumns: (lang?: string, params?: GetColumnsParams): Promise<ValidatedColumnInfo[]>
|
|
30
|
+
```
|
|
31
|
+
#### Arguments
|
|
32
|
+
|
|
33
|
+
- **lang**: `string`
|
|
34
|
+
- **params**: `GetColumnsParams` - Dynamic/filter based rules allow limit what columns can be updated based on the request data/filter. This allows parameter allows identifying the columns that can be updated based on the request data.
|
|
35
|
+
- **rule**: `"update"`
|
|
36
|
+
- **data**: `AnyObject`
|
|
37
|
+
|
|
38
|
+
- **filter**: `AnyObject`
|
|
39
|
+
|
|
40
|
+
#### Return type
|
|
41
|
+
`ValidatedColumnInfo`
|
|
42
|
+
- **name**: `string`
|
|
43
|
+
- **label**: `string` - Column display name. Will be first non empty value from i18n data, comment, name.
|
|
44
|
+
- **comment**: `string` - Column description (if provided).
|
|
45
|
+
- **ordinal_position**: `number` - Ordinal position of the column within the table (count starts at 1).
|
|
46
|
+
- **is_nullable**: `boolean` -
|
|
47
|
+
- **is_updatable**: `boolean`
|
|
48
|
+
- **is_generated**: `boolean` - If the column is a generated column (converted to boolean from ALWAYS and NEVER).
|
|
49
|
+
- **data_type**: `string` - Simplified data type.
|
|
50
|
+
- **udt_name**: `PG_COLUMN_UDT_DATA_TYPE` - Postgres raw data types. values starting with underscore means it's an array of that data type.
|
|
51
|
+
- **element_type**: `string` - Element data type.
|
|
52
|
+
- **element_udt_name**: `string` - Element raw data type.
|
|
53
|
+
- **is_pkey**: `boolean` - PRIMARY KEY constraint on column. A table can have more then one PK.
|
|
54
|
+
- **references**: `{ ftable: string; fcols: string[]; cols: string[]; }`
|
|
55
|
+
- **ftable**: `string`
|
|
56
|
+
- **fcols**: `string`
|
|
57
|
+
- **cols**: `string`
|
|
58
|
+
- **has_default**: `boolean` - true if column has a default value. Used for excluding pkey from insert.
|
|
59
|
+
- **column_default**: `any` - Column default value.
|
|
60
|
+
- **min**: `string | number | undefined` - Extracted from tableConfig. Used in SmartForm.
|
|
61
|
+
- **max**: `string | number | undefined`
|
|
62
|
+
- **hint**: `string`
|
|
63
|
+
- **jsonbSchema**: `JSONBSchema`
|
|
64
|
+
- **nullable**: `any` - False by default.
|
|
65
|
+
- **description**: `any`
|
|
66
|
+
- **title**: `any`
|
|
67
|
+
- **type**: `any`
|
|
68
|
+
- **allowedValues**: `any`
|
|
69
|
+
- **oneOf**: `any`
|
|
70
|
+
- **oneOfType**: `any`
|
|
71
|
+
- **arrayOf**: `any`
|
|
72
|
+
- **arrayOfType**: `any`
|
|
73
|
+
- **enum**: `any`
|
|
74
|
+
- **record**: `any`
|
|
75
|
+
- **lookup**: `any`
|
|
76
|
+
- **defaultValue**: `any`
|
|
77
|
+
- **file**: `FileColumnConfig | undefined` - If degined then this column is referencing the file table. Extracted from FileTable config. Used in SmartForm.
|
|
78
|
+
- **tsDataType**: `"string" | "number" | "boolean" | "any" | "number[]" | "boolean[]" | "string[]" | "any[]"` - TypeScript data type.
|
|
79
|
+
- **select**: `boolean` - Can be viewed/selected.
|
|
80
|
+
- **orderBy**: `boolean` - Can be ordered by.
|
|
81
|
+
- **filter**: `boolean` - Can be filtered by.
|
|
82
|
+
- **insert**: `boolean` - Can be inserted.
|
|
83
|
+
- **update**: `boolean` - Can be updated.
|
|
84
|
+
- **delete**: `boolean` - Can be used in the delete filter.
|
|
85
|
+
|
|
86
|
+
## find()
|
|
87
|
+
Retrieves a list of matching records from the view/table
|
|
88
|
+
```typescript
|
|
89
|
+
find: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): Promise<GetSelectReturnType<S, P, T, true>>
|
|
90
|
+
```
|
|
91
|
+
#### Arguments
|
|
92
|
+
|
|
93
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
94
|
+
- **selectParams**: `SelectParams`
|
|
95
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
96
|
+
- **offset**: `number` - Number of rows to skip.
|
|
97
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
98
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
99
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
100
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
101
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
102
|
+
#### Return type
|
|
103
|
+
`GetSelectReturnType`
|
|
104
|
+
|
|
105
|
+
## findOne()
|
|
106
|
+
Retrieves a record from the view/table
|
|
107
|
+
```typescript
|
|
108
|
+
findOne: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): Promise<GetSelectReturnType<S, P, T, false> | undefined>
|
|
109
|
+
```
|
|
110
|
+
#### Arguments
|
|
111
|
+
|
|
112
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
113
|
+
- **selectParams**: `SelectParams`
|
|
114
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
115
|
+
- **offset**: `number` - Number of rows to skip.
|
|
116
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
117
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
118
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
119
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
120
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
121
|
+
#### Return type
|
|
122
|
+
`GetSelectReturnType<S, P, T, false> | undefined`
|
|
123
|
+
|
|
124
|
+
## subscribe()
|
|
125
|
+
Retrieves a list of matching records from the view/table and subscribes to changes
|
|
126
|
+
```typescript
|
|
127
|
+
subscribe: (filter: FullFilter, params: SelectParams, onData: (items: GetSelectReturnType<S, P, T, true>) => any, onError?: OnError): Promise<SubscriptionHandler>
|
|
128
|
+
```
|
|
129
|
+
#### Arguments
|
|
130
|
+
|
|
131
|
+
- **filter**: `FullFilter` - Group or simple filter.
|
|
132
|
+
- **params**: `SelectParams`
|
|
133
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
134
|
+
- **offset**: `number` - Number of rows to skip.
|
|
135
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
136
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
137
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
138
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
139
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
140
|
+
- **onData**: `(items: GetSelectReturnType<S, P, T, true>) => any`
|
|
141
|
+
- **onError**: `OnError`
|
|
142
|
+
#### Return type
|
|
143
|
+
`SubscriptionHandler`
|
|
144
|
+
- **unsubscribe**: `() => Promise<any>`
|
|
145
|
+
- **filter**: `{} | FullFilter<void, void>`
|
|
146
|
+
|
|
147
|
+
## subscribeOne()
|
|
148
|
+
Retrieves first matching record from the view/table and subscribes to changes
|
|
149
|
+
```typescript
|
|
150
|
+
subscribeOne: (filter: FullFilter, params: SelectParams, onData: (item: GetSelectReturnType<S, P, T, false> | undefined) => any, onError?: OnError): Promise<SubscriptionHandler>
|
|
151
|
+
```
|
|
152
|
+
#### Arguments
|
|
153
|
+
|
|
154
|
+
- **filter**: `FullFilter` - Group or simple filter.
|
|
155
|
+
- **params**: `SelectParams`
|
|
156
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
157
|
+
- **offset**: `number` - Number of rows to skip.
|
|
158
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
159
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
160
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
161
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
162
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
163
|
+
- **onData**: `(item: GetSelectReturnType<S, P, T, false> | undefined) => any`
|
|
164
|
+
- **onError**: `OnError`
|
|
165
|
+
#### Return type
|
|
166
|
+
`SubscriptionHandler`
|
|
167
|
+
- **unsubscribe**: `() => Promise<any>`
|
|
168
|
+
- **filter**: `{} | FullFilter<void, void>`
|
|
169
|
+
|
|
170
|
+
## count()
|
|
171
|
+
Returns the number of rows that match the filter
|
|
172
|
+
```typescript
|
|
173
|
+
count: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): Promise<number>
|
|
174
|
+
```
|
|
175
|
+
#### Arguments
|
|
176
|
+
|
|
177
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
178
|
+
- **selectParams**: `SelectParams`
|
|
179
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
180
|
+
- **offset**: `number` - Number of rows to skip.
|
|
181
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
182
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
183
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
184
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
185
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
186
|
+
#### Return type
|
|
187
|
+
`number`
|
|
188
|
+
|
|
189
|
+
## size()
|
|
190
|
+
Returns result size in bits
|
|
191
|
+
```typescript
|
|
192
|
+
size: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): Promise<string>
|
|
193
|
+
```
|
|
194
|
+
#### Arguments
|
|
195
|
+
|
|
196
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
197
|
+
- **selectParams**: `SelectParams`
|
|
198
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
199
|
+
- **offset**: `number` - Number of rows to skip.
|
|
200
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
201
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
202
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
203
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
204
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
205
|
+
#### Return type
|
|
206
|
+
`string`
|
|
207
|
+
|
|
208
|
+
## getJoinedTables()
|
|
209
|
+
|
|
210
|
+
```typescript
|
|
211
|
+
getJoinedTables: (): string[]
|
|
212
|
+
```
|
|
213
|
+
#### Arguments
|
|
214
|
+
|
|
215
|
+
#### Return type
|
|
216
|
+
`string`
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
|
|
222
|
+
## sync()
|
|
223
|
+
|
|
224
|
+
```typescript
|
|
225
|
+
sync: (basicFilter: EqualityFilter, options: SyncOptions, onChange: (data: SyncDataItem<Required<T>, false>[], delta?: Partial<T>[] | undefined) => any, onError?: (error: any) => void): Promise<{ $unsync: () => void; $upsert: (newData: T[]) => any; getItems: () => T[]; }>
|
|
226
|
+
```
|
|
227
|
+
#### Arguments
|
|
228
|
+
|
|
229
|
+
- **basicFilter**: `EqualityFilter` - Equality filter used for sync. Multiple columns are combined with AND.
|
|
230
|
+
|
|
231
|
+
- **options**: `SyncOptions`
|
|
232
|
+
- **onChange**: `(data: SyncDataItem<Required<T>, false>[], delta?: Partial<T>[] | undefined) => any`
|
|
233
|
+
- **onError**: `(error: any) => void`
|
|
234
|
+
#### Return type
|
|
235
|
+
`{ $unsync: () => void; $upsert: (newData: T[]) => any; getItems: () => T[]; }`
|
|
236
|
+
- **$unsync**: `() => void`
|
|
237
|
+
- **$upsert**: `(newData: T[]) => any`
|
|
238
|
+
- **getItems**: `() => T[]`
|
|
239
|
+
|
|
240
|
+
## useSync()
|
|
241
|
+
Retrieves rows matching the filter and keeps them in sync
|
|
242
|
+
- use { handlesOnData: true } to get optimistic updates method: $update
|
|
243
|
+
- any changes to the row using the $update method will be reflected instantly
|
|
244
|
+
to all sync subscribers that were initiated with the same syncOptions
|
|
245
|
+
```typescript
|
|
246
|
+
useSync: (basicFilter: EqualityFilter, syncOptions: SyncOptions): { data: SyncDataItem<Required<T>>[] | undefined; isLoading: boolean; error?: any; }
|
|
247
|
+
```
|
|
248
|
+
#### Arguments
|
|
249
|
+
|
|
250
|
+
- **basicFilter**: `EqualityFilter` - Equality filter used for sync. Multiple columns are combined with AND.
|
|
251
|
+
|
|
252
|
+
- **syncOptions**: `SyncOptions`
|
|
253
|
+
#### Return type
|
|
254
|
+
`{ data: SyncDataItem<Required<T>>[] | undefined; isLoading: boolean; error?: any; }`
|
|
255
|
+
- **data**: `SyncDataItem<Required<T>>[] | undefined`
|
|
256
|
+
- **isLoading**: `boolean`
|
|
257
|
+
- **error**: `any`
|
|
258
|
+
|
|
259
|
+
## syncOne()
|
|
260
|
+
|
|
261
|
+
```typescript
|
|
262
|
+
syncOne: (basicFilter: Partial, options: SyncOneOptions, onChange: (data: SyncDataItem<Required<T>, false>, delta?: Partial<T> | undefined) => any, onError?: (error: any) => void): Promise<SingleSyncHandles<T, false>>
|
|
263
|
+
```
|
|
264
|
+
#### Arguments
|
|
265
|
+
|
|
266
|
+
- **basicFilter**: `Partial` - Make all properties in T optional.
|
|
267
|
+
|
|
268
|
+
- **options**: `SyncOneOptions`
|
|
269
|
+
- **onChange**: `(data: SyncDataItem<Required<T>, false>, delta?: Partial<T> | undefined) => any`
|
|
270
|
+
- **onError**: `(error: any) => void`
|
|
271
|
+
#### Return type
|
|
272
|
+
`SingleSyncHandles` - CRUD handles added if initialised with handlesOnData = true.
|
|
273
|
+
- **$get**: `() => T | undefined`
|
|
274
|
+
- **$find**: `(idObj: Partial<T>) => T | undefined`
|
|
275
|
+
- **$unsync**: `() => any`
|
|
276
|
+
- **$delete**: `() => void`
|
|
277
|
+
- **$update**: `<OPTS extends $UpdateOpts>(newData: OPTS extends { deepMerge: true; } ? DeepPartial<T> : Partial<T>, opts?: OPTS | undefined) => any`
|
|
278
|
+
- **$cloneSync**: `CloneSync`
|
|
279
|
+
- **$cloneMultiSync**: `CloneMultiSync`
|
|
280
|
+
|
|
281
|
+
## useSyncOne()
|
|
282
|
+
Retrieves the first row matching the filter and keeps it in sync
|
|
283
|
+
- use { handlesOnData: true } to get optimistic updates method: $update
|
|
284
|
+
- any changes to the row using the $update method will be reflected instantly
|
|
285
|
+
to all sync subscribers that were initiated with the same syncOptions
|
|
286
|
+
```typescript
|
|
287
|
+
useSyncOne: (basicFilter: EqualityFilter, syncOptions: SyncOneOptions): { data: SyncDataItem<Required<T>> | undefined; isLoading: boolean; error?: any; }
|
|
288
|
+
```
|
|
289
|
+
#### Arguments
|
|
290
|
+
|
|
291
|
+
- **basicFilter**: `EqualityFilter` - Equality filter used for sync. Multiple columns are combined with AND.
|
|
292
|
+
|
|
293
|
+
- **syncOptions**: `SyncOneOptions`
|
|
294
|
+
#### Return type
|
|
295
|
+
`{ data: SyncDataItem<Required<T>> | undefined; isLoading: boolean; error?: any; }`
|
|
296
|
+
- **data**: `SyncDataItem<Required<T>> | undefined`
|
|
297
|
+
- **isLoading**: `boolean`
|
|
298
|
+
- **error**: `any`
|
|
299
|
+
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
## useSubscribe()
|
|
303
|
+
Retrieves a list of matching records from the view/table and subscribes to changes
|
|
304
|
+
```typescript
|
|
305
|
+
useSubscribe: (filter?: FullFilter<T, S> | undefined, options?: SubscribeParams): { data: GetSelectReturnType<S, SubParams, T, true> | undefined; error?: any; isLoading: boolean; }
|
|
306
|
+
```
|
|
307
|
+
#### Arguments
|
|
308
|
+
|
|
309
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
310
|
+
- **options**: `SubscribeParams`
|
|
311
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
312
|
+
- **offset**: `number` - Number of rows to skip.
|
|
313
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
314
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
315
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
316
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
317
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
318
|
+
- **throttle**: `number` - If true then the subscription will be throttled to the provided number of milliseconds.
|
|
319
|
+
- **throttleOpts**: `{ skipFirst?: boolean | undefined; }`
|
|
320
|
+
- **skipFirst**: `false` - If true then the first value will be emitted at the end of the interval. Instant otherwise.
|
|
321
|
+
#### Return type
|
|
322
|
+
`{ data: GetSelectReturnType<S, SubParams, T, true> | undefined; error?: any; isLoading: boolean; }`
|
|
323
|
+
- **data**: `GetSelectReturnType<S, SubParams, T, true> | undefined`
|
|
324
|
+
- **error**: `any`
|
|
325
|
+
- **isLoading**: `boolean`
|
|
326
|
+
|
|
327
|
+
## useSubscribeOne()
|
|
328
|
+
Retrieves a matching record from the view/table and subscribes to changes
|
|
329
|
+
```typescript
|
|
330
|
+
useSubscribeOne: (filter?: FullFilter<T, S> | undefined, options?: SubscribeParams): { data: GetSelectReturnType<S, SubParams, T, false> | undefined; error?: any; isLoading: boolean; }
|
|
331
|
+
```
|
|
332
|
+
#### Arguments
|
|
333
|
+
|
|
334
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
335
|
+
- **options**: `SubscribeParams`
|
|
336
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
337
|
+
- **offset**: `number` - Number of rows to skip.
|
|
338
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
339
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
340
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
341
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
342
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
343
|
+
- **throttle**: `number` - If true then the subscription will be throttled to the provided number of milliseconds.
|
|
344
|
+
- **throttleOpts**: `{ skipFirst?: boolean | undefined; }`
|
|
345
|
+
- **skipFirst**: `false` - If true then the first value will be emitted at the end of the interval. Instant otherwise.
|
|
346
|
+
#### Return type
|
|
347
|
+
`{ data: GetSelectReturnType<S, SubParams, T, false> | undefined; error?: any; isLoading: boolean; }`
|
|
348
|
+
- **data**: `GetSelectReturnType<S, SubParams, T, false> | undefined`
|
|
349
|
+
- **error**: `any`
|
|
350
|
+
- **isLoading**: `boolean`
|
|
351
|
+
|
|
352
|
+
## useFind()
|
|
353
|
+
Retrieves a list of matching records from the view/table
|
|
354
|
+
```typescript
|
|
355
|
+
useFind: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): { data: GetSelectReturnType<S, P, T, true> | undefined; isLoading: boolean; error?: any; }
|
|
356
|
+
```
|
|
357
|
+
#### Arguments
|
|
358
|
+
|
|
359
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
360
|
+
- **selectParams**: `SelectParams`
|
|
361
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
362
|
+
- **offset**: `number` - Number of rows to skip.
|
|
363
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
364
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
365
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
366
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
367
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
368
|
+
#### Return type
|
|
369
|
+
`{ data: GetSelectReturnType<S, P, T, true> | undefined; isLoading: boolean; error?: any; }`
|
|
370
|
+
- **data**: `GetSelectReturnType<S, P, T, true> | undefined`
|
|
371
|
+
- **isLoading**: `boolean`
|
|
372
|
+
- **error**: `any`
|
|
373
|
+
|
|
374
|
+
## useFindOne()
|
|
375
|
+
Retrieves first matching record from the view/table
|
|
376
|
+
```typescript
|
|
377
|
+
useFindOne: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): { data: GetSelectReturnType<S, P, T, false> | undefined; isLoading: boolean; error?: any; }
|
|
378
|
+
```
|
|
379
|
+
#### Arguments
|
|
380
|
+
|
|
381
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
382
|
+
- **selectParams**: `SelectParams`
|
|
383
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
384
|
+
- **offset**: `number` - Number of rows to skip.
|
|
385
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
386
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
387
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
388
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
389
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
390
|
+
#### Return type
|
|
391
|
+
`{ data: GetSelectReturnType<S, P, T, false> | undefined; isLoading: boolean; error?: any; }`
|
|
392
|
+
- **data**: `GetSelectReturnType<S, P, T, false> | undefined`
|
|
393
|
+
- **isLoading**: `boolean`
|
|
394
|
+
- **error**: `any`
|
|
395
|
+
|
|
396
|
+
## useCount()
|
|
397
|
+
Returns the total number of rows matching the filter
|
|
398
|
+
```typescript
|
|
399
|
+
useCount: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): { data: number | undefined; isLoading: boolean; error?: any; }
|
|
400
|
+
```
|
|
401
|
+
#### Arguments
|
|
402
|
+
|
|
403
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
404
|
+
- **selectParams**: `SelectParams`
|
|
405
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
406
|
+
- **offset**: `number` - Number of rows to skip.
|
|
407
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
408
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
409
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
410
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
411
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
412
|
+
#### Return type
|
|
413
|
+
`{ data: number | undefined; isLoading: boolean; error?: any; }`
|
|
414
|
+
- **data**: `number | undefined`
|
|
415
|
+
- **isLoading**: `boolean`
|
|
416
|
+
- **error**: `any`
|
|
417
|
+
|
|
418
|
+
## useSize()
|
|
419
|
+
Returns result size in bits matching the filter and selectParams
|
|
420
|
+
```typescript
|
|
421
|
+
useSize: (filter?: FullFilter<T, S> | undefined, selectParams?: SelectParams): { data: string | undefined; isLoading: boolean; error?: any; }
|
|
422
|
+
```
|
|
423
|
+
#### Arguments
|
|
424
|
+
|
|
425
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
426
|
+
- **selectParams**: `SelectParams`
|
|
427
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
428
|
+
- **offset**: `number` - Number of rows to skip.
|
|
429
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
430
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
431
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
432
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
433
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
434
|
+
#### Return type
|
|
435
|
+
`{ data: string | undefined; isLoading: boolean; error?: any; }`
|
|
436
|
+
- **data**: `string | undefined`
|
|
437
|
+
- **isLoading**: `boolean`
|
|
438
|
+
- **error**: `any`
|
|
439
|
+
|
|
440
|
+
## update()
|
|
441
|
+
Updates a record in the table based on the specified filter criteria
|
|
442
|
+
- Use { multi: false } to ensure no more than one row is updated
|
|
443
|
+
```typescript
|
|
444
|
+
update: (filter: FullFilter, newData: Partial, params?: SelectParams): Promise<GetUpdateReturnType<P, T, S> | undefined>
|
|
445
|
+
```
|
|
446
|
+
#### Arguments
|
|
447
|
+
|
|
448
|
+
- **filter**: `FullFilter` - Group or simple filter.
|
|
449
|
+
- **newData**: `Partial` - Make all properties in T optional.
|
|
450
|
+
|
|
451
|
+
- **params**: `SelectParams`
|
|
452
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
453
|
+
- **offset**: `number` - Number of rows to skip.
|
|
454
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
455
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
456
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
457
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
458
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
459
|
+
#### Return type
|
|
460
|
+
`GetUpdateReturnType<P, T, S> | undefined`
|
|
461
|
+
|
|
462
|
+
## updateBatch()
|
|
463
|
+
Updates multiple records in the table in a batch operation.
|
|
464
|
+
- Each item in the `data` array contains a filter and the corresponding data to update.
|
|
465
|
+
```typescript
|
|
466
|
+
updateBatch: (data: [FullFilter<T, S>, Partial<UpsertDataToPGCast<T>>][], params?: SelectParams): Promise<void | GetUpdateReturnType<P, T, S>>
|
|
467
|
+
```
|
|
468
|
+
#### Arguments
|
|
469
|
+
|
|
470
|
+
- **data**: `[FullFilter<T, S>, Partial<UpsertDataToPGCast<T>>][]`
|
|
471
|
+
- **params**: `SelectParams`
|
|
472
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
473
|
+
- **offset**: `number` - Number of rows to skip.
|
|
474
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
475
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
476
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
477
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
478
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
479
|
+
#### Return type
|
|
480
|
+
`void | GetUpdateReturnType<P, T, S>`
|
|
481
|
+
|
|
482
|
+
## insert()
|
|
483
|
+
Inserts a new record into the table.
|
|
484
|
+
```typescript
|
|
485
|
+
insert: (data: UpsertDataToPGCast | UpsertDataToPGCast<T>[], params?: SelectParams): Promise<GetInsertReturnType<D, P, T, S>>
|
|
486
|
+
```
|
|
487
|
+
#### Arguments
|
|
488
|
+
|
|
489
|
+
- **data**: `InsertData`
|
|
490
|
+
- **params**: `SelectParams`
|
|
491
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
492
|
+
- **offset**: `number` - Number of rows to skip.
|
|
493
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
494
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
495
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
496
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
497
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
498
|
+
#### Return type
|
|
499
|
+
`GetInsertReturnType`
|
|
500
|
+
|
|
501
|
+
## upsert()
|
|
502
|
+
Inserts or updates a record in the table.
|
|
503
|
+
- If a record matching the `filter` exists, it updates the record.
|
|
504
|
+
- If no matching record exists, it inserts a new record.
|
|
505
|
+
```typescript
|
|
506
|
+
upsert: (filter: FullFilter, newData: Partial, params?: SelectParams): Promise<GetUpdateReturnType<P, T, S> | undefined>
|
|
507
|
+
```
|
|
508
|
+
#### Arguments
|
|
509
|
+
|
|
510
|
+
- **filter**: `FullFilter` - Group or simple filter.
|
|
511
|
+
- **newData**: `Partial` - Make all properties in T optional.
|
|
512
|
+
|
|
513
|
+
- **params**: `SelectParams`
|
|
514
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
515
|
+
- **offset**: `number` - Number of rows to skip.
|
|
516
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
517
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
518
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
519
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
520
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
521
|
+
#### Return type
|
|
522
|
+
`GetUpdateReturnType<P, T, S> | undefined`
|
|
523
|
+
|
|
524
|
+
## delete()
|
|
525
|
+
Deletes records from the table based on the specified filter criteria.
|
|
526
|
+
- If no filter is provided, all records may be deleted (use with caution).
|
|
527
|
+
```typescript
|
|
528
|
+
delete: (filter?: FullFilter<T, S> | undefined, params?: SelectParams): Promise<GetUpdateReturnType<P, T, S> | undefined>
|
|
529
|
+
```
|
|
530
|
+
#### Arguments
|
|
531
|
+
|
|
532
|
+
- **filter**: `FullFilter<T, S> | undefined`
|
|
533
|
+
- **params**: `SelectParams`
|
|
534
|
+
- **limit**: `number | null | undefined` - Max number of rows to return. - If undefined then 1000 will be applied as the default. - On client publish rules can affect this behaviour: cannot request more than the maxLimit (if present).
|
|
535
|
+
- **offset**: `number` - Number of rows to skip.
|
|
536
|
+
- **groupBy**: `false` - Will group by all non aggregated fields specified in select (or all fields by default).
|
|
537
|
+
- **returnType**: `"row" | "value" | "values" | "statement" | "statement-no-rls" | "statement-where" | undefined` - Result data structure/type:. - row: the first row as an object. - value: the first value from of first field. - values: array of values from the selected field. - statement: sql statement. - statement-no-rls: sql statement without row level security. - statement-where: sql statement where condition.
|
|
538
|
+
- **select**: `Select` - Fields/expressions/linked data to select. - If empty then all fields will be selected. - If "*" then all fields will be selected. - If { field: 0 } then all fields except the specified field will be selected. - If { field: 1 } then only the specified field will be selected. - If { field: { funcName: [args] } } then the field will be selected with the specified function applied. - If { field: { nestedTable: { field: 1 } } } then the field will be selected with the nested table fields.
|
|
539
|
+
- **orderBy**: `OrderBy` - Order by options. - If array then the order will be maintained.
|
|
540
|
+
- **having**: `FullFilter<T, S> | undefined` - Filter applied after any aggregations (group by).
|
|
541
|
+
#### Return type
|
|
542
|
+
`GetUpdateReturnType<P, T, S> | undefined`
|