@airtable/blocks 1.10.2-experimental-640bd10-20220211 → 1.11.1
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/CHANGELOG.md +12 -1
- package/dist/cjs/error_utils.js +9 -34
- package/dist/cjs/models/base.js +15 -0
- package/dist/cjs/models/field.js +99 -4
- package/dist/cjs/models/grouped_record_query_result.js +14 -5
- package/dist/cjs/models/linked_records_query_result.js +44 -86
- package/dist/cjs/models/mutations.js +234 -53
- package/dist/cjs/models/record.js +55 -310
- package/dist/cjs/models/record_query_result.js +1 -4
- package/dist/cjs/models/record_store.js +779 -557
- package/dist/cjs/models/table.js +6 -6
- package/dist/cjs/models/table_or_view_query_result.js +419 -526
- package/dist/cjs/models/view_data_store.js +295 -255
- package/dist/cjs/private_utils.js +0 -40
- package/dist/cjs/sdk.js +2 -12
- package/dist/cjs/testing/abstract_mock_airtable_interface.js +11 -57
- package/dist/cjs/types/airtable_interface.js +2 -17
- package/dist/cjs/types/mutations.js +1 -0
- package/dist/cjs/ui/use_records.js +1 -5
- package/dist/cjs/unstable_testing_utils.js +1 -55
- package/dist/cjs/watchable.js +1 -15
- package/dist/types/src/error_utils.d.ts +4 -2
- package/dist/types/src/error_utils.d.ts.map +1 -1
- package/dist/types/src/models/base.d.ts +10 -0
- package/dist/types/src/models/base.d.ts.map +1 -1
- package/dist/types/src/models/field.d.ts +58 -0
- package/dist/types/src/models/field.d.ts.map +1 -1
- package/dist/types/src/models/grouped_record_query_result.d.ts +3 -3
- package/dist/types/src/models/grouped_record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
- package/dist/types/src/models/mutations.d.ts.map +1 -1
- package/dist/types/src/models/record.d.ts +3 -12
- package/dist/types/src/models/record.d.ts.map +1 -1
- package/dist/types/src/models/record_query_result.d.ts +2 -3
- package/dist/types/src/models/record_query_result.d.ts.map +1 -1
- package/dist/types/src/models/record_store.d.ts.map +1 -1
- package/dist/types/src/models/table_or_view_query_result.d.ts +5 -3
- package/dist/types/src/models/table_or_view_query_result.d.ts.map +1 -1
- package/dist/types/src/models/view_data_store.d.ts +1 -0
- package/dist/types/src/models/view_data_store.d.ts.map +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts +1 -1
- package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
- package/dist/types/src/private_utils.d.ts +1 -24
- package/dist/types/src/private_utils.d.ts.map +1 -1
- package/dist/types/src/sdk.d.ts.map +1 -1
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts +11 -11
- package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/airtable_interface.d.ts +20 -59
- package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
- package/dist/types/src/types/base.d.ts +1 -0
- package/dist/types/src/types/base.d.ts.map +1 -1
- package/dist/types/src/types/mutations.d.ts +25 -2
- package/dist/types/src/types/mutations.d.ts.map +1 -1
- package/dist/types/src/types/table.d.ts +2 -0
- package/dist/types/src/types/table.d.ts.map +1 -1
- package/dist/types/src/types/view.d.ts +8 -3
- package/dist/types/src/types/view.d.ts.map +1 -1
- package/dist/types/src/ui/record_card.d.ts +1 -1
- package/dist/types/src/unstable_testing_utils.d.ts +1 -4
- package/dist/types/src/unstable_testing_utils.d.ts.map +1 -1
- package/dist/types/src/watchable.d.ts.map +1 -1
- package/dist/types/{src/testing → test/airtable_interface_mocks}/fixture_data.d.ts +19 -42
- package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts.map +1 -0
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts +1 -1
- package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +12 -19
- package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +1 -1
- package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +1 -1
- package/dist/types/test/test_helpers.d.ts +0 -2
- package/dist/types/test/test_helpers.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/cjs/models/query_manager.js +0 -328
- package/dist/cjs/testing/fixture_data.js +0 -268
- package/dist/cjs/testing/mock_base_data_stores.js +0 -876
- package/dist/cjs/types/block_query_spec.js +0 -85
- package/dist/types/src/models/query_manager.d.ts +0 -2
- package/dist/types/src/models/query_manager.d.ts.map +0 -1
- package/dist/types/src/testing/fixture_data.d.ts.map +0 -1
- package/dist/types/src/testing/mock_base_data_stores.d.ts +0 -55
- package/dist/types/src/testing/mock_base_data_stores.d.ts.map +0 -1
- package/dist/types/src/types/block_query_spec.d.ts +0 -139
- package/dist/types/src/types/block_query_spec.d.ts.map +0 -1
- package/dist/types/test/testing/fixture_data.test.d.ts +0 -2
- package/dist/types/test/testing/fixture_data.test.d.ts.map +0 -1
|
@@ -97,6 +97,6 @@ export declare class RecordCard extends React.Component<RecordCardProps> {
|
|
|
97
97
|
/** @hidden */
|
|
98
98
|
render(): JSX.Element | null;
|
|
99
99
|
}
|
|
100
|
-
declare const _default: React.RefForwardingComponent<RecordCard, Pick<RecordCardProps, "left" | "right" | "top" | "bottom" | "style" | "view" | "flex" | "alignSelf" | "flexBasis" | "flexGrow" | "flexShrink" | "height" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "order" | "position" | "width" | "zIndex" | "margin" | "
|
|
100
|
+
declare const _default: React.RefForwardingComponent<RecordCard, Pick<RecordCardProps, "left" | "right" | "top" | "bottom" | "style" | "view" | "flex" | "alignSelf" | "flexBasis" | "flexGrow" | "flexShrink" | "height" | "justifySelf" | "marginBottom" | "marginLeft" | "marginRight" | "marginTop" | "order" | "position" | "width" | "zIndex" | "margin" | "record" | "fields" | "className" | "onClick" | "onMouseEnter" | "onMouseLeave" | "marginX" | "marginY" | "hasOnClick" | "renderInvalidCellValue" | "attachmentCoverField" | "expandRecordOptions"> & React.RefAttributes<RecordCard>>;
|
|
101
101
|
export default _default;
|
|
102
102
|
//# sourceMappingURL=record_card.d.ts.map
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export { BaseData, ModelChange } from './types/base';
|
|
2
2
|
export { Mutation, MutationTypes } from './types/mutations';
|
|
3
|
-
export { AppInterface, BlockRunContextType, SdkInitData, PartialViewData,
|
|
4
|
-
export { BlockQuerySpec, BlockQueryId, QuerySpecsResponse, BlockQuerySubscriptionOnChangeCallback, } from './types/block_query_spec';
|
|
3
|
+
export { AppInterface, BlockRunContextType, SdkInitData, PartialViewData, } from './types/airtable_interface';
|
|
5
4
|
export { RecordData } from './types/record';
|
|
6
5
|
export { CursorData } from './types/cursor';
|
|
7
6
|
export { FieldData, FieldType } from './types/field';
|
|
@@ -11,6 +10,4 @@ export { GlobalConfigUpdate, GlobalConfigData, GlobalConfigArray, GlobalConfigOb
|
|
|
11
10
|
export { RequestJson, ResponseJson } from './types/backend_fetch_types';
|
|
12
11
|
export { default as Sdk } from './sdk';
|
|
13
12
|
export { AbstractMockAirtableInterface } from './testing/abstract_mock_airtable_interface';
|
|
14
|
-
export { FixtureData, convertFixtureDataToSdkInitData } from './testing/fixture_data';
|
|
15
|
-
export { MockBaseDataStore } from './testing/mock_base_data_stores';
|
|
16
13
|
//# sourceMappingURL=unstable_testing_utils.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unstable_testing_utils.d.ts","sourceRoot":"","sources":["../../../src/unstable_testing_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,eAAe,
|
|
1
|
+
{"version":3,"file":"unstable_testing_utils.d.ts","sourceRoot":"","sources":["../../../src/unstable_testing_utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAE,WAAW,EAAC,MAAM,cAAc,CAAC;AAEnD,OAAO,EAAC,QAAQ,EAAE,aAAa,EAAC,MAAM,mBAAmB,CAAC;AAE1D,OAAO,EACH,YAAY,EACZ,mBAAmB,EACnB,WAAW,EACX,eAAe,GAClB,MAAM,4BAA4B,CAAC;AAEpC,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAC,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAE1C,OAAO,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,eAAe,CAAC;AAEnD,OAAO,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAC,sBAAsB,EAAC,MAAM,kBAAkB,CAAC;AAExD,OAAO,EACH,kBAAkB,EAClB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,GACrB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAEtE,OAAO,EAAC,OAAO,IAAI,GAAG,EAAC,MAAM,OAAO,CAAC;AACrC,OAAO,EAAC,6BAA6B,EAAC,MAAM,4CAA4C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watchable.d.ts","sourceRoot":"","sources":["../../../src/watchable.ts"],"names":[],"mappings":"AAAA,uDAAuD,CAAC,MAAM;AAC9D,OAAO,EAAyC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGtF;;;;;;;GAOG;AACH,cAAM,SAAS,CAAC,YAAY,SAAS,MAAM;
|
|
1
|
+
{"version":3,"file":"watchable.d.ts","sourceRoot":"","sources":["../../../src/watchable.ts"],"names":[],"mappings":"AAAA,uDAAuD,CAAC,MAAM;AAC9D,OAAO,EAAyC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAGtF;;;;;;;GAOG;AACH,cAAM,SAAS,CAAC,YAAY,SAAS,MAAM;IAuEvC;;;;;;;;;;OAUG;IACH,KAAK,CACD,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,EAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,EAC1E,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,GAC/B,KAAK,CAAC,YAAY,CAAC;IAqBtB;;;;;;;;;;OAUG;IACH,OAAO,CACH,IAAI,EAAE,YAAY,GAAG,aAAa,CAAC,YAAY,CAAC,EAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,EAAE,YAAY,EAAE,GAAG,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,KAAK,OAAO,EAC1E,OAAO,CAAC,EAAE,aAAa,GAAG,IAAI,GAC/B,KAAK,CAAC,YAAY,CAAC;CA8BzB;AAED,eAAe,SAAS,CAAC"}
|
|
@@ -1,27 +1,25 @@
|
|
|
1
|
-
import { BaseId } from '
|
|
2
|
-
import { TableId } from '
|
|
3
|
-
import { FieldId, FieldType } from '
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { SdkInitData } from '../types/airtable_interface';
|
|
11
|
-
/** @hidden */
|
|
1
|
+
import { BaseId } from '../../src/types/base';
|
|
2
|
+
import { TableId } from '../../src/types/table';
|
|
3
|
+
import { FieldId, FieldType } from '../../src/types/field';
|
|
4
|
+
import { ViewId, ViewType } from '../../src/types/view';
|
|
5
|
+
import { RecordId } from '../../src/types/record';
|
|
6
|
+
import { CollaboratorData } from '../../src/types/collaborator';
|
|
7
|
+
import { Color } from '../../src/colors';
|
|
8
|
+
import { ObjectMap } from '../../src/private_utils';
|
|
9
|
+
import { SdkInitData } from '../../src/types/airtable_interface';
|
|
12
10
|
export declare function convertFixtureDataToSdkInitData(fixtureData: FixtureData): SdkInitData;
|
|
13
11
|
/**
|
|
14
12
|
* A complete set of information necessary to initialize a simulated Airtable
|
|
15
13
|
* Base in automated test environments. This is currently copied from
|
|
16
14
|
* block-testing.
|
|
15
|
+
* TODO(fredz): consider moving this into src/testing and exporting it as
|
|
16
|
+
* part of unstable_testing_utils.
|
|
17
17
|
*
|
|
18
18
|
* Unlike SdkInitData which does not contain record data by design,
|
|
19
19
|
* FixtureData contains it in fixtureData.base.tables[number].records,
|
|
20
20
|
* and relies on dependent modules to simulate the hyperbase behavior of
|
|
21
21
|
* only making those records after corresponding necessary calls to
|
|
22
22
|
* AirtableInterface.
|
|
23
|
-
*
|
|
24
|
-
* @hidden
|
|
25
23
|
*/
|
|
26
24
|
export interface FixtureData {
|
|
27
25
|
/** A representation of the state of an Airtable Base */
|
|
@@ -34,14 +32,9 @@ export interface FixtureData {
|
|
|
34
32
|
isActive: boolean;
|
|
35
33
|
}>;
|
|
36
34
|
};
|
|
37
|
-
globalConfig?: GlobalConfigData;
|
|
38
35
|
}
|
|
39
|
-
/**
|
|
40
|
-
|
|
41
|
-
*
|
|
42
|
-
* @hidden
|
|
43
|
-
* */
|
|
44
|
-
export interface TableFixtureData {
|
|
36
|
+
/** A representation of the state of a Table */
|
|
37
|
+
interface TableFixtureData {
|
|
45
38
|
/** A unique identifier for the simulated Tbale */
|
|
46
39
|
id: TableId;
|
|
47
40
|
/** The name to assign to the simulated Table */
|
|
@@ -64,12 +57,8 @@ export interface TableFixtureData {
|
|
|
64
57
|
*/
|
|
65
58
|
records: Array<RecordFixtureData>;
|
|
66
59
|
}
|
|
67
|
-
/**
|
|
68
|
-
|
|
69
|
-
*
|
|
70
|
-
* @hidden
|
|
71
|
-
*/
|
|
72
|
-
export interface FieldFixtureData {
|
|
60
|
+
/** A representation of the state of a Field */
|
|
61
|
+
interface FieldFixtureData {
|
|
73
62
|
/** A unique identifier for the simulated Field */
|
|
74
63
|
id: FieldId;
|
|
75
64
|
/** The name to assign to the simulated Field */
|
|
@@ -83,12 +72,8 @@ export interface FieldFixtureData {
|
|
|
83
72
|
[key: string]: unknown;
|
|
84
73
|
};
|
|
85
74
|
}
|
|
86
|
-
/**
|
|
87
|
-
|
|
88
|
-
*
|
|
89
|
-
* @hidden
|
|
90
|
-
*/
|
|
91
|
-
export interface ViewFixtureData {
|
|
75
|
+
/** A representation of the state of a View */
|
|
76
|
+
interface ViewFixtureData {
|
|
92
77
|
/** A unique identifier for the simulated View */
|
|
93
78
|
id: ViewId;
|
|
94
79
|
/** The name to assign to the simulated View */
|
|
@@ -108,14 +93,10 @@ export interface ViewFixtureData {
|
|
|
108
93
|
* is distinct from the complete fixture data for the simulated Records.
|
|
109
94
|
*/
|
|
110
95
|
records: Array<ViewRecordFixtureData>;
|
|
111
|
-
groups?: Array<GroupData>;
|
|
112
|
-
groupLevels?: Array<GroupLevelData>;
|
|
113
96
|
}
|
|
114
97
|
/**
|
|
115
98
|
* A reference to Record contained within a simulated view. This is disctinct
|
|
116
99
|
* from the complete fixture data for the simulated Record.
|
|
117
|
-
*
|
|
118
|
-
* @hidden
|
|
119
100
|
*/
|
|
120
101
|
interface ViewRecordFixtureData {
|
|
121
102
|
/** A value which uniquely identifies a Record within a base. */
|
|
@@ -123,12 +104,8 @@ interface ViewRecordFixtureData {
|
|
|
123
104
|
/** The color associated with a Record's membership in a View. */
|
|
124
105
|
color: Color | null;
|
|
125
106
|
}
|
|
126
|
-
/**
|
|
127
|
-
|
|
128
|
-
*
|
|
129
|
-
* @hidden
|
|
130
|
-
*/
|
|
131
|
-
export interface RecordFixtureData {
|
|
107
|
+
/** A representation of the state of a Record */
|
|
108
|
+
interface RecordFixtureData {
|
|
132
109
|
/** A unique identifier for the simulated Record */
|
|
133
110
|
id: RecordId;
|
|
134
111
|
/** The number of comments to assign to the simulated record */
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fixture_data.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/fixture_data.ts"],"names":[],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"linked_records.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/linked_records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"linked_records.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/linked_records.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,QAAA,MAAM,aAAa,EAAE,WA8GpB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,15 +1,13 @@
|
|
|
1
1
|
/// <reference types="jest" />
|
|
2
|
-
import { Aggregators,
|
|
3
|
-
import { BlockQueryId, BlockQuerySpec, QuerySpecsResponse } from '../../src/types/block_query_spec';
|
|
2
|
+
import { Aggregators, FieldTypeProvider, UrlConstructor, GlobalConfigHelpers, IdGenerator, VisList, PartialViewData } from '../../src/types/airtable_interface';
|
|
4
3
|
import { AbstractMockAirtableInterface } from '../../src/testing/abstract_mock_airtable_interface';
|
|
5
|
-
import { ModelChange } from '../../src/types/base';
|
|
6
4
|
import { TableId } from '../../src/types/table';
|
|
7
|
-
import {
|
|
5
|
+
import { FieldId } from '../../src/types/field';
|
|
8
6
|
import { CursorData } from '../../src/types/cursor';
|
|
7
|
+
import { RecordData } from '../../src/types/record';
|
|
9
8
|
import { RecordActionData } from '../../src/types/record_action_data';
|
|
10
9
|
import { RequestJson, ResponseJson } from '../../src/types/backend_fetch_types';
|
|
11
|
-
import {
|
|
12
|
-
import { FixtureData } from '../../src/testing/fixture_data';
|
|
10
|
+
import { FixtureData } from './fixture_data';
|
|
13
11
|
/**
|
|
14
12
|
* An implementation of the AbstractMockAirtableInterface designed for use in the
|
|
15
13
|
* Blocks SDK internal automated test suite. Provides Jest spies for all
|
|
@@ -20,23 +18,11 @@ export declare class MockAirtableInterface extends AbstractMockAirtableInterface
|
|
|
20
18
|
static projectTrackerExample(): jest.Mocked<MockAirtableInterface>;
|
|
21
19
|
static linkedRecordsExample(): jest.Mocked<MockAirtableInterface>;
|
|
22
20
|
static createFromFixtureData(fixtureData: FixtureData): jest.Mocked<MockAirtableInterface>;
|
|
23
|
-
_mockBaseDataStore: MockBaseDataStore;
|
|
24
|
-
_initialFixtureData: FixtureData;
|
|
25
|
-
constructor(fixtureData: FixtureData);
|
|
26
|
-
triggerModelUpdates(changes: ReadonlyArray<ModelChange>): void;
|
|
27
21
|
get aggregators(): jest.Mocked<Aggregators>;
|
|
28
22
|
get fieldTypeProvider(): jest.Mocked<FieldTypeProvider>;
|
|
29
23
|
get urlConstructor(): jest.Mocked<UrlConstructor>;
|
|
30
24
|
get globalConfigHelpers(): jest.Mocked<GlobalConfigHelpers>;
|
|
31
25
|
get idGenerator(): jest.Mocked<IdGenerator>;
|
|
32
|
-
getMockBaseDataStore(): MockBaseDataStore;
|
|
33
|
-
subscribeToQueryAndPopulateStoresAsync(query: BlockQuerySpec, options: BlockQuerySubscriptionOptions): Promise<QuerySpecsResponse>;
|
|
34
|
-
unsubscribeFromQueryIdsAsync(querySpecIds: Array<BlockQueryId>): Promise<{
|
|
35
|
-
status: boolean;
|
|
36
|
-
}>;
|
|
37
|
-
getTableRecordStoreIfExists(tableId: TableId): RecordStoreForTable | null;
|
|
38
|
-
getViewMetadataStoreIfExists(tableId: TableId, viewId: ViewId): ViewStore | null;
|
|
39
|
-
getCountOfQueriesSubscribed(): number;
|
|
40
26
|
/**
|
|
41
27
|
* Revert the mock interface to its initial state. This includes:
|
|
42
28
|
*
|
|
@@ -45,8 +31,15 @@ export declare class MockAirtableInterface extends AbstractMockAirtableInterface
|
|
|
45
31
|
* - recreating the Jest "spies" for every instance method
|
|
46
32
|
*/
|
|
47
33
|
reset(): void;
|
|
48
|
-
|
|
34
|
+
createVisList(...args: Parameters<AbstractMockAirtableInterface['createVisList']>): jest.Mocked<VisList>;
|
|
35
|
+
fetchAndSubscribeToCellValuesInFieldsAsync(tableId: TableId, fieldIds: Array<FieldId>): Promise<any>;
|
|
49
36
|
fetchAndSubscribeToCursorDataAsync(): Promise<CursorData>;
|
|
37
|
+
fetchAndSubscribeToTableDataAsync(tableId: string): Promise<{
|
|
38
|
+
recordsById: {
|
|
39
|
+
[recordId: string]: RecordData;
|
|
40
|
+
};
|
|
41
|
+
}>;
|
|
42
|
+
fetchAndSubscribeToViewDataAsync(tableId: string, viewId: string): Promise<PartialViewData>;
|
|
50
43
|
fetchDefaultCellValuesByFieldIdAsync(): Promise<{
|
|
51
44
|
[key: string]: unknown;
|
|
52
45
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mock_airtable_interface.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/mock_airtable_interface.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,WAAW,EACX,
|
|
1
|
+
{"version":3,"file":"mock_airtable_interface.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/mock_airtable_interface.ts"],"names":[],"mappings":";AAAA,OAAO,EACH,WAAW,EACX,iBAAiB,EACjB,cAAc,EACd,mBAAmB,EACnB,WAAW,EACX,OAAO,EACP,eAAe,EAClB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAC,6BAA6B,EAAC,MAAM,oDAAoD,CAAC;AACjG,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAC9C,OAAO,EAAC,OAAO,EAAC,MAAM,uBAAuB,CAAC;AAE9C,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAC,gBAAgB,EAAC,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAC,WAAW,EAAE,YAAY,EAAC,MAAM,qCAAqC,CAAC;AAG9E,OAAO,EAAC,WAAW,EAAkC,MAAM,gBAAgB,CAAC;AAuB5E;;;;;GAKG;AACH,qBAAa,qBAAsB,SAAQ,6BAA6B;IACpE,MAAM,CAAC,qBAAqB;IAI5B,MAAM,CAAC,oBAAoB;IAI3B,MAAM,CAAC,qBAAqB,CAAC,WAAW,EAAE,WAAW;IAKrD,IAAI,WAAW,6BAEd;IAED,IAAI,iBAAiB,mCAEpB;IAED,IAAI,cAAc,gCAEjB;IAED,IAAI,mBAAmB,qCAEtB;IAED,IAAI,WAAW,6BAEd;IAED;;;;;;OAMG;IACH,KAAK;IAWL,aAAa,CACT,GAAG,IAAI,EAAE,UAAU,CAAC,6BAA6B,CAAC,eAAe,CAAC,CAAC,GACpE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC;IAMvB,0CAA0C,CACtC,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,GACzB,OAAO,CAAC,GAAG,CAAC;IAGf,kCAAkC,IAAI,OAAO,CAAC,UAAU,CAAC;IAGzD,iCAAiC,CAC7B,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC;QAAC,WAAW,EAAE;YAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,UAAU,CAAA;SAAC,CAAA;KAAC,CAAC;IAGrD,gCAAgC,CAClC,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,GACf,OAAO,CAAC,eAAe,CAAC;IAG3B,oCAAoC,IAAI,OAAO,CAAC;QAAC,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAA;KAAC,CAAC;IAGzE,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,KAAK,CAAC,MAAM,CAAC,GAAG,IAAI;IAG/E,gBAAgB;IAGhB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC;IAGjD,WAAW;IAGX,2BAA2B;IAG3B,eAAe;IAGf,oBAAoB;IAGpB,eAAe;IAGf,cAAc;IAGd,2CAA2C,IAAI,OAAO,CAAC,gBAAgB,GAAG,IAAI,CAAC;IAG/E,UAAU;IAGV,aAAa;IAGb,QAAQ;IAGR,wBAAwB,CAAC,WAAW,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;CAG5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"project_tracker.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/project_tracker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"project_tracker.d.ts","sourceRoot":"","sources":["../../../../test/airtable_interface_mocks/project_tracker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,QAAA,MAAM,cAAc,EAAE,WA6YrB,CAAC;AAEF,eAAe,cAAc,CAAC"}
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
import { ReactWrapper } from 'enzyme';
|
|
2
2
|
import Watchable from '../src/watchable';
|
|
3
|
-
import { MockAirtableInterface } from './airtable_interface_mocks/mock_airtable_interface';
|
|
4
3
|
/**
|
|
5
4
|
* include a section of code that must pass flow but shouldn't actually be executed. Use it along
|
|
6
5
|
* with '// flow-expect-error' to write tests for flow-type definitions that won't be run by jest.
|
|
7
6
|
*/
|
|
8
7
|
export declare function flowTest(description: string, fn: () => unknown): void;
|
|
9
|
-
export declare const waitForAllQueriesToFullyUnsubscribeAsync: (mockAirtableInterface: MockAirtableInterface) => Promise<unknown>;
|
|
10
8
|
export declare function getComputedStylePropValue<Props extends {}>(wrapper: ReactWrapper<Props>, styleProp: string): string;
|
|
11
9
|
export declare function waitForWatchKeyAsync<Key extends string>(model: Watchable<Key>, key: Key): Promise<void>;
|
|
12
10
|
export declare function simulateTimersAndClearAfterEachTest(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"test_helpers.d.ts","sourceRoot":"","sources":["../../../test/test_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,SAAS,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"test_helpers.d.ts","sourceRoot":"","sources":["../../../test/test_helpers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,QAAQ,CAAC;AACpC,OAAO,SAAS,MAAM,kBAAkB,CAAC;AAEzC;;;GAGG;AACH,wBAAgB,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,OAAO,GAAG,IAAI,CAErE;AAED,wBAAgB,yBAAyB,CAAC,KAAK,SAAS,EAAE,EACtD,OAAO,EAAE,YAAY,CAAC,KAAK,CAAC,EAC5B,SAAS,EAAE,MAAM,GAClB,MAAM,CAGR;AAED,wBAAgB,oBAAoB,CAAC,GAAG,SAAS,MAAM,EACnD,KAAK,EAAE,SAAS,CAAC,GAAG,CAAC,EACrB,GAAG,EAAE,GAAG,GACT,OAAO,CAAC,IAAI,CAAC,CAQf;AAED,wBAAgB,mCAAmC,IAAI,IAAI,CAwB1D"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@airtable/blocks",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.1",
|
|
4
4
|
"description": "Airtable Blocks SDK",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
],
|
|
29
29
|
"scripts": {
|
|
30
30
|
"ci": "yarn run build && yarn run test:coverage && ./scripts/check_typescript_when_installed_in_block.sh",
|
|
31
|
-
"ci-partial": "yarn run ci",
|
|
32
31
|
"pretest": "yarn run lint && yarn run types",
|
|
33
32
|
"version": "changelog-publish --github-repo-url='https://github.com/airtable/blocks' --git-tag-prefix='@airtable/blocks@' && yarn run build:docs && git add CHANGELOG.md ../blocks-docs/docs.json",
|
|
34
33
|
"release": "npm_config_registry=https://registry.npmjs.org/ release-it",
|
|
@@ -1,328 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
-
|
|
5
|
-
require("core-js/modules/es.symbol");
|
|
6
|
-
|
|
7
|
-
require("core-js/modules/es.symbol.description");
|
|
8
|
-
|
|
9
|
-
require("core-js/modules/es.array.iterator");
|
|
10
|
-
|
|
11
|
-
require("core-js/modules/es.map");
|
|
12
|
-
|
|
13
|
-
require("core-js/modules/es.object.to-string");
|
|
14
|
-
|
|
15
|
-
require("core-js/modules/es.promise");
|
|
16
|
-
|
|
17
|
-
require("core-js/modules/web.dom-collections.for-each");
|
|
18
|
-
|
|
19
|
-
require("core-js/modules/web.dom-collections.iterator");
|
|
20
|
-
|
|
21
|
-
Object.defineProperty(exports, "__esModule", {
|
|
22
|
-
value: true
|
|
23
|
-
});
|
|
24
|
-
exports.QueryManager = void 0;
|
|
25
|
-
|
|
26
|
-
var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
|
|
27
|
-
|
|
28
|
-
require("regenerator-runtime/runtime");
|
|
29
|
-
|
|
30
|
-
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
31
|
-
|
|
32
|
-
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
33
|
-
|
|
34
|
-
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime/helpers/defineProperty"));
|
|
35
|
-
|
|
36
|
-
var _error_utils = require("../error_utils");
|
|
37
|
-
|
|
38
|
-
var _private_utils = require("../private_utils");
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* This provides a singleton instance which is responsible for all queries sent
|
|
42
|
-
* to PublicAirtableInterface.
|
|
43
|
-
*
|
|
44
|
-
* This can allow looking up queries by queryId.
|
|
45
|
-
*
|
|
46
|
-
* @internal
|
|
47
|
-
*/
|
|
48
|
-
var QueryManager =
|
|
49
|
-
/*#__PURE__*/
|
|
50
|
-
function () {
|
|
51
|
-
function QueryManager(sdk) {
|
|
52
|
-
(0, _classCallCheck2.default)(this, QueryManager);
|
|
53
|
-
(0, _defineProperty2.default)(this, "_airtableInterface", void 0);
|
|
54
|
-
(0, _defineProperty2.default)(this, "_sdk", void 0);
|
|
55
|
-
(0, _defineProperty2.default)(this, "_queryRegistrationInfosByWatchKey", new Map());
|
|
56
|
-
(0, _defineProperty2.default)(this, "fetchAndSubscribeToQueryAsync", (query, querySubscriptionOptions) => {
|
|
57
|
-
var queryResponse;
|
|
58
|
-
return _regenerator.default.async(function _callee$(_context) {
|
|
59
|
-
while (1) {
|
|
60
|
-
switch (_context.prev = _context.next) {
|
|
61
|
-
case 0:
|
|
62
|
-
_context.next = 2;
|
|
63
|
-
return _regenerator.default.awrap(this._airtableInterface.subscribeToQueryAndPopulateStoresAsync(query, querySubscriptionOptions !== null && querySubscriptionOptions !== void 0 ? querySubscriptionOptions : {}));
|
|
64
|
-
|
|
65
|
-
case 2:
|
|
66
|
-
queryResponse = _context.sent;
|
|
67
|
-
|
|
68
|
-
if (queryResponse.success) {
|
|
69
|
-
_context.next = 5;
|
|
70
|
-
break;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
throw (0, _error_utils.spawnError)('Subscription to query failed - unhandled error');
|
|
74
|
-
|
|
75
|
-
case 5:
|
|
76
|
-
return _context.abrupt("return", queryResponse.blockQueryId);
|
|
77
|
-
|
|
78
|
-
case 6:
|
|
79
|
-
case "end":
|
|
80
|
-
return _context.stop();
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}, null, this);
|
|
84
|
-
});
|
|
85
|
-
(0, _defineProperty2.default)(this, "unsubscribeFromQueryIds", queryIds => {
|
|
86
|
-
var _iteratorNormalCompletion = true;
|
|
87
|
-
var _didIteratorError = false;
|
|
88
|
-
var _iteratorError = undefined;
|
|
89
|
-
|
|
90
|
-
try {
|
|
91
|
-
for (var _iterator = queryIds[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
|
|
92
|
-
var queryId = _step.value;
|
|
93
|
-
// TODO: (#proj-blocks-sdk-record-limits) Add support for unsubscribing multiple at the same time
|
|
94
|
-
this.unsubscribeFromQueryId(queryId);
|
|
95
|
-
}
|
|
96
|
-
} catch (err) {
|
|
97
|
-
_didIteratorError = true;
|
|
98
|
-
_iteratorError = err;
|
|
99
|
-
} finally {
|
|
100
|
-
try {
|
|
101
|
-
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
102
|
-
_iterator.return();
|
|
103
|
-
}
|
|
104
|
-
} finally {
|
|
105
|
-
if (_didIteratorError) {
|
|
106
|
-
throw _iteratorError;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
});
|
|
111
|
-
(0, _defineProperty2.default)(this, "unsubscribeFromQueryId", queryId => {
|
|
112
|
-
(0, _private_utils.fireAndForgetPromise)(() => this._airtableInterface.unsubscribeFromQueryIdsAsync([queryId]));
|
|
113
|
-
});
|
|
114
|
-
(0, _defineProperty2.default)(this, "watchWithQuerySpec", (callbackPriority, query, watchableModel, watchKey, watchOnChangeCallback, callbackForRegistration, context) => {
|
|
115
|
-
var isOnChangeCallbackCanceled = false;
|
|
116
|
-
|
|
117
|
-
var callbackForCancelOnChange = () => isOnChangeCallbackCanceled = true;
|
|
118
|
-
|
|
119
|
-
var onChangeCallback = changes => {
|
|
120
|
-
if (isOnChangeCallbackCanceled) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
watchableModel.__incrementOnChangeCount();
|
|
125
|
-
|
|
126
|
-
watchOnChangeCallback(changes);
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
var blockQueryIdPromise = this.fetchAndSubscribeToQueryAsync(query, {
|
|
130
|
-
onChangeCallback,
|
|
131
|
-
callbackPriority
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
var queryRegistrationInfosForKey = this._queryRegistrationInfosByWatchKey.get(watchKey);
|
|
135
|
-
|
|
136
|
-
if (!queryRegistrationInfosForKey) {
|
|
137
|
-
queryRegistrationInfosForKey = [];
|
|
138
|
-
|
|
139
|
-
this._queryRegistrationInfosByWatchKey.set(watchKey, queryRegistrationInfosForKey);
|
|
140
|
-
} // It is safe to push onto queryRegistrationInfosForKey (vs copying) as long
|
|
141
|
-
// as we don't release the event loop when we iterate over it, which only
|
|
142
|
-
// happens in unwatchFromQueryKeys
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
queryRegistrationInfosForKey.push({
|
|
146
|
-
blockQueryIdPromise,
|
|
147
|
-
callbackForCancelOnChange,
|
|
148
|
-
callbackForRegistration,
|
|
149
|
-
context,
|
|
150
|
-
onChangeCallback,
|
|
151
|
-
watchableModel
|
|
152
|
-
});
|
|
153
|
-
});
|
|
154
|
-
(0, _defineProperty2.default)(this, "_unwatchFromQueryRegistrationInfoAsync", queryRegistrationInfo => {
|
|
155
|
-
var blockQueryIdPromise, callbackForCancelOnChange, queryId;
|
|
156
|
-
return _regenerator.default.async(function _callee2$(_context2) {
|
|
157
|
-
while (1) {
|
|
158
|
-
switch (_context2.prev = _context2.next) {
|
|
159
|
-
case 0:
|
|
160
|
-
blockQueryIdPromise = queryRegistrationInfo.blockQueryIdPromise, callbackForCancelOnChange = queryRegistrationInfo.callbackForCancelOnChange;
|
|
161
|
-
callbackForCancelOnChange();
|
|
162
|
-
_context2.next = 4;
|
|
163
|
-
return _regenerator.default.awrap(blockQueryIdPromise);
|
|
164
|
-
|
|
165
|
-
case 4:
|
|
166
|
-
queryId = _context2.sent;
|
|
167
|
-
this.unsubscribeFromQueryId(queryId);
|
|
168
|
-
|
|
169
|
-
case 6:
|
|
170
|
-
case "end":
|
|
171
|
-
return _context2.stop();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}, null, this);
|
|
175
|
-
});
|
|
176
|
-
(0, _defineProperty2.default)(this, "unwatchFromQueryKey", (watchKey, callbackForRegistration, context) => {
|
|
177
|
-
var queryRegistrationInfos = this._queryRegistrationInfosByWatchKey.get(watchKey);
|
|
178
|
-
|
|
179
|
-
if (queryRegistrationInfos) {
|
|
180
|
-
var watchersToUnwatch = [];
|
|
181
|
-
var watchersToKeep = [];
|
|
182
|
-
queryRegistrationInfos.forEach(watcher => {
|
|
183
|
-
var isCallbackToUnwatch = watcher.callbackForRegistration === callbackForRegistration && watcher.context === context;
|
|
184
|
-
|
|
185
|
-
if (isCallbackToUnwatch) {
|
|
186
|
-
watchersToUnwatch.push(watcher);
|
|
187
|
-
} else {
|
|
188
|
-
watchersToKeep.push(watcher);
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
if (watchersToKeep.length > 0) {
|
|
193
|
-
this._queryRegistrationInfosByWatchKey.set(watchKey, watchersToKeep);
|
|
194
|
-
} else {
|
|
195
|
-
this._queryRegistrationInfosByWatchKey.delete(watchKey);
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
if (watchersToUnwatch.length > 0) {
|
|
199
|
-
// Do not await the response since unwatch is not async
|
|
200
|
-
watchersToUnwatch.forEach(this._unwatchFromQueryRegistrationInfoAsync);
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
});
|
|
204
|
-
this._airtableInterface = sdk.__airtableInterface;
|
|
205
|
-
this._sdk = sdk;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
(0, _createClass2.default)(QueryManager, [{
|
|
209
|
-
key: "_onChange",
|
|
210
|
-
value: function _onChange(watchableModel, watchKey) {
|
|
211
|
-
var queryRegistrationInfos = this._queryRegistrationInfosByWatchKey.get(watchKey);
|
|
212
|
-
|
|
213
|
-
if (!queryRegistrationInfos) {
|
|
214
|
-
return;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
var _iteratorNormalCompletion2 = true;
|
|
218
|
-
var _didIteratorError2 = false;
|
|
219
|
-
var _iteratorError2 = undefined;
|
|
220
|
-
|
|
221
|
-
try {
|
|
222
|
-
for (var _iterator2 = queryRegistrationInfos[Symbol.iterator](), _step2; !(_iteratorNormalCompletion2 = (_step2 = _iterator2.next()).done); _iteratorNormalCompletion2 = true) {
|
|
223
|
-
var watcher = _step2.value;
|
|
224
|
-
|
|
225
|
-
if (watcher.watchableModel === watchableModel) {
|
|
226
|
-
watcher.onChangeCallback([]);
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
} catch (err) {
|
|
230
|
-
_didIteratorError2 = true;
|
|
231
|
-
_iteratorError2 = err;
|
|
232
|
-
} finally {
|
|
233
|
-
try {
|
|
234
|
-
if (!_iteratorNormalCompletion2 && _iterator2.return != null) {
|
|
235
|
-
_iterator2.return();
|
|
236
|
-
}
|
|
237
|
-
} finally {
|
|
238
|
-
if (_didIteratorError2) {
|
|
239
|
-
throw _iteratorError2;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
|
-
}
|
|
243
|
-
}
|
|
244
|
-
}, {
|
|
245
|
-
key: "onLoadKeys",
|
|
246
|
-
value: function onLoadKeys(watchableModel, watchKeys) {
|
|
247
|
-
var _iteratorNormalCompletion3 = true;
|
|
248
|
-
var _didIteratorError3 = false;
|
|
249
|
-
var _iteratorError3 = undefined;
|
|
250
|
-
|
|
251
|
-
try {
|
|
252
|
-
for (var _iterator3 = watchKeys[Symbol.iterator](), _step3; !(_iteratorNormalCompletion3 = (_step3 = _iterator3.next()).done); _iteratorNormalCompletion3 = true) {
|
|
253
|
-
var key = _step3.value;
|
|
254
|
-
|
|
255
|
-
this._onChange(watchableModel, key);
|
|
256
|
-
}
|
|
257
|
-
} catch (err) {
|
|
258
|
-
_didIteratorError3 = true;
|
|
259
|
-
_iteratorError3 = err;
|
|
260
|
-
} finally {
|
|
261
|
-
try {
|
|
262
|
-
if (!_iteratorNormalCompletion3 && _iterator3.return != null) {
|
|
263
|
-
_iterator3.return();
|
|
264
|
-
}
|
|
265
|
-
} finally {
|
|
266
|
-
if (_didIteratorError3) {
|
|
267
|
-
throw _iteratorError3;
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
}, {
|
|
273
|
-
key: "forceUnloadWatchesOnWatchableModel",
|
|
274
|
-
value: function forceUnloadWatchesOnWatchableModel(watchableModel) {
|
|
275
|
-
var _iteratorNormalCompletion4 = true;
|
|
276
|
-
var _didIteratorError4 = false;
|
|
277
|
-
var _iteratorError4 = undefined;
|
|
278
|
-
|
|
279
|
-
try {
|
|
280
|
-
for (var _iterator4 = this._queryRegistrationInfosByWatchKey.values()[Symbol.iterator](), _step4; !(_iteratorNormalCompletion4 = (_step4 = _iterator4.next()).done); _iteratorNormalCompletion4 = true) {
|
|
281
|
-
var queryRegistrationInfos = _step4.value;
|
|
282
|
-
var _iteratorNormalCompletion5 = true;
|
|
283
|
-
var _didIteratorError5 = false;
|
|
284
|
-
var _iteratorError5 = undefined;
|
|
285
|
-
|
|
286
|
-
try {
|
|
287
|
-
for (var _iterator5 = queryRegistrationInfos[Symbol.iterator](), _step5; !(_iteratorNormalCompletion5 = (_step5 = _iterator5.next()).done); _iteratorNormalCompletion5 = true) {
|
|
288
|
-
var watcher = _step5.value;
|
|
289
|
-
|
|
290
|
-
if (watcher.watchableModel === watchableModel) {
|
|
291
|
-
this._unwatchFromQueryRegistrationInfoAsync(watcher);
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
} catch (err) {
|
|
295
|
-
_didIteratorError5 = true;
|
|
296
|
-
_iteratorError5 = err;
|
|
297
|
-
} finally {
|
|
298
|
-
try {
|
|
299
|
-
if (!_iteratorNormalCompletion5 && _iterator5.return != null) {
|
|
300
|
-
_iterator5.return();
|
|
301
|
-
}
|
|
302
|
-
} finally {
|
|
303
|
-
if (_didIteratorError5) {
|
|
304
|
-
throw _iteratorError5;
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
}
|
|
309
|
-
} catch (err) {
|
|
310
|
-
_didIteratorError4 = true;
|
|
311
|
-
_iteratorError4 = err;
|
|
312
|
-
} finally {
|
|
313
|
-
try {
|
|
314
|
-
if (!_iteratorNormalCompletion4 && _iterator4.return != null) {
|
|
315
|
-
_iterator4.return();
|
|
316
|
-
}
|
|
317
|
-
} finally {
|
|
318
|
-
if (_didIteratorError4) {
|
|
319
|
-
throw _iteratorError4;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
}]);
|
|
325
|
-
return QueryManager;
|
|
326
|
-
}();
|
|
327
|
-
|
|
328
|
-
exports.QueryManager = QueryManager;
|