@marktiderman/genesis-supabase 0.6.2 → 0.8.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/README.md +128 -7
- package/dist/blocks.d.ts +18 -1
- package/dist/blocks.js +1 -1
- package/dist/chunk-7SCMHKCR.js +33 -0
- package/dist/chunk-7SCMHKCR.js.map +1 -0
- package/dist/{chunk-ONBOLMXH.js → chunk-DYHH2G4A.js} +37 -3
- package/dist/chunk-DYHH2G4A.js.map +1 -0
- package/dist/chunk-XGAXPUFY.js +124 -0
- package/dist/chunk-XGAXPUFY.js.map +1 -0
- package/dist/{index-Ds0tO9WP.d.ts → index-D73YuwEY.d.ts} +4 -4
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/jobs.d.ts +3 -1
- package/dist/jobs.js +48 -34
- package/dist/jobs.js.map +1 -1
- package/dist/native.d.ts +2 -2
- package/dist/runner.d.ts +179 -0
- package/dist/runner.js +3 -0
- package/dist/runner.js.map +1 -0
- package/dist/web-handoff-path-C_EEl_BC.d.ts +16 -0
- package/dist/web-handoff-server.d.ts +225 -0
- package/dist/web-handoff-server.js +262 -0
- package/dist/web-handoff-server.js.map +1 -0
- package/dist/web-handoff.d.ts +133 -0
- package/dist/web-handoff.js +104 -0
- package/dist/web-handoff.js.map +1 -0
- package/migrations/0009_genesis_owner_access.sql +89 -0
- package/migrations/0014_genesis_feature_registry_hardening.sql +124 -0
- package/migrations/0015_genesis_web_handoff.sql +270 -0
- package/migrations/tests/0009_genesis_owner_access.test.sql +70 -0
- package/migrations/tests/0014_genesis_feature_registry_hardening.test.sql +54 -0
- package/migrations/tests/0015_genesis_web_handoff.test.sql +203 -0
- package/package.json +88 -3
- package/dist/chunk-ONBOLMXH.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@marktiderman/genesis-supabase",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
7
|
-
"description": "Supabase for Genesis apps on web and React Native: a client with PKCE and safe defaults, Keychain session storage that survives interrupted writes, refresh only while the app is in front, native Sign in with Apple and Google, OAuth redirects, in-app account deletion, per-tenant feature switches (tenant_features), a background-job queue with schedules (genesis_jobs), the feature registry in the database for the feature gate (features, entitlements, flag values, feature_on), and a result helper. Part of the Genesis framework.",
|
|
7
|
+
"description": "Supabase for Genesis apps on web and React Native: a client with PKCE and safe defaults, Keychain session storage that survives interrupted writes, refresh only while the app is in front, native Sign in with Apple and Google, OAuth redirects, in-app account deletion, per-tenant feature switches (tenant_features), a background-job queue with schedules (genesis_jobs) on one outbox engine (/runner, shared with notifications and forms), the feature registry in the database for the feature gate (features, entitlements, flag values, feature_on), a native-to-web sign-in handoff (continue on the web, already signed in: web-handoff), and a result helper. Part of the Genesis framework.",
|
|
8
8
|
"repository": {
|
|
9
9
|
"type": "git",
|
|
10
10
|
"url": "git+https://github.com/marktiderman/genesis.git",
|
|
@@ -35,6 +35,18 @@
|
|
|
35
35
|
"./jobs": {
|
|
36
36
|
"types": "./dist/jobs.d.ts",
|
|
37
37
|
"import": "./dist/jobs.js"
|
|
38
|
+
},
|
|
39
|
+
"./runner": {
|
|
40
|
+
"types": "./dist/runner.d.ts",
|
|
41
|
+
"import": "./dist/runner.js"
|
|
42
|
+
},
|
|
43
|
+
"./web-handoff": {
|
|
44
|
+
"types": "./dist/web-handoff.d.ts",
|
|
45
|
+
"import": "./dist/web-handoff.js"
|
|
46
|
+
},
|
|
47
|
+
"./web-handoff/server": {
|
|
48
|
+
"types": "./dist/web-handoff-server.d.ts",
|
|
49
|
+
"import": "./dist/web-handoff-server.js"
|
|
38
50
|
}
|
|
39
51
|
},
|
|
40
52
|
"files": [
|
|
@@ -180,10 +192,83 @@
|
|
|
180
192
|
{
|
|
181
193
|
"file": "migrations/0008_genesis_feature_registry.sql",
|
|
182
194
|
"test": "migrations/tests/0008_genesis_feature_registry.test.sql"
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
"file": "migrations/0014_genesis_feature_registry_hardening.sql",
|
|
198
|
+
"test": "migrations/tests/0014_genesis_feature_registry_hardening.test.sql"
|
|
199
|
+
}
|
|
200
|
+
],
|
|
201
|
+
"steps": [
|
|
202
|
+
"Sync the registry on every deploy with the service key: syncFeatureRegistry(admin, features.json, { version: BUILD_TIME } (the build time, from a production deployment only)). Grant paid features by writing feature_entitlements from your billing webhook."
|
|
203
|
+
]
|
|
204
|
+
},
|
|
205
|
+
"owner-access": {
|
|
206
|
+
"feature": {
|
|
207
|
+
"name": "Owner access",
|
|
208
|
+
"summary": "The owner-access contract: fail-closed wrappers (genesis_owner_readable, genesis_owner_allows) over the app's two hooks, for every Genesis block whose rows belong to a person, a team or the tenant.",
|
|
209
|
+
"keywords": [
|
|
210
|
+
"access",
|
|
211
|
+
"owners",
|
|
212
|
+
"row level security",
|
|
213
|
+
"tenants",
|
|
214
|
+
"teams"
|
|
215
|
+
],
|
|
216
|
+
"audience": [
|
|
217
|
+
"developer"
|
|
218
|
+
]
|
|
219
|
+
},
|
|
220
|
+
"platforms": [
|
|
221
|
+
"web",
|
|
222
|
+
"native"
|
|
223
|
+
],
|
|
224
|
+
"requires": [
|
|
225
|
+
"tenant-features"
|
|
226
|
+
],
|
|
227
|
+
"migrations": [
|
|
228
|
+
{
|
|
229
|
+
"file": "migrations/0009_genesis_owner_access.sql",
|
|
230
|
+
"test": "migrations/tests/0009_genesis_owner_access.test.sql"
|
|
183
231
|
}
|
|
184
232
|
],
|
|
233
|
+
"install": [
|
|
234
|
+
"@supabase/supabase-js@^2.118.0"
|
|
235
|
+
],
|
|
236
|
+
"steps": [
|
|
237
|
+
"Define private.genesis_owner_can(tenant, viewer, person_id, team_id, organization_id, action) and private.genesis_readable_owners(viewer) in your own migration, as the header of 0009 shows. Without them the wrappers answer no."
|
|
238
|
+
]
|
|
239
|
+
},
|
|
240
|
+
"web-handoff": {
|
|
241
|
+
"feature": {
|
|
242
|
+
"name": "Continue on the web",
|
|
243
|
+
"summary": "A native app opens a web page signed in as the same person: a single-use, 60-second link minted by the server for the person's own account, confirmed on the page unless that browser is already signed in as them.",
|
|
244
|
+
"keywords": [
|
|
245
|
+
"handoff",
|
|
246
|
+
"open on web",
|
|
247
|
+
"magic link",
|
|
248
|
+
"single sign-on",
|
|
249
|
+
"continue on web"
|
|
250
|
+
],
|
|
251
|
+
"audience": [
|
|
252
|
+
"person"
|
|
253
|
+
]
|
|
254
|
+
},
|
|
255
|
+
"platforms": [
|
|
256
|
+
"web",
|
|
257
|
+
"native"
|
|
258
|
+
],
|
|
259
|
+
"migrations": [
|
|
260
|
+
{
|
|
261
|
+
"file": "migrations/0015_genesis_web_handoff.sql",
|
|
262
|
+
"test": "migrations/tests/0015_genesis_web_handoff.test.sql"
|
|
263
|
+
}
|
|
264
|
+
],
|
|
265
|
+
"install": [
|
|
266
|
+
"@supabase/supabase-js@^2.118.0"
|
|
267
|
+
],
|
|
185
268
|
"steps": [
|
|
186
|
-
"
|
|
269
|
+
"Add two POST routes with createWebHandoff from @marktiderman/genesis-supabase/web-handoff/server (mint at /api/auth/handoff, redeem at /api/auth/redeem-handoff), using the service-role client on the server.",
|
|
270
|
+
"Add the /auth/handoff page: call takeWebHandoffFragment before analytics or error reporting load, then completeWebHandoff; send Referrer-Policy: no-referrer and frame-ancestors 'none' for it.",
|
|
271
|
+
"In the native app, call openOnWeb from @marktiderman/genesis-native/web-handoff with the mint route, the session's access token and expo-web-browser."
|
|
187
272
|
]
|
|
188
273
|
}
|
|
189
274
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/blocks.ts"],"names":[],"mappings":";;;AAQA,IAAM,OAAA,GAAU,gCAAA;AAST,IAAM,eAAe,WAAA,CAAY;AAAA,EACtC,EAAA,EAAI,SAAA;AAAA,EACJ,S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A,EAC5C,EAAA,EAAI,gBAAA;AAAA,EACJ,QAAA,EAAU,CAAC,iBAAiB,CAAA;AAAA,EAC5B,WAAA,EAAa;AAAA,IACX,UAAA,EAAY;AAAA,MACV;AAAA,QACE,OAAA,EAAS,OAAA;AAAA,QACT,IAAA,EAAM,8CAAA;AAAA,QACN,IAAA,EAAM;AAAA;AACR,KACF;AAAA,IACA,OAAA,EAAS;AAAA,MACP,KAAA,EAAO;AAAA,QACL;AAAA;AACF;AACF;AAEJ,CAAC;AAQM,IAAM,YAAY,WAAA,CAAY;AAAA,EACnC,EAAA,EAAI,MAAA;AAAA,EACJ,SAAA,EAAW,CAAC,KAAK,CAAA;AAAA,EACjB,WAAA,EAAa;AAAA,IACX,UAAA,EAAY,CAAC,EAAE,OAAA,EAAS,SAAS,IAAA,EAAM,kCAAA,EAAoC,IAAA,EAAM,6CAAA,EAA+C,CAAA;AAAA,IAChI,OAAA,EAAS,EAAE,KAAA,EAAO,CAAC,2FAA2F,CAAA;AAAE;AAEpH,CAAC","file":"chunk-ONBOLMXH.js","sourcesContent":["/**\n * The blocks this package carries the server half of, as `defineBlock`\n * declarations: what each needs in the database, and what it means for the\n * stores' privacy forms. The functions themselves (`deleteMyAccount`,\n * `tenantFeatures`, …) don't change.\n */\nimport { defineBlock } from \"@marktiderman/genesis-features/blocks\";\n\nconst PACKAGE = \"@marktiderman/genesis-supabase\";\n\n/**\n * The account block: sign-in, profile and in-app account deletion. Its\n * screens are the app's (or genesis-ui-native's `AuthScreen`); this names its\n * migrations and its data.\n *\n * @stability Beta\n */\nexport const accountBlock = defineBlock({\n id: \"account\",\n platforms: [\"web\", \"native\"],\n contributes: {\n migrations: [\n {\n package: PACKAGE,\n file: \"migrations/0001_genesis_account_deletion.sql\",\n test: \"migrations/tests/0001_genesis_account_deletion.test.sql\",\n },\n // With Sign in with Apple, with the genesis-apple-revoke function beside it.\n {\n package: PACKAGE,\n file: \"migrations/0003_genesis_apple_token_revocation.sql\",\n test: \"migrations/tests/0003_genesis_apple_token_revocation.test.sql\",\n },\n ],\n privacy: {\n collects: [\n {\n type: \"email address\",\n purposes: [\"app functionality\"],\n linked: true,\n tracking: false,\n },\n {\n type: \"user id\",\n purposes: [\"app functionality\"],\n linked: true,\n tracking: false,\n },\n {\n type: \"name\",\n purposes: [\"app functionality\"],\n linked: true,\n tracking: false,\n },\n ],\n notes: [\n \"People delete their account from inside the app; their login and the rows that cascade from it go with it.\",\n \"With Sign in with Apple, the person's Apple tokens are revoked when the account is deleted.\",\n ],\n },\n },\n});\n\n/**\n * The tenant features block: per-tenant on/off switches for shipped\n * features, set by the tenant's admins with a reason.\n *\n * @stability Beta\n */\nexport const tenantFeaturesBlock = defineBlock({\n id: \"tenant-features\",\n contributes: {\n migrations: [\n {\n package: PACKAGE,\n file: \"migrations/0004_genesis_tenant_features.sql\",\n test: \"migrations/tests/0004_genesis_tenant_features.test.sql\",\n },\n ],\n privacy: {\n notes: [\n \"Keeps who changed a tenant's switches; a deleted person's changes stay, without the person.\",\n ],\n },\n },\n});\n\n/**\n * The feature registry block: the registry mirrored into the app's database\n * on deploy, entitlements, per-tenant and platform flag values and SQL `feature_on()`,\n * for the feature gate. Needs the tenant features block.\n *\n * @stability Beta\n */\nexport const featureMirrorBlock = defineBlock({\n id: \"feature-mirror\",\n requires: [\"tenant-features\"],\n contributes: {\n migrations: [\n {\n package: PACKAGE,\n file: \"migrations/0008_genesis_feature_registry.sql\",\n test: \"migrations/tests/0008_genesis_feature_registry.test.sql\",\n },\n ],\n privacy: {\n notes: [\n \"Stores which tenants hold which paid features and flag values; no personal data.\",\n ],\n },\n },\n});\n\n/**\n * The jobs block: a background-job queue and named schedules that call the\n * app's job route. Server only; the route is `createJobsHandler` from `/jobs`.\n *\n * @stability Beta\n */\nexport const jobsBlock = defineBlock({\n id: \"jobs\",\n platforms: [\"web\"],\n contributes: {\n migrations: [{ package: PACKAGE, file: \"migrations/0007_genesis_jobs.sql\", test: \"migrations/tests/0007_genesis_jobs.test.sql\" }],\n privacy: { notes: [\"Job payloads hold ids, never content or secrets; finished jobs are deleted after 14 days.\"] },\n },\n});\n"]}
|