@dereekb/firebase 5.2.0 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (106) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/package.json +5 -5
  3. package/src/lib/client/firestore/driver.accessor.js +1 -0
  4. package/src/lib/client/firestore/driver.accessor.js.map +1 -1
  5. package/src/lib/client/firestore/driver.query.js +5 -1
  6. package/src/lib/client/firestore/driver.query.js.map +1 -1
  7. package/src/lib/client/function/function.callable.d.ts +13 -0
  8. package/src/lib/client/function/function.callable.js +22 -0
  9. package/src/lib/client/function/function.callable.js.map +1 -0
  10. package/src/lib/client/function/index.d.ts +2 -0
  11. package/src/lib/client/function/index.js +2 -0
  12. package/src/lib/client/function/index.js.map +1 -1
  13. package/src/lib/client/function/model.function.factory.d.ts +36 -0
  14. package/src/lib/client/function/model.function.factory.js +37 -0
  15. package/src/lib/client/function/model.function.factory.js.map +1 -0
  16. package/src/lib/common/auth/auth.context.d.ts +33 -0
  17. package/src/lib/common/auth/auth.context.js +3 -0
  18. package/src/lib/common/auth/auth.context.js.map +1 -0
  19. package/src/lib/common/auth/auth.d.ts +9 -0
  20. package/src/lib/common/auth/index.d.ts +1 -0
  21. package/src/lib/common/auth/index.js +1 -0
  22. package/src/lib/common/auth/index.js.map +1 -1
  23. package/src/lib/common/firestore/accessor/document.d.ts +24 -8
  24. package/src/lib/common/firestore/accessor/document.js +17 -9
  25. package/src/lib/common/firestore/accessor/document.js.map +1 -1
  26. package/src/lib/common/firestore/collection/collection.d.ts +60 -0
  27. package/src/lib/common/firestore/collection/collection.js +14 -1
  28. package/src/lib/common/firestore/collection/collection.js.map +1 -1
  29. package/src/lib/common/firestore/driver/accessor.d.ts +2 -0
  30. package/src/lib/common/firestore/driver/query.d.ts +4 -2
  31. package/src/lib/common/firestore/driver/query.handler.d.ts +1 -1
  32. package/src/lib/common/firestore/driver/query.handler.js +3 -2
  33. package/src/lib/common/firestore/driver/query.handler.js.map +1 -1
  34. package/src/lib/common/firestore/query/constraint.d.ts +21 -3
  35. package/src/lib/common/firestore/query/constraint.js +20 -2
  36. package/src/lib/common/firestore/query/constraint.js.map +1 -1
  37. package/src/lib/common/firestore/query/constraint.template.d.ts +16 -0
  38. package/src/lib/common/firestore/query/constraint.template.js +27 -0
  39. package/src/lib/common/firestore/query/constraint.template.js.map +1 -0
  40. package/src/lib/common/firestore/query/index.d.ts +1 -0
  41. package/src/lib/common/firestore/query/index.js +1 -0
  42. package/src/lib/common/firestore/query/index.js.map +1 -1
  43. package/src/lib/common/firestore/reference.d.ts +7 -1
  44. package/src/lib/common/firestore/types.d.ts +8 -5
  45. package/src/lib/common/firestore/types.js.map +1 -1
  46. package/src/lib/common/index.d.ts +1 -0
  47. package/src/lib/common/index.js +1 -0
  48. package/src/lib/common/index.js.map +1 -1
  49. package/src/lib/common/model/context.d.ts +16 -0
  50. package/src/lib/common/model/context.js +3 -0
  51. package/src/lib/common/model/context.js.map +1 -0
  52. package/src/lib/common/model/function.d.ts +15 -0
  53. package/src/lib/common/model/function.js +12 -0
  54. package/src/lib/common/model/function.js.map +1 -0
  55. package/src/lib/common/model/index.d.ts +5 -0
  56. package/src/lib/common/model/index.js +9 -0
  57. package/src/lib/common/model/index.js.map +1 -0
  58. package/src/lib/common/model/model/index.d.ts +1 -0
  59. package/src/lib/common/model/model/index.js +5 -0
  60. package/src/lib/common/model/model/index.js.map +1 -0
  61. package/src/lib/common/model/model/model.loader.d.ts +30 -0
  62. package/src/lib/common/model/model/model.loader.js +21 -0
  63. package/src/lib/common/model/model/model.loader.js.map +1 -0
  64. package/src/lib/common/model/model.service.d.ts +56 -0
  65. package/src/lib/common/model/model.service.js +111 -0
  66. package/src/lib/common/model/model.service.js.map +1 -0
  67. package/src/lib/common/model/permission/index.d.ts +4 -0
  68. package/src/lib/common/model/permission/index.js +8 -0
  69. package/src/lib/common/model/permission/index.js.map +1 -0
  70. package/src/lib/common/model/permission/permission.context.d.ts +9 -0
  71. package/src/lib/common/model/permission/permission.context.js +3 -0
  72. package/src/lib/common/model/permission/permission.context.js.map +1 -0
  73. package/src/lib/common/model/permission/permission.d.ts +11 -0
  74. package/src/lib/common/model/permission/permission.js +3 -0
  75. package/src/lib/common/model/permission/permission.js.map +1 -0
  76. package/src/lib/common/model/permission/permission.service.d.ts +24 -0
  77. package/src/lib/common/model/permission/permission.service.js +48 -0
  78. package/src/lib/common/model/permission/permission.service.js.map +1 -0
  79. package/src/lib/common/model/permission/permission.service.role.d.ts +40 -0
  80. package/src/lib/common/model/permission/permission.service.role.js +70 -0
  81. package/src/lib/common/model/permission/permission.service.role.js.map +1 -0
  82. package/test/CHANGELOG.md +27 -0
  83. package/test/package.json +7 -7
  84. package/test/src/lib/common/firestore.d.ts +3 -3
  85. package/test/src/lib/common/firestore.js +2 -2
  86. package/test/src/lib/common/firestore.mock.item.d.ts +43 -16
  87. package/test/src/lib/common/firestore.mock.item.fixture.d.ts +3 -1
  88. package/test/src/lib/common/firestore.mock.item.fixture.js +12 -6
  89. package/test/src/lib/common/firestore.mock.item.fixture.js.map +1 -1
  90. package/test/src/lib/common/firestore.mock.item.js +85 -27
  91. package/test/src/lib/common/firestore.mock.item.js.map +1 -1
  92. package/test/src/lib/common/firestore.mock.item.query.d.ts +20 -1
  93. package/test/src/lib/common/firestore.mock.item.query.js +22 -1
  94. package/test/src/lib/common/firestore.mock.item.query.js.map +1 -1
  95. package/test/src/lib/common/firestore.mock.item.service.d.ts +40 -0
  96. package/test/src/lib/common/firestore.mock.item.service.js +62 -0
  97. package/test/src/lib/common/firestore.mock.item.service.js.map +1 -0
  98. package/test/src/lib/common/index.d.ts +1 -0
  99. package/test/src/lib/common/index.js +1 -0
  100. package/test/src/lib/common/index.js.map +1 -1
  101. package/test/src/lib/common/test.driver.accessor.js +77 -24
  102. package/test/src/lib/common/test.driver.accessor.js.map +1 -1
  103. package/test/src/lib/common/test.driver.query.js +138 -75
  104. package/test/src/lib/common/test.driver.query.js.map +1 -1
  105. package/test/src/lib/common/test.iterator.js +1 -0
  106. package/test/src/lib/common/test.iterator.js.map +1 -1
