@naturalcycles/abba 1.3.0 → 1.6.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.
package/dist/abba.d.ts CHANGED
@@ -2,7 +2,7 @@ import { UserAssignment } from './prisma-output';
2
2
  import { BucketInput, ExperimentWithBuckets, ExperimentInput, SegmentationData, AssignmentStatistics } from '.';
3
3
  export declare class Abba {
4
4
  private client;
5
- constructor();
5
+ constructor(dbUrl?: string);
6
6
  /**
7
7
  * Returns all experiments
8
8
  *
package/dist/abba.js CHANGED
@@ -8,8 +8,14 @@ const util_1 = require("./util");
8
8
  // it would be tidier not to include it here when possible later on:
9
9
  // Explanation is here: https://github.com/prisma/prisma/issues/9435#issuecomment-960290681
10
10
  class Abba {
11
- constructor() {
12
- this.client = new prisma_output_1.PrismaClient();
11
+ constructor(dbUrl) {
12
+ this.client = new prisma_output_1.PrismaClient({
13
+ datasources: {
14
+ db: {
15
+ url: dbUrl,
16
+ },
17
+ },
18
+ });
13
19
  }
14
20
  /**
15
21
  * Returns all experiments
@@ -139,7 +139,24 @@ const config = {
139
139
  config: {
140
140
  engineType: 'library',
141
141
  },
142
- binaryTargets: [],
142
+ binaryTargets: [
143
+ {
144
+ fromEnvVar: null,
145
+ value: 'darwin',
146
+ },
147
+ {
148
+ fromEnvVar: null,
149
+ value: 'darwin',
150
+ },
151
+ {
152
+ fromEnvVar: null,
153
+ value: 'darwin-arm64',
154
+ },
155
+ {
156
+ fromEnvVar: null,
157
+ value: 'debian-openssl-1.1.x',
158
+ },
159
+ ],
143
160
  previewFeatures: [],
144
161
  isCustomOutput: true,
145
162
  },
@@ -172,5 +189,11 @@ Object.assign(exports, Prisma)
172
189
 
173
190
  path.join(__dirname, 'libquery_engine-darwin.dylib.node')
174
191
  path.join(process.cwd(), './src/prisma-output/libquery_engine-darwin.dylib.node')
192
+
193
+ path.join(__dirname, 'libquery_engine-darwin-arm64.dylib.node')
194
+ path.join(process.cwd(), './src/prisma-output/libquery_engine-darwin-arm64.dylib.node')
195
+
196
+ path.join(__dirname, 'libquery_engine-debian-openssl-1.1.x.so.node')
197
+ path.join(process.cwd(), './src/prisma-output/libquery_engine-debian-openssl-1.1.x.so.node')
175
198
  path.join(__dirname, 'schema.prisma')
176
199
  path.join(process.cwd(), './src/prisma-output/schema.prisma')
@@ -1,6 +1,7 @@
1
1
  generator client {
2
2
  provider = "prisma-client-js"
3
3
  output = "../src/prisma-output"
4
+ binaryTargets = ["native", "darwin", "darwin-arm64", "debian-openssl-1.1.x"]
4
5
  }
5
6
 
6
7
  datasource db {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@naturalcycles/abba",
3
- "version": "1.3.0",
3
+ "version": "1.6.0",
4
4
  "scripts": {
5
5
  "prepare": "husky install",
6
6
  "build": "build && npm run copy-prisma-output",
package/readme.md CHANGED
@@ -77,17 +77,9 @@ This template doesn't rely on any external dependencies or services._
77
77
  npm install @naturalcyles/abba
78
78
  ```
79
79
 
80
- 2. Execute the [sql script found here](/src/prisma/migrations/20220218075343_init/migration.sql) to
81
- generate the required DB Schema
82
-
83
- 3. Create a `.env` file add add your Database Url using the following key:
84
- ```sh
85
- ABBA_DB_URL="{{insert your instance url}}"
86
- ```
87
- 4. Create a new instance of the Abba class
88
- ```js
89
- const abba = new Abba()
90
- ```
80
+ 2. Execute the
81
+ [sql script found here](https://github.com/NaturalCycles/abba/blob/master/prisma/migrations/20220218075343_init/migration.sql)
82
+ to generate the required DB Schema
91
83
 
92
84
  <p align="right">(<a href="#top">back to top</a>)</p>
93
85
 
@@ -97,6 +89,18 @@ This template doesn't rely on any external dependencies or services._
97
89
 
98
90
  <div id="usage"></div>
99
91
 
92
+ ### Create an instance of Abba
93
+
94
+ Creates an instance of Abba. You can pass in the database url in the constructor. If it does not
95
+ exist it will fallback to trying to use the `ABBA_DB_URL` which must be added to your environment
96
+ variables.
97
+
98
+ ```js
99
+ const abba = new Abba('url')
100
+ // or reading from process.env.ABBA_DB_URL
101
+ const abba = new Abba()
102
+ ```
103
+
100
104
  ### Create a new experiment
101
105
 
102
106
  Creates a new experiment
package/src/abba.ts CHANGED
@@ -17,8 +17,14 @@ import {
17
17
  export class Abba {
18
18
  private client: PrismaClient
19
19
 
20
- constructor() {
21
- this.client = new PrismaClient()
20
+ constructor(dbUrl?: string) {
21
+ this.client = new PrismaClient({
22
+ datasources: {
23
+ db: {
24
+ url: dbUrl,
25
+ },
26
+ },
27
+ })
22
28
  }
23
29
  /**
24
30
  * Returns all experiments
@@ -139,7 +139,24 @@ const config = {
139
139
  config: {
140
140
  engineType: 'library',
141
141
  },
142
- binaryTargets: [],
142
+ binaryTargets: [
143
+ {
144
+ fromEnvVar: null,
145
+ value: 'darwin',
146
+ },
147
+ {
148
+ fromEnvVar: null,
149
+ value: 'darwin',
150
+ },
151
+ {
152
+ fromEnvVar: null,
153
+ value: 'darwin-arm64',
154
+ },
155
+ {
156
+ fromEnvVar: null,
157
+ value: 'debian-openssl-1.1.x',
158
+ },
159
+ ],
143
160
  previewFeatures: [],
144
161
  isCustomOutput: true,
145
162
  },
@@ -172,5 +189,11 @@ Object.assign(exports, Prisma)
172
189
 
173
190
  path.join(__dirname, 'libquery_engine-darwin.dylib.node')
174
191
  path.join(process.cwd(), './src/prisma-output/libquery_engine-darwin.dylib.node')
192
+
193
+ path.join(__dirname, 'libquery_engine-darwin-arm64.dylib.node')
194
+ path.join(process.cwd(), './src/prisma-output/libquery_engine-darwin-arm64.dylib.node')
195
+
196
+ path.join(__dirname, 'libquery_engine-debian-openssl-1.1.x.so.node')
197
+ path.join(process.cwd(), './src/prisma-output/libquery_engine-debian-openssl-1.1.x.so.node')
175
198
  path.join(__dirname, 'schema.prisma')
176
199
  path.join(process.cwd(), './src/prisma-output/schema.prisma')
@@ -1,6 +1,7 @@
1
1
  generator client {
2
2
  provider = "prisma-client-js"
3
3
  output = "../src/prisma-output"
4
+ binaryTargets = ["native", "darwin", "darwin-arm64", "debian-openssl-1.1.x"]
4
5
  }
5
6
 
6
7
  datasource db {