@haatlabs-core/templates 0.15.0 → 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 +3 -3
- package/starter/apps/api/src/app.module.ts +6 -0
- package/starter/apps/api/src/infra/infra.module.ts +6 -0
- package/starter/dot-env.example +14 -0
- package/starter/packages/database/drizzle/0007_user_identities.sql +13 -0
- package/starter/packages/database/drizzle/meta/0007_snapshot.json +1902 -0
- package/starter/packages/database/drizzle/meta/_journal.json +8 -1
- package/starter/packages/database/src/index.ts +1 -0
- package/starter/packages/database/src/repositories/user-identity.repository.ts +10 -0
- package/starter/packages/database/src/schema/identity.ts +12 -0
- package/starter/packages/web-ui/src/api-client.ts +7 -0
- package/starter/packages/web-ui/src/pages/UsagePage.test.tsx +3 -3
- package/starter/packages/web-ui/src/testing/fake-client.ts +2 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@haatlabs-core/templates",
|
|
3
|
-
"version": "0.
|
|
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/vitest-config": "0.
|
|
40
|
-
"@haatlabs-core/tsconfig": "0.
|
|
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,
|
package/starter/dot-env.example
CHANGED
|
@@ -108,6 +108,20 @@ SIGN_IN_FIXED_CODE=
|
|
|
108
108
|
# that is not the real one, such as dev, while it has no mail server: anyone who can reach
|
|
109
109
|
# it and knows the code can sign in as any email. Never where customers sign in.
|
|
110
110
|
ALLOW_FIXED_SIGN_IN_CODE=false
|
|
111
|
+
# One account a reviewer (a payment provider, an app store) signs in to with a known code,
|
|
112
|
+
# as <email>:<eight digits>, e.g. review@example.com:12345678. Only that email takes the
|
|
113
|
+
# code, so production may set it: it opens that one account. No email is sent to it.
|
|
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=
|
|
111
125
|
|
|
112
126
|
# The browser extensions (their ids, comma-separated) a person may connect to this app from
|
|
113
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");
|