@@ -2,27 +2,33 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.testWithMockItemFixture = exports.MockItemCollectionFixture = exports.MockItemCollectionFixtureInstance = void 0;
4
4
  const test_1 = require("@dereekb/util/test");
5
- const firestore_mock_item_1 = require("./firestore.mock.item");
5
+ const firestore_mock_item_service_1 = require("./firestore.mock.item.service");
6
6
  // MARK: Test Item Testing Fixture
7
7
  class MockItemCollectionFixtureInstance {
8
8
  constructor(fixture) {
9
9
  this.fixture = fixture;
10
- this.collections = (0, firestore_mock_item_1.makeMockItemCollections)(this.fixture.parent.context);
10
+ this.collections = (0, firestore_mock_item_service_1.makeMockItemCollections)(this.fixture.parent.context);
11
11
  }
12
12
  get collection() {
13
13
  return this.firestoreCollection.collection;
14
14
  }
15
15
  get firestoreCollection() {
16
- return this.collections.mockItem;
16
+ return this.collections.mockItemCollection;
17
17
  }
18
18
  get mockItemPrivateCollection() {
19
- return this.collections.mockItemPrivate;
19
+ return this.collections.mockItemPrivateCollectionFactory;
20
20
  }
21
21
  get mockItemSubItemCollection() {
22
- return this.collections.mockItemSubItem;
22
+ return this.collections.mockItemSubItemCollectionFactory;
23
23
  }
24
24
  get mockItemSubItemCollectionGroup() {
25
- return this.collections.mockItemSubItemGroup;
25
+ return this.collections.mockItemSubItemCollectionGroup;
26
+ }
27
+ get mockItemDeepSubItemCollection() {
28
+ return this.collections.mockItemDeepSubItemCollectionFactory;
29
+ }
30
+ get mockItemDeepSubItemCollectionGroup() {
31
+ return this.collections.mockItemDeepSubItemCollectionGroup;
26
32
  }
27
33
  }
28
34
  exports.MockItemCollectionFixtureInstance = MockItemCollectionFixtureInstance;
@@ -1 +1 @@
1
- {"version":3,"file":"firestore.mock.item.fixture.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.fixture.ts"],"names":[],"mappings":";;;AACA,6CAAkJ;AAClJ,+DAAuG;AAGvG,kCAAkC;AAClC,MAAa,iCAAiC;IAsB5C,YAAqB,OAAkC;QAAlC,YAAO,GAAP,OAAO,CAA2B;QArB9C,gBAAW,GAAG,IAAA,6CAAuB,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAqBlB,CAAC;IAnB3D,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,mBAAmB,CAAC,UAAU,CAAC;IAC7C,CAAC;IACD,IAAI,mBAAmB;QACrB,OAAO,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC;IACnC,CAAC;IAED,IAAI,yBAAyB;QAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;IAC1C,CAAC;IAED,IAAI,yBAAyB;QAC3B,OAAO,IAAI,CAAC,WAAW,CAAC,eAAe,CAAC;IAC1C,CAAC;IAED,IAAI,8BAA8B;QAChC,OAAO,IAAI,CAAC,WAAW,CAAC,oBAAoB,CAAC;IAC/C,CAAC;CAGF;AAvBD,8EAuBC;AAED;;GAEG;AACH,MAAa,yBAA0B,SAAQ,yCAAkG;CAAG;AAApJ,8DAAoJ;AAIpJ,SAAgB,uBAAuB,CAAC,MAAgD;IACtF,OAAO,IAAA,yCAAkC,EAAC;QACxC,WAAW,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,IAAI,yBAAyB,CAAC,OAAO,CAAC;QAChE,YAAY,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,iCAAiC,CAAC,IAAI,CAAC;QACnE,gBAAgB,EAAE,CAAC,QAA2C,EAAE,EAAE;YAChE,qDAAqD;QACvD,CAAC;QACD,sEAAsE;KACvE,CAAC,CAAC;AACL,CAAC;AATD,0DASC"}
1
+ {"version":3,"file":"firestore.mock.item.fixture.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.fixture.ts"],"names":[],"mappings":";;;AACA,6CAAkJ;AAGlJ,+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D,0DASC"}
@@ -1,15 +1,16 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeMockItemCollections = exports.MockItemCollections = exports.mockItemSubItemFirestoreCollectionGroup = exports.mockItemSubItemCollectionReference = exports.mockItemSubItemFirestoreCollection = exports.mockItemSubItemCollectionReferenceFactory = exports.mockItemSubItemConverter = exports.mockItemSubItemCollectionPath = exports.MockItemSubItemDocument = exports.mockItemPrivateFirestoreCollection = exports.mockItemPrivateCollectionReferenceFactory = exports.mockItemPrivateConverter = exports.mockItemPrivateIdentifier = exports.mockItemPrivateCollectionPath = exports.MockItemPrivateDocument = exports.mockItemFirestoreCollection = exports.mockItemCollectionReference = exports.mockItemConverter = exports.mockItemCollectionPath = exports.MockItemDocument = void 0;
3
+ exports.mockItemDeepSubItemFirestoreCollectionGroup = exports.mockItemDeepSubItemCollectionReference = exports.mockItemDeepSubItemFirestoreCollection = exports.mockItemDeepSubItemCollectionReferenceFactory = exports.mockItemDeepSubItemConverter = exports.MockItemDeepSubItemDocument = exports.mockItemDeepSubItemIdentity = exports.mockItemSubItemFirestoreCollectionGroup = exports.mockItemSubItemCollectionReference = exports.mockItemSubItemFirestoreCollection = exports.mockItemSubItemCollectionReferenceFactory = exports.mockItemSubItemConverter = exports.MockItemSubItemDocument = exports.mockItemSubItemIdentity = exports.mockItemPrivateFirestoreCollectionGroup = exports.mockItemPrivateCollectionReference = exports.mockItemPrivateFirestoreCollection = exports.mockItemPrivateCollectionReferenceFactory = exports.mockItemPrivateConverter = exports.mockItemPrivateIdentifier = exports.mockItemPrivateCollectionName = exports.MockItemPrivateDocument = exports.mockItemPrivateIdentity = exports.mockItemFirestoreCollection = exports.mockItemCollectionReference = exports.mockItemConverter = exports.MockItemDocument = exports.mockItemIdentity = void 0;
4
4
  const util_1 = require("@dereekb/util");
