@haatlabs-core/templates 0.15.1 → 0.16.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@haatlabs-core/templates",
3
- "version": "0.15.1",
3
+ "version": "0.16.0",
4
4
  "description": "The starter files and shared project files that @haatlabs-core/cli writes.",
5
5
  "keywords": [
6
6
  "haatlabs"
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "devDependencies": {
38
38
  "playwright-core": "1.63.0",
39
- "@haatlabs-core/tsconfig": "0.15.1",
40
- "@haatlabs-core/vitest-config": "0.15.1"
39
+ "@haatlabs-core/vitest-config": "0.16.0",
40
+ "@haatlabs-core/tsconfig": "0.16.0"
41
41
  },
42
42
  "scripts": {
43
43
  "build": "rm -rf dist && tsc -p tsconfig.build.json",
@@ -8,6 +8,7 @@ import {
8
8
  ApiKeyRepository,
9
9
  BillingRepository,
10
10
  ExtensionKeyRepository,
11
+ UserIdentityRepository,
11
12
  FeatureRepository,
12
13
  IdentityRepository,
13
14
  #@if kindShopify
@@ -114,6 +115,11 @@ export class AppModule {
114
115
  useFactory: (keys: ExtensionKeyRepository) => keys,
115
116
  inject: [ExtensionKeyRepository],
116
117
  },
118
+ // Signing in with Google or GitHub, where their keys are set.
119
+ identityLinks: {
120
+ useFactory: (links: UserIdentityRepository) => links,
121
+ inject: [UserIdentityRepository],
122
+ },
117
123
  },
118
124
  connectableExtensions: config.extension.ids,
119
125
  #@if kindShopify
@@ -7,6 +7,7 @@ import {
7
7
  ApiKeyRepository,
8
8
  BillingRepository,
9
9
  ExtensionKeyRepository,
10
+ UserIdentityRepository,
10
11
  FeatureRepository,
11
12
  IdentityRepository,
12
13
  WebhookEventRepository,
@@ -237,6 +238,11 @@ export class InfraModule {
237
238
  new ExtensionKeyRepository(s.db, a.db),
238
239
  inject: [SYSTEM_DB, APP_DB],
239
240
  },
241
+ {
242
+ provide: UserIdentityRepository,
243
+ useFactory: (s: DatabaseHandle) => new UserIdentityRepository(s.db),
244
+ inject: [SYSTEM_DB],
245
+ },
240
246
  #@if kindShopify
241
247
  {
242
248
  provide: StoreRepository,
@@ -112,6 +112,16 @@ ALLOW_FIXED_SIGN_IN_CODE=false
112
112
  # as <email>:<eight digits>, e.g. review@example.com:12345678. Only that email takes the
113
113
  # code, so production may set it: it opens that one account. No email is sent to it.
114
114
  SIGN_IN_REVIEW_ACCOUNT=
115
+ # false: sign-in codes are not emailed, and people sign in with SIGN_IN_FIXED_CODE (which it
116
+ # needs). For dev or staging, to send no code emails there. Other emails still go out.
117
+ SIGN_IN_EMAIL=true
118
+ # Signing in with Google and GitHub: the shared Haatlabs Google OAuth client and GitHub App
119
+ # (see social-sign-in-setup.md). Both of a pair set turns that button on; leave a pair empty
120
+ # and it is not offered. The callback is <API_BASE_URL>/api/v1/auth/oauth/<google|github>/callback.
121
+ GOOGLE_OAUTH_CLIENT_ID=
122
+ GOOGLE_OAUTH_CLIENT_SECRET=
123
+ GITHUB_OAUTH_CLIENT_ID=
124
+ GITHUB_OAUTH_CLIENT_SECRET=
115
125
 
116
126
  # The browser extensions (their ids, comma-separated) a person may connect to this app from
117
127
  # /connect/extension: the app's own extension (`haatlabs create --kind extension`). Empty: none.
@@ -0,0 +1,13 @@
1
+ CREATE TABLE "user_identities" (
2
+ "id" uuid PRIMARY KEY DEFAULT gen_random_uuid() NOT NULL,
3
+ "user_id" uuid NOT NULL,
4
+ "provider" text NOT NULL,
5
+ "provider_user_id" text NOT NULL,
6
+ "email_at_link" text NOT NULL,
7
+ "created_at" timestamp with time zone DEFAULT now() NOT NULL,
8
+ "updated_at" timestamp with time zone DEFAULT now() NOT NULL,
9
+ CONSTRAINT "user_identities_provider_user_unique" UNIQUE("provider","provider_user_id")
10
+ );
11
+ --> statement-breakpoint
12
+ ALTER TABLE "user_identities" ADD CONSTRAINT "user_identities_user_id_users_id_fk" FOREIGN KEY ("user_id") REFERENCES "public"."users"("id") ON DELETE cascade ON UPDATE no action;--> statement-breakpoint
13
+ CREATE INDEX "user_identities_user_idx" ON "user_identities" USING btree ("user_id");