skapi-js 0.0.50 → 0.0.52
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/package.json +1 -1
- package/src/Types.ts +6 -6
- package/src/skapi.ts +9 -4
package/package.json
CHANGED
package/src/Types.ts
CHANGED
|
@@ -154,7 +154,8 @@ export type GetRecordParams = {
|
|
|
154
154
|
/** @ignore */
|
|
155
155
|
service?: string;
|
|
156
156
|
/** Table name */
|
|
157
|
-
|
|
157
|
+
record_id?:string;
|
|
158
|
+
table?: string;
|
|
158
159
|
/**
|
|
159
160
|
* Query for records that are accessable in certain user groups.
|
|
160
161
|
* User cannot request access that are higher than the accounts user group.
|
|
@@ -174,18 +175,17 @@ export type GetRecordParams = {
|
|
|
174
175
|
*/
|
|
175
176
|
group: number;
|
|
176
177
|
},
|
|
177
|
-
index
|
|
178
|
+
index?: {
|
|
178
179
|
/**
|
|
179
180
|
* Index name. Queries list of nested index key if index name ends with period.<br>
|
|
180
181
|
* As example below, you can query all movies under the index name director.spielberg...<br>
|
|
181
182
|
* ex) director.spielberg.<br>
|
|
182
|
-
* Reserved index names are: '$
|
|
183
|
+
* Reserved index names are: '$updated' | '$uploaded' | '$referenced_count'
|
|
183
184
|
* */
|
|
184
|
-
name: string | '$
|
|
185
|
+
name: string | '$updated' | '$uploaded' | '$referenced_count';
|
|
185
186
|
/**
|
|
186
187
|
* Index value to search based on the index name.<br>
|
|
187
|
-
* If the index name is a index key name search value type must be string
|
|
188
|
-
* For reserved index names '$record_id' is an record id string, otherwise is type number.
|
|
188
|
+
* If the index name is a index key name search value type must be string.
|
|
189
189
|
*/
|
|
190
190
|
value: string | number | boolean;
|
|
191
191
|
/** Search condition. Defaults to '='.*/
|
package/src/skapi.ts
CHANGED
|
@@ -1558,7 +1558,6 @@ export default class Skapi {
|
|
|
1558
1558
|
*/
|
|
1559
1559
|
async getRecords(params: GetRecordParams, fetchOptions?: FetchOptions): Promise<FetchResponse> {
|
|
1560
1560
|
const indexTypes = {
|
|
1561
|
-
'$record_id': 'string',
|
|
1562
1561
|
'$updated': 'number',
|
|
1563
1562
|
'$uploaded': 'number',
|
|
1564
1563
|
'$referenced_count': 'number'
|
|
@@ -1637,10 +1636,16 @@ export default class Skapi {
|
|
|
1637
1636
|
tag: 'string'
|
|
1638
1637
|
};
|
|
1639
1638
|
|
|
1640
|
-
|
|
1639
|
+
if (params.record_id) {
|
|
1640
|
+
checkWhiteSpaceAndSpecialChars(params.record_id, 'record_id', false, false);
|
|
1641
|
+
params = { record_id: params.record_id };
|
|
1642
|
+
}
|
|
1641
1643
|
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
+
else {
|
|
1645
|
+
params = checkParams(params || {}, struct, ['table']);
|
|
1646
|
+
if (params?.subscription && !this.session) {
|
|
1647
|
+
throw new SkapiError('Requires login.', { code: 'INVALID_REQUEST' });
|
|
1648
|
+
}
|
|
1644
1649
|
}
|
|
1645
1650
|
|
|
1646
1651
|
let result = await this.request(
|