@brimble/models 4.0.3 → 4.0.5

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.
@@ -17,6 +17,7 @@ const cashierSubscriptionSchema = new mongoose_1.Schema({
17
17
  team_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Team", default: null },
18
18
  plan_type: { type: String, default: null },
19
19
  domain_id: { type: mongoose_1.Schema.Types.ObjectId, ref: "Domain", default: null },
20
+ extra_build_minutes: { type: Number, default: 0, required: false },
20
21
  }, {
21
22
  timestamps: {
22
23
  createdAt: "created_at",
@@ -7,6 +7,7 @@ export interface ICashierSubscription extends Document {
7
7
  team_id: Ref<ITeam> | null;
8
8
  type: string;
9
9
  stripe_id: string;
10
+ extra_build_minutes: number;
10
11
  stripe_status: string;
11
12
  stripe_price: string | null;
12
13
  quantity: number | null;
@@ -5,7 +5,6 @@ import { IMemberPermission } from "./member-permission";
5
5
  import { IProjectEnvironment } from "./project-environment";
6
6
  import { Ref } from "./ref";
7
7
  export interface IMember extends Document {
8
- /** Absent until an invited member registers; `email` identifies them until then. */
9
8
  user: Ref<IUser>;
10
9
  team: Ref<ITeam>;
11
10
  role: ROLES;
@@ -1,11 +1,13 @@
1
1
  import { Types } from "mongoose";
2
2
  /**
3
- * A Mongoose reference field. Holds an `ObjectId` unless the query that loaded
4
- * the document populated it. Type that query's result as `Populated<T, K>`
5
- * (or a named alias of it) so callers already know which refs are documents.
3
+ * A Mongoose reference field. Accepts a string id or ObjectId when writing;
4
+ * holds an ObjectId in storage unless the query populated it. Type populated
5
+ * query results as `Populated<T, K>` (or a named alias) so callers know which
6
+ * refs are documents.
6
7
  */
7
- export type Ref<T> = T | Types.ObjectId;
8
- type PopulatedField<V> = V extends (infer E)[] ? Exclude<E, Types.ObjectId>[] : Exclude<V, Types.ObjectId>;
8
+ export type Ref<T> = T | Types.ObjectId | string;
9
+ type UnpopulatedRef = Types.ObjectId | string;
10
+ type PopulatedField<V> = V extends (infer E)[] ? Exclude<E, UnpopulatedRef>[] : Exclude<V, UnpopulatedRef>;
9
11
  /**
10
12
  * Narrows the named reference fields of `T` to their populated documents. Use it
11
13
  * on query return types so the populate contract lives with the query that
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brimble/models",
3
- "version": "4.0.3",
3
+ "version": "4.0.5",
4
4
  "description": "Brimble models",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",