clhq-postgres-module 1.1.0-alpha.131 → 1.1.0-alpha.133

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.
@@ -1,3 +1,3 @@
1
1
  import { DataSource } from 'typeorm';
2
- declare const dataSource: DataSource;
2
+ declare let dataSource: DataSource | undefined;
3
3
  export default dataSource;
@@ -6,22 +6,22 @@ const workspace_entity_1 = require("../entities/workspace.entity");
6
6
  const editor_project_entity_1 = require("../entities/editor-project.entity");
7
7
  const user_subscription_entity_1 = require("../entities/user-subscription.entity");
8
8
  const connectionUrl = process.env.PG_SESSION_POOLER_URL || process.env.PG_POOLER_URL;
9
- if (!connectionUrl) {
10
- throw new Error('PostgreSQL connection URL not found. Set PG_SESSION_POOLER_URL or PG_POOLER_URL in environment.');
9
+ let dataSource;
10
+ if (connectionUrl) {
11
+ dataSource = new typeorm_1.DataSource({
12
+ type: 'postgres',
13
+ url: connectionUrl,
14
+ synchronize: false,
15
+ logging: process.env.NODE_ENV === 'development',
16
+ entities: [user_entity_1.User, workspace_entity_1.Workspace, editor_project_entity_1.EditorProject, user_subscription_entity_1.UserSubscription],
17
+ migrations: [],
18
+ ssl: { rejectUnauthorized: false },
19
+ extra: {
20
+ max: 20,
21
+ min: 5,
22
+ idleTimeoutMillis: 30000,
23
+ connectionTimeoutMillis: 10000,
24
+ },
25
+ });
11
26
  }
12
- const dataSource = new typeorm_1.DataSource({
13
- type: 'postgres',
14
- url: connectionUrl,
15
- synchronize: false,
16
- logging: process.env.NODE_ENV === 'development',
17
- entities: [user_entity_1.User, workspace_entity_1.Workspace, editor_project_entity_1.EditorProject, user_subscription_entity_1.UserSubscription],
18
- migrations: [],
19
- ssl: { rejectUnauthorized: false },
20
- extra: {
21
- max: 20,
22
- min: 5,
23
- idleTimeoutMillis: 30000,
24
- connectionTimeoutMillis: 10000,
25
- },
26
- });
27
27
  exports.default = dataSource;
@@ -60,6 +60,7 @@ __decorate([
60
60
  ], UserSubscription.prototype, "status", void 0);
61
61
  __decorate([
62
62
  (0, typeorm_1.Column)({
63
+ name: 'billing_cycle',
63
64
  type: 'enum',
64
65
  enum: BillingCycle,
65
66
  default: BillingCycle.MONTHLY,
@@ -99,15 +100,30 @@ __decorate([
99
100
  __metadata("design:type", Date)
100
101
  ], UserSubscription.prototype, "trialEndsAt", void 0);
101
102
  __decorate([
102
- (0, typeorm_1.Column)({ name: 'stripe_subscription_id', type: 'varchar', length: 255, nullable: true }),
103
+ (0, typeorm_1.Column)({
104
+ name: 'stripe_subscription_id',
105
+ type: 'varchar',
106
+ length: 255,
107
+ nullable: true,
108
+ }),
103
109
  __metadata("design:type", String)
104
110
  ], UserSubscription.prototype, "stripeSubscriptionId", void 0);
105
111
  __decorate([
106
- (0, typeorm_1.Column)({ name: 'stripe_customer_id', type: 'varchar', length: 255, nullable: true }),
112
+ (0, typeorm_1.Column)({
113
+ name: 'stripe_customer_id',
114
+ type: 'varchar',
115
+ length: 255,
116
+ nullable: true,
117
+ }),
107
118
  __metadata("design:type", String)
108
119
  ], UserSubscription.prototype, "stripeCustomerId", void 0);
109
120
  __decorate([
110
- (0, typeorm_1.Column)({ name: 'payment_method_id', type: 'varchar', length: 255, nullable: true }),
121
+ (0, typeorm_1.Column)({
122
+ name: 'payment_method_id',
123
+ type: 'varchar',
124
+ length: 255,
125
+ nullable: true,
126
+ }),
111
127
  __metadata("design:type", String)
112
128
  ], UserSubscription.prototype, "paymentMethodId", void 0);
113
129
  __decorate([
package/dist/index.d.ts CHANGED
@@ -2,4 +2,3 @@ export * from './entities';
2
2
  export * from './repositories';
3
3
  export * from './repositories/repository.module';
4
4
  export * from './postgres.module';
5
- export * from './config/data-source';
package/dist/index.js CHANGED
@@ -18,4 +18,3 @@ __exportStar(require("./entities"), exports);
18
18
  __exportStar(require("./repositories"), exports);
19
19
  __exportStar(require("./repositories/repository.module"), exports);
20
20
  __exportStar(require("./postgres.module"), exports);
21
- __exportStar(require("./config/data-source"), exports);
@@ -64,7 +64,10 @@ exports.PostgresModule = PostgresModule = __decorate([
64
64
  entities: allEntities,
65
65
  synchronize: false,
66
66
  logging: false,
67
- ssl: { rejectUnauthorized: false },
67
+ ssl: process.env.NODE_ENV === 'test' ||
68
+ process.env.USE_TEST_CONTAINERS === 'true'
69
+ ? false
70
+ : { rejectUnauthorized: false },
68
71
  }),
69
72
  ],
70
73
  exports: [typeorm_1.TypeOrmModule],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clhq-postgres-module",
3
- "version": "1.1.0-alpha.131",
3
+ "version": "1.1.0-alpha.133",
4
4
  "description": "PostgreSQL module using TypeORM for Clippy",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",