@dereekb/firebase 13.10.0 → 13.10.2

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/index.cjs.js CHANGED
@@ -3362,7 +3362,7 @@ function optionalFirestoreField(config) {
3362
3362
  };
3363
3363
  }
3364
3364
  fromData = function fromData(x) {
3365
- return transformFrom(x == null ? loadDefaultReadValueFn() : x);
3365
+ return transformFrom(x !== null && x !== void 0 ? x : loadDefaultReadValueFn());
3366
3366
  };
3367
3367
  } else if (transformFrom !== util.passThrough) {
3368
3368
  fromData = function fromData(x) {
@@ -4080,7 +4080,9 @@ function firestoreUniqueNumberArray(config) {
4080
4080
  performFiltering = function performFiltering(x) {
4081
4081
  var result = filterUnique(x);
4082
4082
  if (filterFn) {
4083
- result = result.filter(filterFn);
4083
+ result = result.filter(function(v, i) {
4084
+ return filterFn(v, i);
4085
+ });
4084
4086
  }
4085
4087
  return result;
4086
4088
  };
@@ -4294,10 +4296,9 @@ var assignDateCellRangeFunction = util.assignValuesToPOJOFunction({
4294
4296
  valueFilter: util.KeyValueTypleValueFilter.NULL
4295
4297
  });
4296
4298
  var firestoreDateCellRangeAssignFn = function firestoreDateCellRangeAssignFn(input) {
4299
+ var _block, _to;
4297
4300
  var block = assignDateCellRangeFunction(DEFAULT_DATE_CELL_RANGE_VALUE, input);
4298
- if (block.to == null) {
4299
- block.to = block.i;
4300
- }
4301
+ (_to = (_block = block).to) !== null && _to !== void 0 ? _to : _block.to = block.i;
4301
4302
  return block;
4302
4303
  };
4303
4304
  /**
@@ -7428,7 +7429,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7428
7429
  * @param key
7429
7430
  * @returns
7430
7431
  */ function flatFirestoreModelKey(key) {
7431
- return key.replace(/\//g, '');
7432
+ return key.replaceAll('/', '');
7432
7433
  }
7433
7434
  /**
7434
7435
  * Creates a TwoWayFlatFirestoreModelKey from the input FirestoreModelKey.
@@ -7436,7 +7437,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7436
7437
  * @param key
7437
7438
  * @returns
7438
7439
  */ function twoWayFlatFirestoreModelKey(key) {
7439
- return key.replace(/\//g, '_');
7440
+ return key.replaceAll('/', '_');
7440
7441
  }
7441
7442
  /**
7442
7443
  * Creates a TwoWayFlatFirestoreModelKey from the input FirestoreModelKey.
@@ -7444,7 +7445,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7444
7445
  * @param key
7445
7446
  * @returns
7446
7447
  */ function inferKeyFromTwoWayFlatFirestoreModelKey(key) {
7447
- return key.replace(/_/g, FIRESTORE_COLLECTION_NAME_SEPARATOR);
7448
+ return key.replaceAll('_', FIRESTORE_COLLECTION_NAME_SEPARATOR);
7448
7449
  }
7449
7450
  /**
7450
7451
  * Firestore Model Id Regex
@@ -7834,10 +7835,10 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
7834
7835
  /**
7835
7836
  * Creates a root-level Firestore collection focused on a single document.
7836
7837
  *
7837
- * This factory function creates a specialized collection that combines standard collection
7838
- * functionality with convenient accessors for working with a single document. It's particularly
7839
- * useful for application settings, configuration, or any singleton-like data structures
7840
- * that are stored in Firestore.
7838
+ * Backing factory for the `'root-singleton'` collection kind. Combines
7839
+ * standard collection functionality with convenient accessors for working
7840
+ * with a single document. Useful for application settings, configuration,
7841
+ * or any singleton-like data structures that are stored in Firestore.
7841
7842
  *
7842
7843
  * @template T - The data type of the document
7843
7844
  * @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
@@ -7967,7 +7968,7 @@ function _object_spread_props$e(target, source) {
7967
7968
  * // id === 'userAAAexamplecom'
7968
7969
  * ```
7969
7970
  */ function firestoreModelIdFromEmail(emailAddress) {
7970
- return emailAddress.replace('@', 'AAA').replace(/[^a-zA-Z0-9]/g, '');
7971
+ return emailAddress.replace('@', 'AAA').replaceAll(/[^a-zA-Z0-9]/g, '');
7971
7972
  }
7972
7973
 
7973
7974
  /**
@@ -17831,7 +17832,7 @@ function _ts_generator$1(thisArg, body) {
17831
17832
  ]), a = _ref[0], b = _ref[1];
17832
17833
  return [
17833
17834
  2,
17834
- _object_spread$2({}, a !== null && a !== void 0 ? a : {}, b !== null && b !== void 0 ? b : {})
17835
+ _object_spread$2({}, a, b)
17835
17836
  ];
17836
17837
  }
17837
17838
  });
package/index.esm.js CHANGED
@@ -3360,7 +3360,7 @@ function optionalFirestoreField(config) {
3360
3360
  };
3361
3361
  }
3362
3362
  fromData = function fromData(x) {
3363
- return transformFrom(x == null ? loadDefaultReadValueFn() : x);
3363
+ return transformFrom(x !== null && x !== void 0 ? x : loadDefaultReadValueFn());
3364
3364
  };
3365
3365
  } else if (transformFrom !== passThrough) {
3366
3366
  fromData = function fromData(x) {
@@ -4078,7 +4078,9 @@ function firestoreUniqueNumberArray(config) {
4078
4078
  performFiltering = function performFiltering(x) {
4079
4079
  var result = filterUnique(x);
4080
4080
  if (filterFn) {
4081
- result = result.filter(filterFn);
4081
+ result = result.filter(function(v, i) {
4082
+ return filterFn(v, i);
4083
+ });
4082
4084
  }
4083
4085
  return result;
4084
4086
  };
@@ -4292,10 +4294,9 @@ var assignDateCellRangeFunction = assignValuesToPOJOFunction({
4292
4294
  valueFilter: KeyValueTypleValueFilter.NULL
4293
4295
  });
4294
4296
  var firestoreDateCellRangeAssignFn = function firestoreDateCellRangeAssignFn(input) {
4297
+ var _block, _to;
4295
4298
  var block = assignDateCellRangeFunction(DEFAULT_DATE_CELL_RANGE_VALUE, input);
4296
- if (block.to == null) {
4297
- block.to = block.i;
4298
- }
4299
+ (_to = (_block = block).to) !== null && _to !== void 0 ? _to : _block.to = block.i;
4299
4300
  return block;
4300
4301
  };
4301
4302
  /**
@@ -7426,7 +7427,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7426
7427
  * @param key
7427
7428
  * @returns
7428
7429
  */ function flatFirestoreModelKey(key) {
7429
- return key.replace(/\//g, '');
7430
+ return key.replaceAll('/', '');
7430
7431
  }
7431
7432
  /**
7432
7433
  * Creates a TwoWayFlatFirestoreModelKey from the input FirestoreModelKey.
@@ -7434,7 +7435,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7434
7435
  * @param key
7435
7436
  * @returns
7436
7437
  */ function twoWayFlatFirestoreModelKey(key) {
7437
- return key.replace(/\//g, '_');
7438
+ return key.replaceAll('/', '_');
7438
7439
  }
7439
7440
  /**
7440
7441
  * Creates a TwoWayFlatFirestoreModelKey from the input FirestoreModelKey.
@@ -7442,7 +7443,7 @@ function firestoreModelIdentity(parentOrModelName, collectionNameOrModelName, in
7442
7443
  * @param key
7443
7444
  * @returns
7444
7445
  */ function inferKeyFromTwoWayFlatFirestoreModelKey(key) {
7445
- return key.replace(/_/g, FIRESTORE_COLLECTION_NAME_SEPARATOR);
7446
+ return key.replaceAll('_', FIRESTORE_COLLECTION_NAME_SEPARATOR);
7446
7447
  }
7447
7448
  /**
7448
7449
  * Firestore Model Id Regex
@@ -7832,10 +7833,10 @@ var FIRESTORE_DUMMY_MODEL_KEY = 'dummymodel/dummykey';
7832
7833
  /**
7833
7834
  * Creates a root-level Firestore collection focused on a single document.
7834
7835
  *
7835
- * This factory function creates a specialized collection that combines standard collection
7836
- * functionality with convenient accessors for working with a single document. It's particularly
7837
- * useful for application settings, configuration, or any singleton-like data structures
7838
- * that are stored in Firestore.
7836
+ * Backing factory for the `'root-singleton'` collection kind. Combines
7837
+ * standard collection functionality with convenient accessors for working
7838
+ * with a single document. Useful for application settings, configuration,
7839
+ * or any singleton-like data structures that are stored in Firestore.
7839
7840
  *
7840
7841
  * @template T - The data type of the document
7841
7842
  * @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
@@ -7965,7 +7966,7 @@ function _object_spread_props$e(target, source) {
7965
7966
  * // id === 'userAAAexamplecom'
7966
7967
  * ```
7967
7968
  */ function firestoreModelIdFromEmail(emailAddress) {
7968
- return emailAddress.replace('@', 'AAA').replace(/[^a-zA-Z0-9]/g, '');
7969
+ return emailAddress.replace('@', 'AAA').replaceAll(/[^a-zA-Z0-9]/g, '');
7969
7970
  }
7970
7971
 
7971
7972
  /**
@@ -17829,7 +17830,7 @@ function _ts_generator$1(thisArg, body) {
17829
17830
  ]), a = _ref[0], b = _ref[1];
17830
17831
  return [
17831
17832
  2,
17832
- _object_spread$2({}, a !== null && a !== void 0 ? a : {}, b !== null && b !== void 0 ? b : {})
17833
+ _object_spread$2({}, a, b)
17833
17834
  ];
17834
17835
  }
17835
17836
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dereekb/firebase",
3
- "version": "13.10.0",
3
+ "version": "13.10.2",
4
4
  "exports": {
5
5
  "./test": {
6
6
  "module": "./test/index.esm.js",
@@ -17,17 +17,17 @@
17
17
  }
18
18
  },
19
19
  "peerDependencies": {
20
- "@dereekb/util": "13.10.0",
21
- "@dereekb/date": "13.10.0",
22
- "@dereekb/model": "13.10.0",
23
- "@dereekb/rxjs": "13.10.0",
20
+ "@dereekb/util": "13.10.2",
21
+ "@dereekb/date": "13.10.2",
22
+ "@dereekb/model": "13.10.2",
23
+ "@dereekb/rxjs": "13.10.2",
24
24
  "@firebase/rules-unit-testing": "5.0.0",
25
25
  "arktype": "^2.2.0",
26
- "date-fns": "^4.0.0",
27
- "firebase": "^12.12.0",
28
- "make-error": "^1.3.0",
29
- "rxjs": "^7.8.0",
30
- "ts-essentials": "^10.0.0"
26
+ "date-fns": "^4.1.0",
27
+ "firebase": "^12.12.1",
28
+ "make-error": "^1.3.6",
29
+ "rxjs": "^7.8.2",
30
+ "ts-essentials": "^10.2.0"
31
31
  },
32
32
  "module": "./index.esm.js",
33
33
  "main": "./index.cjs.js",
@@ -596,6 +596,16 @@ export interface FirestoreCollectionConfig<T, D extends FirestoreDocument<T> = F
596
596
  /**
597
597
  * Full Firestore collection interface with document CRUD, querying, iteration, and context support.
598
598
  *
599
+ * Backs the `'root'` collection kind: a standard Firestore root collection.
600
+ * Created at runtime via `firestoreContext.firestoreCollection({...})` and
601
+ * typed at the model layer as
602
+ * `<Model>FirestoreCollection = FirestoreCollection<T, D>`.
603
+ *
604
+ * For other collection kinds, see:
605
+ * - `'root-singleton'` ({@link RootSingleItemFirestoreCollection} in `./collection.single`) — single doc in a root collection.
606
+ * - `'sub-collection'` ({@link FirestoreCollectionWithParent} in `./subcollection`) — multi-item subcollection under a parent.
607
+ * - `'singleton-sub'` ({@link SingleItemFirestoreCollection} in `./subcollection.single`) — one document per parent.
608
+ *
599
609
  * This is the primary interface used to interact with a Firestore collection. It provides:
600
610
  * - **Document access**: Create, load, and manage documents via {@link FirestoreDocumentAccessor}
601
611
  * - **Querying**: Build typed queries via the query factory
@@ -3,9 +3,11 @@ import { type FirestoreCollection, type FirestoreCollectionConfig } from './coll
3
3
  /**
4
4
  * Configuration for creating a root-level collection that focuses on a single document.
5
5
  *
6
- * This configuration extends the standard FirestoreCollectionConfig with optional
7
- * settings for specifying a single document identifier. This is used when you need
8
- * to work with a specific document in a collection, such as configuration or settings.
6
+ * Backs the `'root-singleton'` collection kind. This configuration extends
7
+ * the standard FirestoreCollectionConfig with optional settings for
8
+ * specifying a single document identifier used when you need to work with
9
+ * a specific document in a root collection, such as application
10
+ * configuration or per-deploy settings.
9
11
  *
10
12
  * @template T - The data type of the document
11
13
  * @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
@@ -15,6 +17,15 @@ export interface RootSingleItemFirestoreCollectionConfig<T, D extends FirestoreD
15
17
  /**
16
18
  * A Firestore collection that provides specialized accessors for working with a single document.
17
19
  *
20
+ * Backs the `'root-singleton'` collection kind: a single document in a root
21
+ * collection, identified up-front by a fixed `singleItemIdentifier`. Created
22
+ * at runtime via `firestoreContext.rootSingleItemFirestoreCollection({...})`
23
+ * and typed at the model layer as
24
+ * `<Model>FirestoreCollection = RootSingleItemFirestoreCollection<T, D>`.
25
+ *
26
+ * For the parent-bound counterpart (one document per parent), see
27
+ * {@link SingleItemFirestoreCollection} (kind `'singleton-sub'`).
28
+ *
18
29
  * This interface combines the capabilities of a standard FirestoreCollection with
19
30
  * FirestoreSingleDocumentAccessor, providing convenient methods for working directly
20
31
  * with a single document without needing to specify its ID in each call.
@@ -27,10 +38,10 @@ export interface RootSingleItemFirestoreCollection<T, D extends FirestoreDocumen
27
38
  /**
28
39
  * Creates a root-level Firestore collection focused on a single document.
29
40
  *
30
- * This factory function creates a specialized collection that combines standard collection
31
- * functionality with convenient accessors for working with a single document. It's particularly
32
- * useful for application settings, configuration, or any singleton-like data structures
33
- * that are stored in Firestore.
41
+ * Backing factory for the `'root-singleton'` collection kind. Combines
42
+ * standard collection functionality with convenient accessors for working
43
+ * with a single document. Useful for application settings, configuration,
44
+ * or any singleton-like data structures that are stored in Firestore.
34
45
  *
35
46
  * @template T - The data type of the document
36
47
  * @template D - The FirestoreDocument type, defaults to FirestoreDocument<T>
@@ -5,6 +5,10 @@
5
5
  * within a specific document rather than at the root level. Subcollections enable hierarchical
6
6
  * data modeling in Firestore by allowing documents to contain their own collections.
7
7
  *
8
+ * Collection kind: `'sub-collection'` (multi-item subcollection under a parent).
9
+ * For the one-document-per-parent variant, see `'singleton-sub'`
10
+ * ({@link SingleItemFirestoreCollection} in `./subcollection.single`).
11
+ *
8
12
  * Key features of subcollections:
9
13
  * - They provide a natural way to model hierarchical relationships
10
14
  * - They establish clear ownership boundaries (parent document owns child documents)
@@ -42,6 +46,13 @@ export interface FirestoreCollectionWithParentConfig<T, PT, D extends FirestoreD
42
46
  /**
43
47
  * A FirestoreCollection that represents a subcollection with a reference to its parent document.
44
48
  *
49
+ * Backs the `'sub-collection'` collection kind: a multi-item subcollection
50
+ * under a parent. Created at runtime via `firestoreContext.firestoreCollectionWithParent({...})`
51
+ * and typed at the model layer as `<Model>FirestoreCollection = FirestoreCollectionWithParent<T, PT, D, PD>`.
52
+ *
53
+ * For one-document-per-parent subcollections, use {@link SingleItemFirestoreCollection}
54
+ * (kind `'singleton-sub'`) instead.
55
+ *
45
56
  * This interface extends FirestoreCollection to maintain the parent-child relationship
46
57
  * between documents. It allows access to documents within the context of their parent,
47
58
  * enabling proper path construction and maintaining the document hierarchy.
@@ -18,6 +18,13 @@ export interface SingleItemFirestoreCollectionConfig<T, PT, D extends FirestoreD
18
18
  * A subcollection that provides specialized accessors for working with a single document
19
19
  * within a parent document context.
20
20
  *
21
+ * Backs the `'singleton-sub'` collection kind: one document per parent.
22
+ * Created at runtime via `firestoreContext.singleItemFirestoreCollection({...})`
23
+ * and typed at the model layer as `<Model>FirestoreCollection = SingleItemFirestoreCollection<T, PT, D, PD>`.
24
+ *
25
+ * For multi-item subcollections under the same parent, use
26
+ * {@link FirestoreCollectionWithParent} (kind `'sub-collection'`) instead.
27
+ *
21
28
  * This interface combines the capabilities of FirestoreCollectionWithParent (which maintains
22
29
  * the parent-child relationship) with FirestoreSingleDocumentAccessor (which provides
23
30
  * convenient methods for working with a specific document). This allows for direct access
@@ -91,7 +91,7 @@ export interface UpdateNotificationUserParams extends TargetModelParams {
91
91
  }
92
92
  export declare const updateNotificationUserParamsType: Type<UpdateNotificationUserParams>;
93
93
  export type ResyncNotificationUserParams = TargetModelParams;
94
- export declare const resyncNotificationUserParamsType: Type<ResyncNotificationUserParams>;
94
+ export declare const resyncNotificationUserParamsType: import("arktype/internal/variants/object.ts").ObjectType<TargetModelParams, {}>;
95
95
  export interface ResyncNotificationUserResult {
96
96
  readonly notificationBoxesUpdated: number;
97
97
  }
@@ -156,7 +156,7 @@ export interface InitializeAllApplicableNotificationSummariesResult {
156
156
  * Used for updating the NotificationBox.
157
157
  */
158
158
  export type UpdateNotificationBoxParams = TargetModelParams;
159
- export declare const updateNotificationBoxParamsType: Type<UpdateNotificationBoxParams>;
159
+ export declare const updateNotificationBoxParamsType: import("arktype/internal/variants/object.ts").ObjectType<TargetModelParams, {}>;
160
160
  /**
161
161
  * Used to create/update a notification box recipient.
162
162
  */
@@ -69,13 +69,13 @@ export interface UpdateOidcClientParams extends UpdateOidcClientFieldParams, Tar
69
69
  }
70
70
  export declare const updateOidcClientParamsType: Type<UpdateOidcClientParams>;
71
71
  export type RotateOidcClientSecretParams = TargetModelParams;
72
- export declare const rotateOidcClientSecretParamsType: Type<RotateOidcClientSecretParams>;
72
+ export declare const rotateOidcClientSecretParamsType: import("arktype/internal/variants/object.ts").ObjectType<TargetModelParams, {}>;
73
73
  export type RotateOidcClientSecretResult = Pick<CreateOidcClientResult, 'client_id' | 'client_secret'>;
74
74
  /**
75
75
  * Parameters for revoking/deleting an OAuth client.
76
76
  */
77
77
  export type DeleteOidcClientParams = TargetModelParams;
78
- export declare const deleteOidcClientParamsType: Type<DeleteOidcClientParams>;
78
+ export declare const deleteOidcClientParamsType: import("arktype/internal/variants/object.ts").ObjectType<TargetModelParams, {}>;
79
79
  /**
80
80
  * Custom (non-CRUD) function type map for OIDC.
81
81
  */
@@ -29,7 +29,7 @@ export declare const oidcEntryIdentity: import("../..").RootFirestoreModelIdenti
29
29
  *
30
30
  * Used as the discriminator in the {@link OidcEntry.type} field.
31
31
  */
32
- export type OidcEntryType = 'Session' | 'AccessToken' | 'AuthorizationCode' | 'RefreshToken' | 'DeviceCode' | 'ClientCredentials' | 'Client' | 'InitialAccessToken' | 'RegistrationAccessToken' | 'Interaction' | 'ReplayDetection' | 'PushedAuthorizationRequest' | 'Grant' | 'BackchannelAuthenticationRequest' | string;
32
+ export type OidcEntryType = 'Session' | 'AccessToken' | 'AuthorizationCode' | 'RefreshToken' | 'DeviceCode' | 'ClientCredentials' | 'Client' | 'InitialAccessToken' | 'RegistrationAccessToken' | 'Interaction' | 'ReplayDetection' | 'PushedAuthorizationRequest' | 'Grant' | 'BackchannelAuthenticationRequest' | (string & {});
33
33
  /**
34
34
  * Type value for Client adapter entries.
35
35
  */
package/test/index.cjs.js CHANGED
@@ -4882,6 +4882,7 @@ function _async_to_generator$3(fn) {
4882
4882
  };
4883
4883
  }
4884
4884
  function _instanceof(left, right) {
4885
+ "@swc/helpers - instanceof";
4885
4886
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
4886
4887
  return !!right[Symbol.hasInstance](left);
4887
4888
  } else {
package/test/index.esm.js CHANGED
@@ -4880,6 +4880,7 @@ function _async_to_generator$3(fn) {
4880
4880
  };
4881
4881
  }
4882
4882
  function _instanceof(left, right) {
4883
+ "@swc/helpers - instanceof";
4883
4884
  if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
4884
4885
  return !!right[Symbol.hasInstance](left);
4885
4886
  } else {
package/test/package.json CHANGED
@@ -1,16 +1,16 @@
1
1
  {
2
2
  "name": "@dereekb/firebase/test",
3
- "version": "13.10.0",
3
+ "version": "13.10.2",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.10.0",
6
- "@dereekb/firebase": "13.10.0",
7
- "@dereekb/model": "13.10.0",
8
- "@dereekb/rxjs": "13.10.0",
9
- "@dereekb/util": "13.10.0",
5
+ "@dereekb/date": "13.10.2",
6
+ "@dereekb/firebase": "13.10.2",
7
+ "@dereekb/model": "13.10.2",
8
+ "@dereekb/rxjs": "13.10.2",
9
+ "@dereekb/util": "13.10.2",
10
10
  "@firebase/rules-unit-testing": "5.0.0",
11
- "date-fns": "^4.0.0",
12
- "firebase": "^12.12.0",
13
- "rxjs": "^7.8.0"
11
+ "date-fns": "^4.1.0",
12
+ "firebase": "^12.12.1",
13
+ "rxjs": "^7.8.2"
14
14
  },
15
15
  "exports": {
16
16
  "./package.json": "./package.json",