5
5
  const firebase_1 = require("@dereekb/firebase");
6
+ // MARK: Mock Item
7
+ exports.mockItemIdentity = (0, firebase_1.firestoreModelIdentity)('mockItem');
6
8
  class MockItemDocument extends firebase_1.AbstractFirestoreDocument {
9
+ get modelIdentity() {
10
+ return exports.mockItemIdentity;
11
+ }
7
12
  }
8
13
  exports.MockItemDocument = MockItemDocument;
9
- /**
10
- * Firestore collection path name.
11
- */
12
- exports.mockItemCollectionPath = 'test';
13
14
  /**
14
15
  * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
15
16
  */
@@ -26,7 +27,7 @@ exports.mockItemConverter = (0, firebase_1.snapshotConverterFunctions)({
26
27
  * @returns
27
28
  */
28
29
  function mockItemCollectionReference(context) {
29
- return context.collection(exports.mockItemCollectionPath).withConverter(exports.mockItemConverter);
30
+ return context.collection(exports.mockItemIdentity.collection).withConverter(exports.mockItemConverter);
30
31
  }
31
32
  exports.mockItemCollectionReference = mockItemCollectionReference;
32
33
  function mockItemFirestoreCollection(firestoreContext) {
@@ -38,16 +39,21 @@ function mockItemFirestoreCollection(firestoreContext) {
38
39
  });
39
40
  }
40
41
  exports.mockItemFirestoreCollection = mockItemFirestoreCollection;
42
+ // MARK: MockItemPrivate
43
+ exports.mockItemPrivateIdentity = (0, firebase_1.firestoreModelIdentity)('mockItemPrivate');
41
44
  /**
42
45
  * FirestoreDocument for MockItem
43
46
  */
44
47
  class MockItemPrivateDocument extends firebase_1.AbstractFirestoreDocument {
48
+ get modelIdentity() {
49
+ return exports.mockItemPrivateIdentity;
50
+ }
45
51
  }
46
52
  exports.MockItemPrivateDocument = MockItemPrivateDocument;
47
53
  /**
48
54
  * Firestore collection path name.
49
55
  */
50
- exports.mockItemPrivateCollectionPath = 'private';
56
+ exports.mockItemPrivateCollectionName = 'mockitemprivate';
51
57
  exports.mockItemPrivateIdentifier = '0';
52
58
  /**
53
59
  * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
@@ -66,7 +72,7 @@ exports.mockItemPrivateConverter = (0, firebase_1.snapshotConverterFunctions)({
66
72
  */
67
73
  function mockItemPrivateCollectionReferenceFactory(context) {
68
74
  return (parent) => {
69
- return context.subcollection(parent.documentRef, exports.mockItemPrivateCollectionPath).withConverter(exports.mockItemPrivateConverter);
75
+ return context.subcollection(parent.documentRef, exports.mockItemPrivateCollectionName).withConverter(exports.mockItemPrivateConverter);
70
76
  };
71
77
  }
72
78
  exports.mockItemPrivateCollectionReferenceFactory = mockItemPrivateCollectionReferenceFactory;
@@ -84,16 +90,30 @@ function mockItemPrivateFirestoreCollection(firestoreContext) {
84
90
  };
85
91
  }
86
92
  exports.mockItemPrivateFirestoreCollection = mockItemPrivateFirestoreCollection;
93
+ function mockItemPrivateCollectionReference(context) {
94
+ return context.collectionGroup(exports.mockItemPrivateCollectionName).withConverter(exports.mockItemPrivateConverter);
95
+ }
96
+ exports.mockItemPrivateCollectionReference = mockItemPrivateCollectionReference;
97
+ function mockItemPrivateFirestoreCollectionGroup(firestoreContext) {
98
+ return firestoreContext.firestoreCollectionGroup({
99
+ itemsPerPage: 50,
100
+ queryLike: mockItemPrivateCollectionReference(firestoreContext),
101
+ makeDocument: (accessor, documentAccessor) => new MockItemPrivateDocument(accessor, documentAccessor),
102
+ firestoreContext
103
+ });
104
+ }
105
+ exports.mockItemPrivateFirestoreCollectionGroup = mockItemPrivateFirestoreCollectionGroup;
106
+ // MARK: MockItemSubItem
107
+ exports.mockItemSubItemIdentity = (0, firebase_1.firestoreModelIdentity)('mockItemSub');
87
108
  /**
88
109
  * FirestoreDocument for MockItem
89
110
  */
90
111
  class MockItemSubItemDocument extends firebase_1.AbstractFirestoreDocumentWithParent {
112
+ get modelIdentity() {
113
+ return exports.mockItemSubItemIdentity;
114
+ }
91
115
  }
92
116
  exports.MockItemSubItemDocument = MockItemSubItemDocument;
93
- /**
94
- * Firestore collection path name.
95
- */
96
- exports.mockItemSubItemCollectionPath = 'sub';
97
117
  /**
98
118
  * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
99
119
  */
@@ -104,7 +124,7 @@ exports.mockItemSubItemConverter = (0, firebase_1.snapshotConverterFunctions)({
104
124
  });
105
125
  function mockItemSubItemCollectionReferenceFactory(context) {
106
126
  return (parent) => {
107
- return context.subcollection(parent.documentRef, exports.mockItemSubItemCollectionPath).withConverter(exports.mockItemSubItemConverter);
127
+ return context.subcollection(parent.documentRef, exports.mockItemSubItemIdentity.collection).withConverter(exports.mockItemSubItemConverter);
108
128
  };
109
129
  }
110
130
  exports.mockItemSubItemCollectionReferenceFactory = mockItemSubItemCollectionReferenceFactory;
