@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.
Files changed (85) hide show
  1. package/CHANGELOG.md +12 -1
  2. package/dist/cjs/error_utils.js +9 -34
  3. package/dist/cjs/models/base.js +15 -0
  4. package/dist/cjs/models/field.js +99 -4
  5. package/dist/cjs/models/grouped_record_query_result.js +14 -5
  6. package/dist/cjs/models/linked_records_query_result.js +44 -86
  7. package/dist/cjs/models/mutations.js +234 -53
  8. package/dist/cjs/models/record.js +55 -310
  9. package/dist/cjs/models/record_query_result.js +1 -4
  10. package/dist/cjs/models/record_store.js +779 -557
  11. package/dist/cjs/models/table.js +6 -6
  12. package/dist/cjs/models/table_or_view_query_result.js +419 -526
  13. package/dist/cjs/models/view_data_store.js +295 -255
  14. package/dist/cjs/private_utils.js +0 -40
  15. package/dist/cjs/sdk.js +2 -12
  16. package/dist/cjs/testing/abstract_mock_airtable_interface.js +11 -57
  17. package/dist/cjs/types/airtable_interface.js +2 -17
  18. package/dist/cjs/types/mutations.js +1 -0
  19. package/dist/cjs/ui/use_records.js +1 -5
  20. package/dist/cjs/unstable_testing_utils.js +1 -55
  21. package/dist/cjs/watchable.js +1 -15
  22. package/dist/types/src/error_utils.d.ts +4 -2
  23. package/dist/types/src/error_utils.d.ts.map +1 -1
  24. package/dist/types/src/models/base.d.ts +10 -0
  25. package/dist/types/src/models/base.d.ts.map +1 -1
  26. package/dist/types/src/models/field.d.ts +58 -0
  27. package/dist/types/src/models/field.d.ts.map +1 -1
  28. package/dist/types/src/models/grouped_record_query_result.d.ts +3 -3
  29. package/dist/types/src/models/grouped_record_query_result.d.ts.map +1 -1
  30. package/dist/types/src/models/linked_records_query_result.d.ts.map +1 -1
  31. package/dist/types/src/models/mutations.d.ts.map +1 -1
  32. package/dist/types/src/models/record.d.ts +3 -12
  33. package/dist/types/src/models/record.d.ts.map +1 -1
  34. package/dist/types/src/models/record_query_result.d.ts +2 -3
  35. package/dist/types/src/models/record_query_result.d.ts.map +1 -1
  36. package/dist/types/src/models/record_store.d.ts.map +1 -1
  37. package/dist/types/src/models/table_or_view_query_result.d.ts +5 -3
  38. package/dist/types/src/models/table_or_view_query_result.d.ts.map +1 -1
  39. package/dist/types/src/models/view_data_store.d.ts +1 -0
  40. package/dist/types/src/models/view_data_store.d.ts.map +1 -1
  41. package/dist/types/src/models/view_metadata_query_result.d.ts +1 -1
  42. package/dist/types/src/models/view_metadata_query_result.d.ts.map +1 -1
  43. package/dist/types/src/private_utils.d.ts +1 -24
  44. package/dist/types/src/private_utils.d.ts.map +1 -1
  45. package/dist/types/src/sdk.d.ts.map +1 -1
  46. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts +11 -11
  47. package/dist/types/src/testing/abstract_mock_airtable_interface.d.ts.map +1 -1
  48. package/dist/types/src/types/airtable_interface.d.ts +20 -59
  49. package/dist/types/src/types/airtable_interface.d.ts.map +1 -1
  50. package/dist/types/src/types/base.d.ts +1 -0
  51. package/dist/types/src/types/base.d.ts.map +1 -1
  52. package/dist/types/src/types/mutations.d.ts +25 -2
  53. package/dist/types/src/types/mutations.d.ts.map +1 -1
  54. package/dist/types/src/types/table.d.ts +2 -0
  55. package/dist/types/src/types/table.d.ts.map +1 -1
  56. package/dist/types/src/types/view.d.ts +8 -3
  57. package/dist/types/src/types/view.d.ts.map +1 -1
  58. package/dist/types/src/ui/record_card.d.ts +1 -1
  59. package/dist/types/src/unstable_testing_utils.d.ts +1 -4
  60. package/dist/types/src/unstable_testing_utils.d.ts.map +1 -1
  61. package/dist/types/src/watchable.d.ts.map +1 -1
  62. package/dist/types/{src/testing → test/airtable_interface_mocks}/fixture_data.d.ts +19 -42
  63. package/dist/types/test/airtable_interface_mocks/fixture_data.d.ts.map +1 -0
  64. package/dist/types/test/airtable_interface_mocks/linked_records.d.ts +1 -1
  65. package/dist/types/test/airtable_interface_mocks/linked_records.d.ts.map +1 -1
  66. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts +12 -19
  67. package/dist/types/test/airtable_interface_mocks/mock_airtable_interface.d.ts.map +1 -1
  68. package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts +1 -1
  69. package/dist/types/test/airtable_interface_mocks/project_tracker.d.ts.map +1 -1
  70. package/dist/types/test/test_helpers.d.ts +0 -2
  71. package/dist/types/test/test_helpers.d.ts.map +1 -1
  72. package/package.json +1 -2
  73. package/dist/cjs/models/query_manager.js +0 -328
  74. package/dist/cjs/testing/fixture_data.js +0 -268
  75. package/dist/cjs/testing/mock_base_data_stores.js +0 -876
  76. package/dist/cjs/types/block_query_spec.js +0 -85
  77. package/dist/types/src/models/query_manager.d.ts +0 -2
  78. package/dist/types/src/models/query_manager.d.ts.map +0 -1
  79. package/dist/types/src/testing/fixture_data.d.ts.map +0 -1
  80. package/dist/types/src/testing/mock_base_data_stores.d.ts +0 -55
  81. package/dist/types/src/testing/mock_base_data_stores.d.ts.map +0 -1
  82. package/dist/types/src/types/block_query_spec.d.ts +0 -139
  83. package/dist/types/src/types/block_query_spec.d.ts.map +0 -1
  84. package/dist/types/test/testing/fixture_data.test.d.ts +0 -2
  85. package/dist/types/test/testing/fixture_data.test.d.ts.map +0 -1