@@ -114,7 +134,7 @@ function mockItemSubItemFirestoreCollection(firestoreContext) {
114
134
  return firestoreContext.firestoreCollectionWithParent({
115
135
  itemsPerPage: 50,
116
136
  collection: factory(parent),
117
- makeDocument: (a, d) => new MockItemSubItemDocument(parent.documentRef, a, d),
137
+ makeDocument: (a, d) => new MockItemSubItemDocument(a, d),
118
138
  firestoreContext,
119
139
  parent
120
140
  });
@@ -122,29 +142,67 @@ function mockItemSubItemFirestoreCollection(firestoreContext) {
122
142
  }
123
143
  exports.mockItemSubItemFirestoreCollection = mockItemSubItemFirestoreCollection;
124
144
  function mockItemSubItemCollectionReference(context) {
125
- return context.collectionGroup(exports.mockItemSubItemCollectionPath).withConverter(exports.mockItemSubItemConverter);
145
+ return context.collectionGroup(exports.mockItemSubItemIdentity.collection).withConverter(exports.mockItemSubItemConverter);
126
146
  }
127
147
  exports.mockItemSubItemCollectionReference = mockItemSubItemCollectionReference;
128
148
  function mockItemSubItemFirestoreCollectionGroup(firestoreContext) {
129
149
  return firestoreContext.firestoreCollectionGroup({
130
150
  itemsPerPage: 50,
131
151
  queryLike: mockItemSubItemCollectionReference(firestoreContext),
132
- makeDocument: (accessor, documentAccessor) => new MockItemSubItemDocument(undefined, accessor, documentAccessor),
152
+ makeDocument: (accessor, documentAccessor) => new MockItemSubItemDocument(accessor, documentAccessor),
133
153
  firestoreContext
134
154
  });
135
155
  }
136
156
  exports.mockItemSubItemFirestoreCollectionGroup = mockItemSubItemFirestoreCollectionGroup;
137
- // MARK: Collection
138
- class MockItemCollections {
139
- }
140
- exports.MockItemCollections = MockItemCollections;
141
- function makeMockItemCollections(firestoreContext) {
142
- return {
143
- mockItem: mockItemFirestoreCollection(firestoreContext),
144
- mockItemPrivate: mockItemPrivateFirestoreCollection(firestoreContext),
145
- mockItemSubItem: mockItemSubItemFirestoreCollection(firestoreContext),
146
- mockItemSubItemGroup: mockItemSubItemFirestoreCollectionGroup(firestoreContext)
157
+ // MARK: Sub-Sub Item
158
+ exports.mockItemDeepSubItemIdentity = (0, firebase_1.firestoreModelIdentity)('mockItemDeepSub');
159
+ /**
160
+ * FirestoreDocument for MockSubItem
161
+ */
162
+ class MockItemDeepSubItemDocument extends firebase_1.AbstractFirestoreDocumentWithParent {
163
+ get modelIdentity() {
164
+ return exports.mockItemDeepSubItemIdentity;
165
+ }
166
+ }
167
+ exports.MockItemDeepSubItemDocument = MockItemDeepSubItemDocument;
168
+ /**
169
+ * Used to build a FirestoreDataConverter. Fields are configured via configuration. See the SnapshotConverterFunctions for more info.
170
+ */
171
+ exports.mockItemDeepSubItemConverter = (0, firebase_1.snapshotConverterFunctions)({
172
+ fields: {
173
+ value: (0, firebase_1.optionalFirestoreNumber)()
174
+ }
175
+ });
176
+ function mockItemDeepSubItemCollectionReferenceFactory(context) {
177
+ return (parent) => {
178
+ return context.subcollection(parent.documentRef, exports.mockItemDeepSubItemIdentity.collection).withConverter(exports.mockItemDeepSubItemConverter);
147
179
  };
148
180
  }
149
- exports.makeMockItemCollections = makeMockItemCollections;
181
+ exports.mockItemDeepSubItemCollectionReferenceFactory = mockItemDeepSubItemCollectionReferenceFactory;
182
+ function mockItemDeepSubItemFirestoreCollection(firestoreContext) {
183
+ const factory = mockItemDeepSubItemCollectionReferenceFactory(firestoreContext);
184
+ return (parent) => {
185
+ return firestoreContext.firestoreCollectionWithParent({
186
+ itemsPerPage: 50,
187
+ collection: factory(parent),
188
+ makeDocument: (a, d) => new MockItemDeepSubItemDocument(a, d),
189
+ firestoreContext,
190
+ parent
191
+ });
192
+ };
193
+ }
194
+ exports.mockItemDeepSubItemFirestoreCollection = mockItemDeepSubItemFirestoreCollection;
195
+ function mockItemDeepSubItemCollectionReference(context) {
196
+ return context.collectionGroup(exports.mockItemDeepSubItemIdentity.collection).withConverter(exports.mockItemDeepSubItemConverter);
197
+ }
198
+ exports.mockItemDeepSubItemCollectionReference = mockItemDeepSubItemCollectionReference;
199
+ function mockItemDeepSubItemFirestoreCollectionGroup(firestoreContext) {
200
+ return firestoreContext.firestoreCollectionGroup({
201
+ itemsPerPage: 50,
202
+ queryLike: mockItemDeepSubItemCollectionReference(firestoreContext),
203
+ makeDocument: (accessor, documentAccessor) => new MockItemDeepSubItemDocument(accessor, documentAccessor),
204
+ firestoreContext
205
+ });
206
+ }
207
+ exports.mockItemDeepSubItemFirestoreCollectionGroup = mockItemDeepSubItemFirestoreCollectionGroup;
150
208
  //# sourceMappingURL=firestore.mock.item.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firestore.mock.item.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.ts"],"names":[],"mappings":";;;AAAA,wCAA6D;AAC7D,gDAAwb;AAexb,MAAa,gBAAiB,SAAQ,oCAAqD;CAAG;AAA9F,4CAA8F;AAiB9F;;GAEG;AACU,QAAA,sBAAsB,GAAG,MAAM,CAAC;AAE7C;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,qCAA0B,EAAyB;IAClF,MAAM,EAAE;QACN,KAAK,EAAE,IAAA,kCAAuB,GAAE;QAChC,IAAI,EAAE,IAAA,2BAAgB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC;KAC1C;CACF,CAAC,CAAC;AAEH;;;;;GAKG;AACH,SAAgB,2BAA2B,CAAC,OAAyB;IACnE,OAAO,OAAO,CAAC,UAAU,CAAC,8BAAsB,CAAC,CAAC,aAAa,CAAW,yBAAiB,CAAC,CAAC;AAC/F,CAAC;AAFD,kEAEC;AA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aAAa,CAAkB,gCAAwB,CAAC,CAAC;AACzH,CAAC;AAFD,gFAEC;AAID,SAAgB,uCAAuC,CAAC,gBAAkC;IACxF,OAAO,gBAAgB,CAAC,wBAAwB,CAAC;QAC/C,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,kCAAkC,CAAC,gBAAgB,CAAC;QAC/D,YAAY,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,CAAC,IAAI,uBAAuB,CAAC,SAAS,EAAE,QAAQ,EAAE,gBAAgB,CAAC;QAChH,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAPD,0FAOC;AAED,mBAAmB;AACnB,MAAsB,mBAAmB;CAKxC;AALD,kDAKC;AAED,SAAgB,uBAAuB,CAAC,gBAAkC;IACxE,OAAO;QACL,QAAQ,EAAE,2BAA2B,CAAC,gBAAgB,CAAC;QACvD,eAAe,EAAE,kCAAkC,CAAC,gBAAgB,CAAC;QACrE,eAAe,EAAE,kCAAkC,CAAC,gBAAgB,CAAC;QACrE,oBAAoB,EAAE,uCAAuC,CAAC,gBAAgB,CAAC;KAChF,CAAC;AACJ,CAAC;AAPD,0DAOC"}
1
+ {"version":3,"file":"firestore.mock.item.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.ts"],"names":[],"mappings":";;;AAAA,wCAA6D;AAC7D,gDAAud;AAMvd,kBAAkB;AACL,QAAA,gBAAgB,GAAG,IAAA,iCAAsB,EAAC,UAAU,CAAC,CAAC;AAgBnE,MAAa,gBAAiB,SAAQ,oCAAqD;IACzF,IAAI,aAAa;QACf,OAAO,wBAAgB,CAAC;IAC1B,CAAC;CACF;AAJD,4CAIC;AAiBD;;GAEG;AACU,QAAA,iBAAiB,GAAG,IAAA,qCAA0B,EAAyB;IAClF,MAAM,EAAE;QACN,KAAK,EAAE,IAAA,kCAAuB,GAAE;QAChC,IAAI,EAAE,IAAA,2BAAgB,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,C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AC,gBAAkC;IAC5F,OAAO,gBAAgB,CAAC,wBAAwB,CAAC;QAC/C,YAAY,EAAE,EAAE;QAChB,SAAS,EAAE,sCAAsC,CAAC,gBAAgB,CAAC;QACnE,YAAY,EAAE,CAAC,QAAQ,EAAE,gBAAgB,EAAE,EAAE,CAAC,IAAI,2BAA2B,CAAC,QAAQ,EAAE,gBAAgB,CAAC;QACzG,gBAAgB;KACjB,CAAC,CAAC;AACL,CAAC;AAPD,kGAOC"}
@@ -1,3 +1,22 @@
1
- import { FirestoreQueryConstraint } from '@dereekb/firebase';
1
+ import { MockItem } from './firestore.mock.item';
2
+ import { FirestoreQueryConstraint, DocumentReference } from '@dereekb/firebase';
2
3
  export declare function mockItemWithValue(value: string): FirestoreQueryConstraint;
3
4
  export declare function mockItemWithTestValue(test: boolean): FirestoreQueryConstraint;
5
+ /**
6
+ * This sorts all fields by their document ID, then filters in between two specific document id paths in order to only return values between a specific path.
7
+ *
8
+ * Visual Example:
9
+ *
10
+ * /a/b/c/c/a
11
+ * /a/b/c/d/A
12
+ * /a/b/c/d/B
13
+ * /a/b/c/d/C
14
+ * /a/b/c/e/a
15
+ *
16
+ * From:
17
+ * https://medium.com/firebase-developers/how-to-query-collections-in-firestore-under-a-certain-path-6a0d686cebd2
18
+ *
19
+ * @param parent
20
+ * @returns
21
+ */
22
+ export declare function allChildMockItemDeepSubItemsWithinMockItem(mockItem: DocumentReference<MockItem>): FirestoreQueryConstraint[];
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.mockItemWithTestValue = exports.mockItemWithValue = void 0;
3
+ exports.allChildMockItemDeepSubItemsWithinMockItem = exports.mockItemWithTestValue = exports.mockItemWithValue = void 0;
4
4
  const firebase_1 = require("@dereekb/firebase");
5
5
  function mockItemWithValue(value) {
6
6
  return (0, firebase_1.where)('value', '==', value);
@@ -10,4 +10,25 @@ function mockItemWithTestValue(test) {
10
10
  return (0, firebase_1.where)('test', '==', test);
11
11
  }
12
12
  exports.mockItemWithTestValue = mockItemWithTestValue;
13
+ /**
14
+ * This sorts all fields by their document ID, then filters in between two specific document id paths in order to only return values between a specific path.
15
+ *
16
+ * Visual Example:
17
+ *
18
+ * /a/b/c/c/a
19
+ * /a/b/c/d/A
20
+ * /a/b/c/d/B
21
+ * /a/b/c/d/C
22
+ * /a/b/c/e/a
23
+ *
24
+ * From:
25
+ * https://medium.com/firebase-developers/how-to-query-collections-in-firestore-under-a-certain-path-6a0d686cebd2
26
+ *
27
+ * @param parent
28
+ * @returns
29
+ */
30
+ function allChildMockItemDeepSubItemsWithinMockItem(mockItem) {
31
+ return (0, firebase_1.allChildDocumentsUnderParent)(mockItem);
32
+ }
33
+ exports.allChildMockItemDeepSubItemsWithinMockItem = allChildMockItemDeepSubItemsWithinMockItem;
13
34
  //# sourceMappingURL=firestore.mock.item.query.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"firestore.mock.item.query.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.query.ts"],"names":[],"mappings":";;;AACA,gDAAoE;AAEpE,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO,IAAA,gBAAK,EAAW,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAFD,8CAEC;AAED,SAAgB,qBAAqB,CAAC,IAAa;IACjD,OAAO,IAAA,gBAAK,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAFD,sDAEC"}
1
+ {"version":3,"file":"firestore.mock.item.query.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.query.ts"],"names":[],"mappings":";;;AACA,gDAAqH;AAErH,SAAgB,iBAAiB,CAAC,KAAa;IAC7C,OAAO,IAAA,gBAAK,EAAW,OAAO,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAFD,8CAEC;AAED,SAAgB,qBAAqB,CAAC,IAAa;IACjD,OAAO,IAAA,gBAAK,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AACnC,CAAC;AAFD,sDAEC;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,SAAgB,0CAA0C,CAAC,QAAqC;IAC9F,OAAO,IAAA,uCAA4B,EAAC,QAAQ,CAAC,CAAC;AAChD,CAAC;AAFD,gGAEC"}
@@ -0,0 +1,40 @@
1
+ import { MockItem, MockItemDeepSubItem, MockItemDeepSubItemDocument, MockItemDeepSubItemFirestoreCollectionFactory, MockItemDeepSubItemFirestoreCollectionGroup, MockItemDeepSubItemRoles, MockItemDocument, MockItemFirestoreCollection, MockItemPrivate, MockItemPrivateDocument, MockItemPrivateFirestoreCollectionFactory, MockItemPrivateFirestoreCollectionGroup, MockItemPrivateRoles, MockItemRoles, MockItemSubItem, MockItemSubItemDocument, MockItemSubItemFirestoreCollectionFactory, MockItemSubItemFirestoreCollectionGroup, MockItemSubItemRoles, MockItemTypes } from './firestore.mock.item';
2
+ import { FirebaseAppModelContext, FirestoreContext } from '@dereekb/firebase';
3
+ import { GrantedRoleMap } from '@dereekb/model';
4
+ export declare abstract class MockItemCollections {
5
+ abstract readonly mockItemCollection: MockItemFirestoreCollection;
6
+ abstract readonly mockItemPrivateCollectionFactory: MockItemPrivateFirestoreCollectionFactory;
7
+ abstract readonly mockItemPrivateCollectionGroup: MockItemPrivateFirestoreCollectionGroup;
8
+ abstract readonly mockItemSubItemCollectionFactory: MockItemSubItemFirestoreCollectionFactory;
9
+ abstract readonly mockItemSubItemCollectionGroup: MockItemSubItemFirestoreCollectionGroup;
10
+ abstract readonly mockItemDeepSubItemCollectionFactory: MockItemDeepSubItemFirestoreCollectionFactory;
11
+ abstract readonly mockItemDeepSubItemCollectionGroup: MockItemDeepSubItemFirestoreCollectionGroup;
12
+ }
13
+ export declare function makeMockItemCollections(firestoreContext: FirestoreContext): MockItemCollections;
14
+ export declare const mockItemFirebaseModelServiceFactory: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItem, MockItemDocument, MockItemRoles>;
15
+ export declare const mockItemPrivateFirebaseModelServiceFactory: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemPrivate, MockItemPrivateDocument, MockItemPrivateRoles>;
16
+ export declare const mockItemSubItemFirebaseModelServiceFactory: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemSubItem, MockItemSubItemDocument, MockItemSubItemRoles>;
17
+ export declare const mockItemDeepSubItemFirebaseModelServiceFactory: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemDeepSubItem, MockItemDeepSubItemDocument, MockItemDeepSubItemRoles>;
18
+ export declare type MockModelTypes = MockItemTypes;
19
+ export declare type MockFirebaseContextAppContext = MockItemCollections;
20
+ export declare type MockFirebaseBaseContext = FirebaseAppModelContext<MockFirebaseContextAppContext> & {
21
+ /**
22
+ * Configured in the context and in mockItem role map functions to return this value if provided.
23
+ */
24
+ rolesToReturn?: GrantedRoleMap<any>;
25
+ };
26
+ export declare const MOCK_FIREBASE_MODEL_SERVICE_FACTORIES: {
27
+ mockItem: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItem, MockItemDocument, MockItemRoles>;
28
+ mockItemPrivate: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemPrivate, MockItemPrivateDocument, MockItemPrivateRoles>;
29
+ mockItemSub: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemSubItem, MockItemSubItemDocument, MockItemSubItemRoles>;
30
+ mockItemDeepSub: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemDeepSubItem, MockItemDeepSubItemDocument, MockItemDeepSubItemRoles>;
31
+ };
32
+ export declare const mockFirebaseModelServices: import("@dereekb/firebase").FirebaseModelsService<{
33
+ mockItem: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItem, MockItemDocument, MockItemRoles>;
34
+ mockItemPrivate: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemPrivate, MockItemPrivateDocument, MockItemPrivateRoles>;
35
+ mockItemSub: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemSubItem, MockItemSubItemDocument, MockItemSubItemRoles>;
36
+ mockItemDeepSub: import("@dereekb/firebase").FirebaseModelServiceFactory<MockFirebaseContext, MockItemDeepSubItem, MockItemDeepSubItemDocument, MockItemDeepSubItemRoles>;
37
+ }, MockFirebaseContext>;
38
+ export declare type MockFirebaseContext = MockFirebaseBaseContext & {
39
+ service?: typeof mockFirebaseModelServices;
40
+ };
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mockFirebaseModelServices = exports.MOCK_FIREBASE_MODEL_SERVICE_FACTORIES = exports.mockItemDeepSubItemFirebaseModelServiceFactory = exports.mockItemSubItemFirebaseModelServiceFactory = exports.mockItemPrivateFirebaseModelServiceFactory = exports.mockItemFirebaseModelServiceFactory = exports.makeMockItemCollections = exports.MockItemCollections = void 0;
4
+ const firestore_mock_item_1 = require("./firestore.mock.item");
5
+ const firebase_1 = require("@dereekb/firebase");
6
+ // MARK: Collections
7
+ class MockItemCollections {
8
+ }
9
+ exports.MockItemCollections = MockItemCollections;
10
+ function makeMockItemCollections(firestoreContext) {
11
+ return {
12
+ mockItemCollection: (0, firestore_mock_item_1.mockItemFirestoreCollection)(firestoreContext),
13
+ mockItemPrivateCollectionFactory: (0, firestore_mock_item_1.mockItemPrivateFirestoreCollection)(firestoreContext),
14
+ mockItemPrivateCollectionGroup: (0, firestore_mock_item_1.mockItemPrivateFirestoreCollectionGroup)(firestoreContext),
15
+ mockItemSubItemCollectionFactory: (0, firestore_mock_item_1.mockItemSubItemFirestoreCollection)(firestoreContext),
16
+ mockItemSubItemCollectionGroup: (0, firestore_mock_item_1.mockItemSubItemFirestoreCollectionGroup)(firestoreContext),
17
+ mockItemDeepSubItemCollectionFactory: (0, firestore_mock_item_1.mockItemDeepSubItemFirestoreCollection)(firestoreContext),
18
+ mockItemDeepSubItemCollectionGroup: (0, firestore_mock_item_1.mockItemDeepSubItemFirestoreCollectionGroup)(firestoreContext)
19
+ };
20
+ }
21
+ exports.makeMockItemCollections = makeMockItemCollections;
22
+ // MARK: Models
23
+ exports.mockItemFirebaseModelServiceFactory = (0, firebase_1.firebaseModelServiceFactory)({
24
+ roleMapForModel: function (output, context, model) {
25
+ var _a;
26
+ const roles = (_a = context.rolesToReturn) !== null && _a !== void 0 ? _a : { read: true };
27
+ return roles;
28
+ },
29
+ getFirestoreCollection: (c) => c.app.mockItemCollection
30
+ });
31
+ exports.mockItemPrivateFirebaseModelServiceFactory = (0, firebase_1.firebaseModelServiceFactory)({
32
+ roleMapForModel: function (output, context, model) {
33
+ var _a;
34
+ const roles = (_a = context.rolesToReturn) !== null && _a !== void 0 ? _a : { read: true };
35
+ return roles;
36
+ },
37
+ getFirestoreCollection: (c) => c.app.mockItemPrivateCollectionGroup
38
+ });
39
+ exports.mockItemSubItemFirebaseModelServiceFactory = (0, firebase_1.firebaseModelServiceFactory)({
40
+ roleMapForModel: function (output, context, model) {
41
+ var _a;
42
+ const roles = (_a = context.rolesToReturn) !== null && _a !== void 0 ? _a : { read: true };
43
+ return roles;
44
+ },
45
+ getFirestoreCollection: (c) => c.app.mockItemSubItemCollectionGroup
46
+ });
47
+ exports.mockItemDeepSubItemFirebaseModelServiceFactory = (0, firebase_1.firebaseModelServiceFactory)({
48
+ roleMapForModel: function (output, context, model) {
49
+ var _a;
50
+ const roles = (_a = context.rolesToReturn) !== null && _a !== void 0 ? _a : { read: true };
51
+ return roles;
52
+ },
53
+ getFirestoreCollection: (c) => c.app.mockItemDeepSubItemCollectionGroup
54
+ });
55
+ exports.MOCK_FIREBASE_MODEL_SERVICE_FACTORIES = {
56
+ mockItem: exports.mockItemFirebaseModelServiceFactory,
57
+ mockItemPrivate: exports.mockItemPrivateFirebaseModelServiceFactory,
58
+ mockItemSub: exports.mockItemSubItemFirebaseModelServiceFactory,
59
+ mockItemDeepSub: exports.mockItemDeepSubItemFirebaseModelServiceFactory
60
+ };
61
+ exports.mockFirebaseModelServices = (0, firebase_1.firebaseModelsService)(exports.MOCK_FIREBASE_MODEL_SERVICE_FACTORIES);
62
+ //# sourceMappingURL=firestore.mock.item.service.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"firestore.mock.item.service.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/firestore.mock.item.service.ts"],"names":[],"mappings":";;;AAAA,+DA4B+B;AAC/B,gDAAkK;AAIlK,oBAAoB;AACpB,MAAsB,mBAAmB;CAQxC;AARD,kDAQC;AAED,SAAgB,uBAAuB,CAAC,gBAAkC;IACxE,OAAO;QACL,kBAAkB,EAAE,IAAA,iDAA2B,EAAC,gBAAgB,CAAC;QACjE,gCAAgC,EAAE,IAAA,wDAAkC,EAAC,gBAAgB,CAAC;QACtF,8BAA8B,EAAE,IAAA,6DAAuC,EAAC,gBAAgB,CAAC;QACzF,gCAAgC,EAAE,IAAA,wDAAkC,EAAC,gBAAgB,CAAC;QACtF,8BAA8B,EAAE,IAAA,6DAAuC,EAAC,gBAAgB,CAAC;QACzF,oCAAoC,EAAE,IAAA,4DAAsC,EAAC,gBAAgB,CAAC;QAC9F,kCAAkC,EAAE,IAAA,iEAA2C,EAAC,gBAAgB,CAAC;KAClG,CAAC;AACJ,CAAC;AAVD,0DAUC;AAED,eAAe;AACF,QAAA,mCAAmC,GAAG,IAAA,sCAA2B,EAAiE;IAC7I,eAAe,EAAE,UAAU,MAAkE,EAAE,OAA4B,EAAE,KAAuB;;QAClJ,MAAM,KAAK,GAAkC,MAAA,OAAO,CAAC,aAAa,mCAAI,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;QAErF,OAAO,KAAK,CAAC;IACf,CAAC;IACD,sBAAsB,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,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AAA,gCAAqB,EAAoF,6CAAqC,CAAC,CAAC"}
@@ -1,5 +1,6 @@
1
1
  export * from './firestore.mock.item.fixture';
2
2
  export * from './firestore.mock.item.query';
3
+ export * from './firestore.mock.item.service';
3
4
  export * from './firestore.mock.item';
4
5
  export * from './firestore.mock';
5
6
  export * from './firestore';
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
4
  tslib_1.__exportStar(require("./firestore.mock.item.fixture"), exports);
5
5
  tslib_1.__exportStar(require("./firestore.mock.item.query"), exports);
6
+ tslib_1.__exportStar(require("./firestore.mock.item.service"), exports);
6
7
  tslib_1.__exportStar(require("./firestore.mock.item"), exports);
7
8
  tslib_1.__exportStar(require("./firestore.mock"), exports);
8
9
  tslib_1.__exportStar(require("./firestore"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,sEAA4C;AAC5C,gEAAsC;AACtC,2DAAiC;AACjC,sDAA4B;AAC5B,iEAAuC;AACvC,8DAAoC;AACpC,0DAAgC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../../../packages/firebase/test/src/lib/common/index.ts"],"names":[],"mappings":";;;AAAA,wEAA8C;AAC9C,sEAA4C;AAC5C,wEAA8C;AAC9C,gEAAsC;AACtC,2DAAiC;AACjC,sDAA4B;AAC5B,iEAAuC;AACvC,8DAAoC;AACpC,0DAAgC"}
@@ -52,7 +52,7 @@ function describeAccessorDriverTests(f) {
52
52
  let privateDataAccessor;
53
53
  let privateSub;
54
54
  beforeEach(() => {
55
- mockItemPrivateFirestoreCollection = f.instance.collections.mockItemPrivate(itemDocument);
55
+ mockItemPrivateFirestoreCollection = f.instance.collections.mockItemPrivateCollectionFactory(itemDocument);
56
56
  itemPrivateDataDocument = mockItemPrivateFirestoreCollection.loadDocument();
57
57
  privateDataAccessor = itemPrivateDataDocument.accessor;
58
58
  privateSub = new rxjs_2.SubscriptionObject();
@@ -86,35 +86,88 @@ function describeAccessorDriverTests(f) {
86
86
  });
87
87
  });
88
88
  });
89
- describe('singleItemFirestoreCollection (MockItemSubItem)', () => {
90
- let mockItemSubItemFirestoreCollection;
91
- let subItemAccessor;
92
- beforeEach(() => {
93
- mockItemSubItemFirestoreCollection = f.instance.collections.mockItemSubItem(itemDocument);
94
- subItemAccessor = mockItemSubItemFirestoreCollection.documentAccessor();
89
+ describe('MockItemSubItem', () => {
90
+ let subItemDocument;
91
+ beforeEach(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
92
+ subItemDocument = f.instance.collections.mockItemSubItemCollectionFactory(itemDocument).documentAccessor().newDocument();
93
+ yield subItemDocument.accessor.set({ value: 0 });
94
+ }));
95
+ describe('firestoreCollectionWithParent (MockItemSubItem)', () => {
96
+ let mockItemSubItemFirestoreCollection;
97
+ beforeEach(() => {
98
+ mockItemSubItemFirestoreCollection = f.instance.collections.mockItemSubItemCollectionFactory(itemDocument);
99
+ });
100
+ describe('with item', () => {
101
+ describe('accessor', () => {
102
+ const TEST_VALUE = 1234;
103
+ describeAccessorTests(() => ({
104
+ context: f.parent.context,
105
+ accessor: subItemDocument.accessor,
106
+ dataForUpdate: () => ({ value: TEST_VALUE }),
107
+ hasDataFromUpdate: (data) => data.value === TEST_VALUE,
108
+ loadDocumentForTransaction: (transaction, ref) => mockItemSubItemFirestoreCollection.documentAccessorForTransaction(transaction).loadDocument(ref),
109
+ loadDocumentForWriteBatch: (writeBatch, ref) => mockItemSubItemFirestoreCollection.documentAccessorForWriteBatch(writeBatch).loadDocument(ref)
110
+ }));
111
+ });
112
+ });
95
113
  });
96
- describe('with item', () => {
97
- let subItemDocument;
98
- beforeEach(() => tslib_1.__awaiter(this, void 0, void 0, function* () {
99
- subItemDocument = subItemAccessor.newDocument();
100
- yield subItemDocument.accessor.set({ value: 0 });
101
- }));
102
- describe('accessor', () => {
103
- const TEST_VALUE = 1234;
104
- describeAccessorTests(() => ({
105
- context: f.parent.context,
106
- accessor: subItemDocument.accessor,
107
- dataForUpdate: () => ({ value: TEST_VALUE }),
108
- hasDataFromUpdate: (data) => data.value === TEST_VALUE,
109
- loadDocumentForTransaction: (transaction, ref) => mockItemSubItemFirestoreCollection.documentAccessorForTransaction(transaction).loadDocument(ref),
110
- loadDocumentForWriteBatch: (writeBatch, ref) => mockItemSubItemFirestoreCollection.documentAccessorForWriteBatch(writeBatch).loadDocument(ref)
111
- }));
114
+ describe('firestoreCollectionGroup (MockItemSubItem)', () => {
115
+ let mockItemSubItemFirestoreCollectionGroup;
116
+ beforeEach(() => {
117
+ mockItemSubItemFirestoreCollectionGroup = f.instance.collections.mockItemSubItemCollectionGroup;
118
+ });
119
+ describe('with item', () => {
120
+ describe('accessor', () => {
121
+ const TEST_VALUE = 1234;
122
+ describeAccessorTests(() => ({
123
+ context: f.parent.context,
124
+ accessor: subItemDocument.accessor,
125
+ dataForUpdate: () => ({ value: TEST_VALUE }),
126
+ hasDataFromUpdate: (data) => data.value === TEST_VALUE,
127
+ loadDocumentForTransaction: (transaction, ref) => mockItemSubItemFirestoreCollectionGroup.documentAccessorForTransaction(transaction).loadDocument(ref),
128
+ loadDocumentForWriteBatch: (writeBatch, ref) => mockItemSubItemFirestoreCollectionGroup.documentAccessorForWriteBatch(writeBatch).loadDocument(ref)
129
+ }));
130
+ });
112
131
  });
113
132
  });
114
133
  });
115
134
  });
116
135
  });
117
136
  describe('documentAccessor()', () => {
137
+ describe('loadDocumentForKey()', () => {
138
+ it('should load an existing document from the path.', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
139
+ const document = firestoreDocumentAccessor.loadDocumentForKey(items[0].documentRef.path);
140
+ const exists = yield document.accessor.exists();
141
+ expect(exists).toBe(true);
142
+ }));
143
+ it('should throw an exception if the path is invalid (points to collection)', () => {
144
+ try {
145
+ firestoreDocumentAccessor.loadDocumentForKey('path');
146
+ fail();
147
+ }
148
+ catch (e) {
149
+ expect(e).toBeDefined();
150
+ }
151
+ });
152
+ it('should throw an exception if the path is empty.', () => {
153
+ try {
154
+ firestoreDocumentAccessor.loadDocumentForKey('');
155
+ fail();
156
+ }
157
+ catch (e) {
158
+ expect(e).toBeDefined();
159
+ }
160
+ });
161
+ it('should throw an exception if the path is undefined.', () => {
162
+ try {
163
+ firestoreDocumentAccessor.loadDocumentForKey(undefined);
164
+ fail();
165
+ }
166
+ catch (e) {
167
+ expect(e).toBeDefined();
168
+ }
169
+ });
170
+ });
118
171
  describe('loadDocumentForPath()', () => {
119
172
  it('should return a document at the given path.', () => {
120
173
  const document = firestoreDocumentAccessor.loadDocumentForPath('path');
@@ -193,7 +246,7 @@ function describeAccessorTests(init) {
193
246
  });
194
247
  describe('in batch context', () => {
195
248
  it('should return the first emitted value (observable completes immediately)', () => tslib_1.__awaiter(this, void 0, void 0, function* () {
196
- let writeBatch = c.context.batch();
249
+ const writeBatch = c.context.batch();
197
250
  const batchItemDocument = c.loadDocumentForWriteBatch(writeBatch, c.accessor.documentRef);
198
251
  // load the value
199
252
  const value = yield (0, rxjs_1.firstValueFrom)(batchItemDocument.accessor.stream());