@@ -1,85 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.BlockQuerySubscriptionChangeType = exports.BlockFieldSelectionSpecType = exports.BlockQuerySourceType = void 0;
7
-
8
- /**
9
- * Specification for data needed by both the Blocks SDK and the blocks iframe
10
- * that spans across a few repos and run environments:
11
- * +--------------------+--------------------+--------------------+
12
- * | airtable.com | blocks iframe | blocks sdk |
13
- * +--------------------+--------------------+--------------------+
14
- * | repo: hyperbase | repo: hyperbase | repo: blocks-sdk |
15
- * | run: airtable.com | run: iframe | run: iframe |
16
- * +--------------------+--------------------+--------------------+
17
- *
18
- * A BlockQuerySpec has a required `source` and one or more `selection`s.
19
- * The `source` is a top-level concept that defines where the data comes
20
- * from, while the `selection`s define desired properties from the data.
21
- * In other words, think of the data as a tree, the `source` defines the
22
- * root, and the `selection`s define the branches and leaves.
23
- *
24
- * Note that instead of a sub-object `source`, we use `source`-prefixed
25
- * properties for the same effect. This works around a TypeScript limitation
26
- * of not being able to discriminate between the unions for BlockQuerySpec.
27
- *
28
- * The specification will be used for two parts of the data lifecycle:
29
- * 1. An initial response, via BlockQuerySpecResponseForAirtableInterface
30
- * 2. Subsequent updates to keep the date updated, via BlockQueryUpdate
31
- *
32
- * NOTE: Keep this in sync with the hyperbase repo's block_query_spec.tsx file!
33
- *
34
- * @hidden
35
- */
36
-
37
- /** @hidden */
38
-
39
- /** @hidden */
40
-
41
- /** @hidden */
42
- var BlockQuerySourceType;
43
- /** @hidden */
44
-
45
- exports.BlockQuerySourceType = BlockQuerySourceType;
46
-
47
- (function (BlockQuerySourceType) {
48
- BlockQuerySourceType["TABLE"] = "table";
49
- BlockQuerySourceType["VIEW"] = "view";
50
- })(BlockQuerySourceType || (exports.BlockQuerySourceType = BlockQuerySourceType = {}));
51
-
52
- /**
53
- * The different ways fields can be queried
54
- *
55
- * @hidden
56
- */
57
- var BlockFieldSelectionSpecType;
58
- /**
59
- * Allows querying for all fields, or a specified set of fields. In the latter
60
- * case, we also allow specifying properties of a record like commentCount and
61
- * recordCreatedTime that don't have fieldIds (ALL_FIELDS implies including all
62
- * of these properties).
63
- *
64
- * @hidden
65
- */
66
-
67
- exports.BlockFieldSelectionSpecType = BlockFieldSelectionSpecType;
68
-
69
- (function (BlockFieldSelectionSpecType) {
70
- BlockFieldSelectionSpecType["SPECIFIED_FIELDS"] = "specifiedFields";
71
- BlockFieldSelectionSpecType["ALL_FIELDS_FROM_TABLE"] = "allFieldsFromTable";
72
- })(BlockFieldSelectionSpecType || (exports.BlockFieldSelectionSpecType = BlockFieldSelectionSpecType = {}));
73
-
74
- /** @hidden */
75
- var BlockQuerySubscriptionChangeType;
76
- /** @hidden */
77
-
78
- exports.BlockQuerySubscriptionChangeType = BlockQuerySubscriptionChangeType;
79
-
80
- (function (BlockQuerySubscriptionChangeType) {
81
- BlockQuerySubscriptionChangeType["ADDED_RECORD_IDS"] = "addedRecordIds";
82
- BlockQuerySubscriptionChangeType["REMOVED_RECORD_IDS"] = "removedRecordIds";
83
- BlockQuerySubscriptionChangeType["MODIFIED_CELL_VALUES_FOR_TABLE"] = "modifiedCellValuesForTable";
84
- BlockQuerySubscriptionChangeType["CHANGED_COLORS_BY_RECORD_ID_FOR_VIEW"] = "changedColorsByRecordIdForView";
85
- })(BlockQuerySubscriptionChangeType || (exports.BlockQuerySubscriptionChangeType = BlockQuerySubscriptionChangeType = {}));
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=query_manager.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"query_manager.d.ts","sourceRoot":"","sources":["../../../../src/models/query_manager.ts"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture_data.d.ts","sourceRoot":"","sources":["../../../../src/testing/fixture_data.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,MAAM,EAAC,MAAM,eAAe,CAAC;AACrC,OAAO,EAAC,OAAO,EAAY,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAC,OAAO,EAAE,SAAS,EAAY,MAAM,gBAAgB,CAAC;AAC7D,OAAO,EAAC,gBAAgB,EAAC,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAC,MAAM,EAAE,QAAQ,EAAY,SAAS,EAAE,cAAc,EAAC,MAAM,eAAe,CAAC;AACpF,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,gBAAgB,EAAC,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,SAAS,EAAe,MAAM,kBAAkB,CAAC;AACzD,OAAO,EAAsB,WAAW,EAAC,MAAM,6BAA6B,CAA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IACjD,EAAE,EAAE,MAAM,CAAC;IACX,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,qCAAqC;IACrC,IAAI,EAAE,QAAQ,CAAC;IACf;;;OAGG;IACH,UAAU,EAAE;QACR,QAAQ,EAAE,KAAK,CAAC,OAAO,CAAC,CAAC;QACzB,iBAAiB,EAAE,MAAM,CAAC;KAC7B,CAAC;IACF;;;OAGG;IACH,OAAO,EAAE,KAAK,CAAC,qBAAqB,CAAC,CAAC;IACtC,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;IAC1B,WAAW,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;CACvC;AAED;;;;;GAKG;AACH,UAAU,qBAAqB;IAC3B,gEAAgE;IAChE,EAAE,EAAE,QAAQ,CAAC;IACb,iEAAiE;IACjE,KAAK,EAAE,KAAK,GAAG,IAAI,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAC9B,mDAAmD;IACnD,EAAE,EAAE,QAAQ,CAAC;IACb,+DAA+D;IAC/D,YAAY,EAAE,MAAM,CAAC;IACrB,uEAAuE;IACvE,WAAW,EAAE,MAAM,CAAC;IACpB,oDAAoD;IACpD,mBAAmB,EAAE,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;CACpD"}
@@ -1,55 +0,0 @@
1
- import { BlockQueryCallbackPriority, BlockQuerySubscriptionOptions, RecordStoreForTable, ViewStore } from '../types/airtable_interface';
2
- import { BlockQuerySpec, BlockQueryId, BlockQuerySubscriptionOnChangeCallback, QuerySpecsResponse } from '../types/block_query_spec';
3
- import { Color } from '../colors';
4
- import { FieldId } from '../types/field';
5
- import { RecordId } from '../types/record';
6
- import { TableId } from '../types/table';
7
- import { ViewId } from '../types/view';
8
- import { ObjectMap } from '../private_utils';
9
- import { AbstractMockAirtableInterface } from './abstract_mock_airtable_interface';
10
- import { FixtureData, TableFixtureData, RecordFixtureData, ViewFixtureData, FieldFixtureData } from './fixture_data';
11
- /** @hidden */
12
- export declare class MockBaseDataStore {
13
- _mockAirtableInterface: AbstractMockAirtableInterface;
14
- _fixtureData: FixtureData;
15
- _tablesById: ObjectMap<TableId, TableFixtureData>;
16
- _subscribedQuerySpecs: ObjectMap<BlockQueryId, {
17
- querySpec: BlockQuerySpec;
18
- onChangeCallback?: BlockQuerySubscriptionOnChangeCallback;
19
- callbackPriority?: BlockQueryCallbackPriority;
20
- }>;
21
- _deletedRecordIds: Array<RecordId>;
22
- _onUnsubscribeFromQueryCallback: (() => void) | null;
23
- _upperQueryIdsFromPreviousTests: number;
24
- _shouldQueriesFail: boolean;
25
- constructor(mockAirtableInterface: AbstractMockAirtableInterface, fixtureData: FixtureData);
26
- setSubscribeToQueryFailureMode(shouldQueriesFail: boolean): void;
27
- subscribeToQueryAndPopulateStoresAsync(querySpec: BlockQuerySpec, options: BlockQuerySubscriptionOptions): Promise<QuerySpecsResponse>;
28
- unsubscribeFromQueryIdsAsync(querySpecIds: Array<BlockQueryId>): Promise<{
29
- status: boolean;
30
- }>;
31
- setTableRecordsAsync(tableId: TableId, fixtureRecords: Array<RecordFixtureData>): Promise<void>;
32
- deleteRecordAsync(tableId: TableId, recordId: RecordId): Promise<void>;
33
- createRecordAsync(tableId: TableId, initialFixtureRecord: RecordFixtureData): Promise<void>;
34
- updateRecord(tableId: TableId, recordId: RecordId, fieldId: FieldId, newValue: unknown, opts?: {
35
- allowUnexpected?: boolean;
36
- shouldForceOnChangeCallbackWhenNoQueriesMatchRecord?: boolean;
37
- shouldCallSubscriptionChangesWithEmptyArray?: boolean;
38
- }): void;
39
- updateCommentCount(tableId: TableId, recordId: RecordId, newCommentCount: number): void;
40
- updateColorInView(tableId: TableId, viewId: ViewId, recordId: RecordId, newColor: Color | null): void;
41
- getTableRecordStoreIfExists(tableId: TableId): RecordStoreForTable | null;
42
- _getPartiallyLoadedRecordIds(fixtureTable: TableFixtureData): string[];
43
- createTable(tableId: TableId, name: string, fields: Array<FieldFixtureData>): void;
44
- addFieldToFixtureTable(tableId: TableId, fieldFixtureData: FieldFixtureData): void;
45
- removeFieldFromFixtureTable(tableId: TableId, fieldId: FieldId): void;
46
- _isRecordCellValueLoadedForFieldId(fixtureTable: TableFixtureData, recordId: RecordId, fieldId: FieldId): boolean;
47
- _getRecordCellValueByFieldId(fixtureTable: TableFixtureData, recordId: RecordId, fieldId: FieldId): unknown;
48
- _getRecordCommentCount(fixtureTable: TableFixtureData, recordId: RecordId): number;
49
- _getRecordCreatedTime(fixtureTable: TableFixtureData, recordId: RecordId): Date;
50
- setViewData(tableId: TableId, viewId: ViewId, viewFixtureData: Partial<ViewFixtureData>): void;
51
- getViewMetadataStoreIfExists(tableId: TableId, viewId: ViewId): ViewStore | null;
52
- getCountOfQueriesSubscribed(): number;
53
- onUnsubscribeFromQuery(onUnsubscribeFromQueryCallback: () => void): void;
54
- }
55
- //# sourceMappingURL=mock_base_data_stores.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mock_base_data_stores.d.ts","sourceRoot":"","sources":["../../../../src/testing/mock_base_data_stores.ts"],"names":[],"mappings":"AACA,OAAO,EACH,0BAA0B,EAC1B,6BAA6B,EAC7B,mBAAmB,EACnB,SAAS,EACZ,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAEH,cAAc,EAEd,YAAY,EAEZ,sCAAsC,EACtC,kBAAkB,EACrB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAC,KAAK,EAAC,MAAM,WAAW,CAAC;AAChC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACzC,OAAO,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAW,MAAM,eAAe,CAAC;AAC/C,OAAO,EAAC,SAAS,EAAe,MAAM,kBAAkB,CAAC;AAEzD,OAAO,EAAC,6BAA6B,EAAC,MAAM,oCAAoC,CAAC;AACj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AO,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI;IAmBhF,2BAA2B,IAAI,MAAM;IAGrC,sBAAsB,CAAC,8BAA8B,EAAE,MAAM,IAAI,GAAG,IAAI;CAG3E"}
@@ -1,139 +0,0 @@
1
- import { ObjectMap } from '../private_utils';
2
- import { TableId } from './table';
3
- import { ViewId } from './view';
4
- import { RecordId } from './record';
5
- import { FieldId } from './field';
6
- /**
7
- * Specification for data needed by both the Blocks SDK and the blocks iframe
8
- * that spans across a few repos and run environments:
9
- * +--------------------+--------------------+--------------------+
10
- * | airtable.com | blocks iframe | blocks sdk |
11
- * +--------------------+--------------------+--------------------+
12
- * | repo: hyperbase | repo: hyperbase | repo: blocks-sdk |
13
- * | run: airtable.com | run: iframe | run: iframe |
14
- * +--------------------+--------------------+--------------------+
15
- *
16
- * A BlockQuerySpec has a required `source` and one or more `selection`s.
17
- * The `source` is a top-level concept that defines where the data comes
18
- * from, while the `selection`s define desired properties from the data.
19
- * In other words, think of the data as a tree, the `source` defines the
20
- * root, and the `selection`s define the branches and leaves.
21
- *
22
- * Note that instead of a sub-object `source`, we use `source`-prefixed
23
- * properties for the same effect. This works around a TypeScript limitation
24
- * of not being able to discriminate between the unions for BlockQuerySpec.
25
- *
26
- * The specification will be used for two parts of the data lifecycle:
27
- * 1. An initial response, via BlockQuerySpecResponseForAirtableInterface
28
- * 2. Subsequent updates to keep the date updated, via BlockQueryUpdate
29
- *
30
- * NOTE: Keep this in sync with the hyperbase repo's block_query_spec.tsx file!
31
- *
32
- * @hidden
33
- */
34
- export declare type BlockQuerySpec = BlockTableQuerySpec | BlockViewQuerySpec;
35
- /** @hidden */
36
- export interface BlockTableQuerySpec {
37
- sourceType: BlockQuerySourceType.TABLE;
38
- sourceTableId: TableId;
39
- recordSelection: BlockRecordSelectionSpec;
40
- }
41
- /** @hidden */
42
- export interface BlockViewQuerySpec {
43
- sourceType: BlockQuerySourceType.VIEW;
44
- sourceTableId: TableId;
45
- sourceViewId: ViewId;
46
- recordSelection?: BlockRecordSelectionSpec;
47
- viewMetadataSelection?: BlockViewMetadataSelectionSpec;
48
- }
49
- /** @hidden */
50
- export declare enum BlockQuerySourceType {
51
- TABLE = "table",
52
- VIEW = "view"
53
- }
54
- /** @hidden */
55
- export interface BlockRecordSelectionSpec {
56
- readonly fieldSelection: BlockFieldSelectionSpec;
57
- /** Optionally filter down to more specific recordIds from the source */
58
- readonly recordIds?: Array<RecordId>;
59
- }
60
- /**
61
- * The different ways fields can be queried
62
- *
63
- * @hidden
64
- */
65
- export declare enum BlockFieldSelectionSpecType {
66
- SPECIFIED_FIELDS = "specifiedFields",
67
- ALL_FIELDS_FROM_TABLE = "allFieldsFromTable"
68
- }
69
- /**
70
- * Allows querying for all fields, or a specified set of fields. In the latter
71
- * case, we also allow specifying properties of a record like commentCount and
72
- * recordCreatedTime that don't have fieldIds (ALL_FIELDS implies including all
73
- * of these properties).
74
- *
75
- * @hidden
76
- */
77
- export declare type BlockFieldSelectionSpec = {
78
- readonly type: BlockFieldSelectionSpecType.SPECIFIED_FIELDS;
79
- readonly fieldIds: Array<FieldId>;
80
- readonly shouldIncludeCommentCount?: boolean;
81
- readonly shouldIncludeRecordCreatedTime?: boolean;
82
- } | {
83
- readonly type: BlockFieldSelectionSpecType.ALL_FIELDS_FROM_TABLE;
84
- };
85
- /** @hidden */
86
- export interface BlockViewMetadataSelectionSpec {
87
- readonly shouldIncludeVisibleRecordIds?: boolean;
88
- readonly shouldIncludeFieldOrder?: boolean;
89
- readonly shouldIncludeGroups?: boolean;
90
- readonly shouldIncludeGroupingLevels?: boolean;
91
- readonly shouldIncludeColorsForRecordId?: boolean;
92
- }
93
- /**
94
- * Response recieved from an executed query.
95
- *
96
- * @hidden
97
- */
98
- export declare type QuerySpecsResponse = {
99
- readonly success: true;
100
- readonly blockQueryId: BlockQueryId;
101
- } | {
102
- readonly success: false;
103
- };
104
- /**
105
- * An id returned from airtable for an active and executing query. If two queries sent
106
- * to airtable return the same queryId this means the queries are semantically the same.
107
- * It is however possible for two canonically identical queries to be tracked via two
108
- * separate blockQueryIds (in the case realtime subscriptions are made with different
109
- * callbacks).
110
- *
111
- * @hidden
112
- */
113
- export declare type BlockQueryId = string;
114
- /** @hidden */
115
- export declare enum BlockQuerySubscriptionChangeType {
116
- ADDED_RECORD_IDS = "addedRecordIds",
117
- REMOVED_RECORD_IDS = "removedRecordIds",
118
- MODIFIED_CELL_VALUES_FOR_TABLE = "modifiedCellValuesForTable",
119
- CHANGED_COLORS_BY_RECORD_ID_FOR_VIEW = "changedColorsByRecordIdForView"
120
- }
121
- /** @hidden */
122
- export declare type BlockQuerySubscriptionChange = {
123
- type: BlockQuerySubscriptionChangeType.ADDED_RECORD_IDS | BlockQuerySubscriptionChangeType.REMOVED_RECORD_IDS;
124
- tableId: TableId;
125
- recordIds: Array<RecordId>;
126
- } | {
127
- type: BlockQuerySubscriptionChangeType.MODIFIED_CELL_VALUES_FOR_TABLE;
128
- tableId: TableId;
129
- fieldIdsByRecordId: ObjectMap<RecordId, Array<FieldId>>;
130
- fieldIds: Array<FieldId>;
131
- } | {
132
- type: BlockQuerySubscriptionChangeType.CHANGED_COLORS_BY_RECORD_ID_FOR_VIEW;
133
- tableId: TableId;
134
- viewId: ViewId;
135
- recordIds: Array<RecordId>;
136
- };
137
- /** @hidden */
138
- export declare type BlockQuerySubscriptionOnChangeCallback = (changes: Array<BlockQuerySubscriptionChange>) => void;
139
- //# sourceMappingURL=block_query_spec.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"block_query_spec.d.ts","sourceRoot":"","sources":["../../../../src/types/block_query_spec.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,SAAS,EAAC,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAC,OAAO,EAAC,MAAM,SAAS,CAAC;AAChC,OAAO,EAAC,MAAM,EAAC,MAAM,QAAQ,CAAC;AAC9B,OAAO,EAAC,QAAQ,EAAC,MAAM,UAAU,CAAC;AAClC,OAAO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AAC;CAC9B,CAAC;AAER,cAAc;AACd,oBAAY,sCAAsC,GAAG,CACjD,OAAO,EAAE,KAAK,CAAC,4BAA4B,CAAC,KAC3C,IAAI,CAAC"}
@@ -1,2 +0,0 @@
1
- export {};
2
- //# sourceMappingURL=fixture_data.test.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"fixture_data.test.d.ts","sourceRoot":"","sources":["../../../../test/testing/fixture_data.test.ts"],"names":[],"mappings":""}