@geekmidas/manifest 10.0.0-alpha.6 → 10.0.0-alpha.61
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/index.cjs +232 -48
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +285 -92
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.mts +285 -92
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +218 -47
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
2
3
|
var __create = Object.create;
|
|
3
4
|
var __defProp = Object.defineProperty;
|
|
4
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
11
10
|
var __copyProps = (to, from, except, desc) => {
|
|
12
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
13
12
|
key = keys[i];
|
|
@@ -18,13 +17,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
17
|
}
|
|
19
18
|
return to;
|
|
20
19
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
22
21
|
value: mod,
|
|
23
22
|
enumerable: true
|
|
24
23
|
}) : target, mod));
|
|
25
|
-
|
|
26
24
|
//#endregion
|
|
27
|
-
|
|
28
25
|
//#region src/declaration.ts
|
|
29
26
|
/**
|
|
30
27
|
* The version used when a database names none.
|
|
@@ -60,23 +57,25 @@ const DERIVES_FROM = {
|
|
|
60
57
|
const PUBLIC = {
|
|
61
58
|
objects: [],
|
|
62
59
|
"file-server": ["url"],
|
|
63
|
-
email: [],
|
|
60
|
+
email: ["inboxUrl"],
|
|
64
61
|
database: [],
|
|
65
62
|
"database-reader": [],
|
|
66
63
|
"database-schema": [],
|
|
67
64
|
cache: [],
|
|
68
65
|
secret: [],
|
|
69
66
|
credential: [],
|
|
67
|
+
encryption: [],
|
|
70
68
|
"rest-api": ["url"],
|
|
71
69
|
queue: [],
|
|
72
70
|
topic: [],
|
|
73
71
|
oidc: ["issuer", "audience"],
|
|
72
|
+
"external-api": [],
|
|
74
73
|
function: [],
|
|
75
74
|
cron: [],
|
|
75
|
+
"mobile-app": [],
|
|
76
76
|
site: ["url"],
|
|
77
77
|
worker: []
|
|
78
78
|
};
|
|
79
|
-
|
|
80
79
|
//#endregion
|
|
81
80
|
//#region src/errors.ts
|
|
82
81
|
/**
|
|
@@ -135,20 +134,9 @@ var IllegalDerivation = class extends Error {
|
|
|
135
134
|
this.allowed = allowed;
|
|
136
135
|
}
|
|
137
136
|
};
|
|
138
|
-
|
|
139
137
|
//#endregion
|
|
140
|
-
//#region
|
|
141
|
-
var
|
|
142
|
-
/**
|
|
143
|
-
* lodash (Custom Build) <https://lodash.com/>
|
|
144
|
-
* Build: `lodash modularize exports="npm" -o ./`
|
|
145
|
-
* Copyright jQuery Foundation and other contributors <https://jquery.org/>
|
|
146
|
-
* Released under MIT license <https://lodash.com/license>
|
|
147
|
-
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
148
|
-
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
149
|
-
*/
|
|
150
|
-
/** Used as references for various `Number` constants. */
|
|
151
|
-
var INFINITY = Infinity;
|
|
138
|
+
//#region src/naming.ts
|
|
139
|
+
var import_lodash_snakecase = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
152
140
|
/** `Object#toString` result references. */
|
|
153
141
|
var symbolTag = "[object Symbol]";
|
|
154
142
|
/** Used to match words composed of alphanumeric characters. */
|
|
@@ -156,15 +144,46 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.snakecase@4.1
|
|
|
156
144
|
/** Used to match Latin Unicode letters (excluding mathematical operators). */
|
|
157
145
|
var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g;
|
|
158
146
|
/** Used to compose unicode character classes. */
|
|
159
|
-
var rsAstralRange = "\\ud800-\\udfff"
|
|
147
|
+
var rsAstralRange = "\\ud800-\\udfff";
|
|
148
|
+
var rsComboMarksRange = "\\u0300-\\u036f\\ufe20-\\ufe23";
|
|
149
|
+
var rsComboSymbolsRange = "\\u20d0-\\u20f0";
|
|
150
|
+
var rsDingbatRange = "\\u2700-\\u27bf";
|
|
151
|
+
var rsLowerRange = "a-z\\xdf-\\xf6\\xf8-\\xff";
|
|
152
|
+
var rsMathOpRange = "\\xac\\xb1\\xd7\\xf7";
|
|
153
|
+
var rsNonCharRange = "\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf";
|
|
154
|
+
var rsPunctuationRange = "\\u2000-\\u206f";
|
|
155
|
+
var rsSpaceRange = " \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000";
|
|
156
|
+
var rsUpperRange = "A-Z\\xc0-\\xd6\\xd8-\\xde";
|
|
157
|
+
var rsVarRange = "\\ufe0e\\ufe0f";
|
|
158
|
+
var rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange;
|
|
160
159
|
/** Used to compose unicode capture groups. */
|
|
161
|
-
var rsApos = "['’]"
|
|
160
|
+
var rsApos = "['’]";
|
|
161
|
+
var rsBreak = "[" + rsBreakRange + "]";
|
|
162
|
+
var rsCombo = "[" + rsComboMarksRange + rsComboSymbolsRange + "]";
|
|
163
|
+
var rsDigits = "\\d+";
|
|
164
|
+
var rsDingbat = "[" + rsDingbatRange + "]";
|
|
165
|
+
var rsLower = "[" + rsLowerRange + "]";
|
|
166
|
+
var rsMisc = "[^" + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + "]";
|
|
167
|
+
var rsModifier = "(?:" + rsCombo + "|\\ud83c[\\udffb-\\udfff])";
|
|
168
|
+
var rsNonAstral = "[^" + rsAstralRange + "]";
|
|
169
|
+
var rsRegional = "(?:\\ud83c[\\udde6-\\uddff]){2}";
|
|
170
|
+
var rsSurrPair = "[\\ud800-\\udbff][\\udc00-\\udfff]";
|
|
171
|
+
var rsUpper = "[" + rsUpperRange + "]";
|
|
172
|
+
var rsZWJ = "\\u200d";
|
|
162
173
|
/** Used to compose unicode regexes. */
|
|
163
|
-
var rsLowerMisc = "(?:" + rsLower + "|" + rsMisc + ")"
|
|
174
|
+
var rsLowerMisc = "(?:" + rsLower + "|" + rsMisc + ")";
|
|
175
|
+
var rsUpperMisc = "(?:" + rsUpper + "|" + rsMisc + ")";
|
|
176
|
+
var rsOptLowerContr = "(?:" + rsApos + "(?:d|ll|m|re|s|t|ve))?";
|
|
177
|
+
var rsOptUpperContr = "(?:" + rsApos + "(?:D|LL|M|RE|S|T|VE))?";
|
|
178
|
+
var reOptMod = rsModifier + "?";
|
|
179
|
+
var rsOptVar = "[" + rsVarRange + "]?";
|
|
180
|
+
var rsOptJoin = "(?:" + rsZWJ + "(?:" + [
|
|
164
181
|
rsNonAstral,
|
|
165
182
|
rsRegional,
|
|
166
183
|
rsSurrPair
|
|
167
|
-
].join("|") + ")" + rsOptVar + reOptMod + ")*"
|
|
184
|
+
].join("|") + ")" + rsOptVar + reOptMod + ")*";
|
|
185
|
+
var rsSeq = rsOptVar + reOptMod + rsOptJoin;
|
|
186
|
+
var rsEmoji = "(?:" + [
|
|
168
187
|
rsDingbat,
|
|
169
188
|
rsRegional,
|
|
170
189
|
rsSurrPair
|
|
@@ -463,18 +482,17 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.snakecase@4.1
|
|
|
463
482
|
function unicodeWords(string) {
|
|
464
483
|
return string.match(reUnicodeWord) || [];
|
|
465
484
|
}
|
|
466
|
-
/** Used for built-in method references. */
|
|
467
|
-
var objectProto = Object.prototype;
|
|
468
485
|
/**
|
|
469
486
|
* Used to resolve the
|
|
470
487
|
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
|
|
471
488
|
* of values.
|
|
472
489
|
*/
|
|
473
|
-
var objectToString =
|
|
490
|
+
var objectToString = Object.prototype.toString;
|
|
474
491
|
/** Built-in value references. */
|
|
475
492
|
var Symbol = root.Symbol;
|
|
476
493
|
/** Used to convert symbols to primitives and strings. */
|
|
477
|
-
var symbolProto = Symbol ? Symbol.prototype : void 0
|
|
494
|
+
var symbolProto = Symbol ? Symbol.prototype : void 0;
|
|
495
|
+
var symbolToString = symbolProto ? symbolProto.toString : void 0;
|
|
478
496
|
/**
|
|
479
497
|
* The base implementation of `_.toString` which doesn't convert nullish
|
|
480
498
|
* values to empty strings.
|
|
@@ -487,7 +505,7 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.snakecase@4.1
|
|
|
487
505
|
if (typeof value == "string") return value;
|
|
488
506
|
if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
|
|
489
507
|
var result = value + "";
|
|
490
|
-
return result == "0" && 1 / value == -
|
|
508
|
+
return result == "0" && 1 / value == -Infinity ? "-0" : result;
|
|
491
509
|
}
|
|
492
510
|
/**
|
|
493
511
|
* Creates a function like `_.camelCase`.
|
|
@@ -644,11 +662,7 @@ var require_lodash = __commonJS({ "../../node_modules/.pnpm/lodash.snakecase@4.1
|
|
|
644
662
|
return string.match(pattern) || [];
|
|
645
663
|
}
|
|
646
664
|
module.exports = snakeCase;
|
|
647
|
-
}
|
|
648
|
-
|
|
649
|
-
//#endregion
|
|
650
|
-
//#region src/naming.ts
|
|
651
|
-
var import_lodash = __toESM(require_lodash(), 1);
|
|
665
|
+
})))(), 1);
|
|
652
666
|
/**
|
|
653
667
|
* `UPPER_SNAKE_CASE`, with numbers kept against the word they follow.
|
|
654
668
|
*
|
|
@@ -660,7 +674,7 @@ var import_lodash = __toESM(require_lodash(), 1);
|
|
|
660
674
|
* @example environmentCase('api2') // 'API2' (digit joins its word)
|
|
661
675
|
*/
|
|
662
676
|
function environmentCase(name) {
|
|
663
|
-
return (0,
|
|
677
|
+
return (0, import_lodash_snakecase.default)(name).toUpperCase().replace(/_\d+/g, (r) => r.replace("_", ""));
|
|
664
678
|
}
|
|
665
679
|
/**
|
|
666
680
|
* The env key a construct provides for one of its roles.
|
|
@@ -685,7 +699,7 @@ function provideKey(id, role) {
|
|
|
685
699
|
* @example canonicalId('user-uploads') // 'UserUploads'
|
|
686
700
|
*/
|
|
687
701
|
function canonicalId(input) {
|
|
688
|
-
const id = (0,
|
|
702
|
+
const id = (0, import_lodash_snakecase.default)(input).split("_").filter(Boolean).map((part) => part.charAt(0).toUpperCase() + part.slice(1)).join("");
|
|
689
703
|
if (!VALID_ID.test(id)) throw new InvalidConstructId(input, id);
|
|
690
704
|
return id;
|
|
691
705
|
}
|
|
@@ -837,7 +851,6 @@ function cookieDomain(urls) {
|
|
|
837
851
|
function providedKeyFor(id, kind, role) {
|
|
838
852
|
return kind === "secret" ? environmentCase(id) : provideKey(id, role);
|
|
839
853
|
}
|
|
840
|
-
|
|
841
854
|
//#endregion
|
|
842
855
|
//#region src/derive.ts
|
|
843
856
|
/** Whether a declaration names a parent. */
|
|
@@ -936,7 +949,8 @@ function dependentsOf(manifest, id) {
|
|
|
936
949
|
const PUBLIC_PREFIX = {
|
|
937
950
|
static: "VITE_",
|
|
938
951
|
tanstack: "VITE_",
|
|
939
|
-
next: "NEXT_PUBLIC_"
|
|
952
|
+
next: "NEXT_PUBLIC_",
|
|
953
|
+
expo: "EXPO_PUBLIC_"
|
|
940
954
|
};
|
|
941
955
|
/**
|
|
942
956
|
* The keys a site's bundle needs, mapped to the key each value comes from —
|
|
@@ -969,20 +983,181 @@ function publicEnvFor(declaration, manifest) {
|
|
|
969
983
|
}
|
|
970
984
|
return keys;
|
|
971
985
|
}
|
|
972
|
-
|
|
973
986
|
//#endregion
|
|
974
|
-
//#region src/
|
|
975
|
-
/**
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
987
|
+
//#region src/encryption.ts
|
|
988
|
+
/**
|
|
989
|
+
* The `kms://` URL an `Encryption` construct reads on AWS.
|
|
990
|
+
*
|
|
991
|
+
* Here because two packages meet on it: `@geekmidas/cloud` composes it from
|
|
992
|
+
* the keys it provisioned, and `@geekmidas/constructs` parses it to reach
|
|
993
|
+
* them. One function, so the two cannot disagree about a parameter's name.
|
|
994
|
+
*/
|
|
995
|
+
const KMS_SCHEME = "kms:";
|
|
996
|
+
/**
|
|
997
|
+
* `kms://<region>?key=<key arn>&index=<hmac key arn>[&endpoint=<url>]`
|
|
998
|
+
*
|
|
999
|
+
* `endpoint` reaches an emulator instead of AWS — floci, locally and in tests —
|
|
1000
|
+
* the same parameter an `sns://` connection string carries for the same reason.
|
|
1001
|
+
*/
|
|
1002
|
+
function kmsUrl(input) {
|
|
1003
|
+
const query = new URLSearchParams({
|
|
1004
|
+
key: input.key,
|
|
1005
|
+
index: input.index,
|
|
1006
|
+
...input.endpoint ? { endpoint: input.endpoint } : {}
|
|
1007
|
+
});
|
|
1008
|
+
return `${KMS_SCHEME}//${input.region}?${query}`;
|
|
1009
|
+
}
|
|
1010
|
+
//#endregion
|
|
1011
|
+
//#region src/external.ts
|
|
1012
|
+
/** The key in a by-stage `url` that answers for every stage not listed. */
|
|
1013
|
+
const DEFAULT_STAGE_URL = "default";
|
|
1014
|
+
/**
|
|
1015
|
+
* Where an external API answers on a deployed stage.
|
|
1016
|
+
*
|
|
1017
|
+
* One URL answers every stage; a record answers by stage name, falling back
|
|
1018
|
+
* to `default`. Read at build and deploy, so a stage nobody gave a URL fails
|
|
1019
|
+
* there — with the stage named — rather than at the first request.
|
|
1020
|
+
*
|
|
1021
|
+
* @throws {NoUrlForStage} when a record names neither the stage nor a default.
|
|
1022
|
+
*/
|
|
1023
|
+
function externalApiUrl(declaration, stage) {
|
|
1024
|
+
const { url } = declaration;
|
|
1025
|
+
if (typeof url === "string") return url;
|
|
1026
|
+
const resolved = url[stage] ?? url["default"];
|
|
1027
|
+
if (!resolved) throw new NoUrlForStage(declaration.id, stage, Object.keys(url));
|
|
1028
|
+
return resolved;
|
|
1029
|
+
}
|
|
1030
|
+
/** An external API's `url` record has nothing for the stage being deployed. */
|
|
1031
|
+
var NoUrlForStage = class extends Error {
|
|
1032
|
+
id;
|
|
1033
|
+
stage;
|
|
1034
|
+
stages;
|
|
1035
|
+
constructor(id, stage, stages) {
|
|
1036
|
+
super(`'${id}' has no URL for the stage '${stage}': its url names ${stages.length ? stages.map((s) => `'${s}'`).join(", ") : "no stages"}. Add '${stage}', or a '${DEFAULT_STAGE_URL}' for every stage not listed.`);
|
|
1037
|
+
this.id = id;
|
|
1038
|
+
this.stage = stage;
|
|
1039
|
+
this.stages = stages;
|
|
1040
|
+
this.name = "NoUrlForStage";
|
|
1041
|
+
}
|
|
1042
|
+
};
|
|
1043
|
+
//#endregion
|
|
1044
|
+
//#region src/migrations.ts
|
|
1045
|
+
/** Where every construct's folder lives, from the project root. */
|
|
1046
|
+
const MIGRATIONS_ROOT = "db";
|
|
1047
|
+
/** The two folders a construct's folder holds, and nothing else. */
|
|
1048
|
+
const DATABASE_FOLDERS = ["migrations", "seeds"];
|
|
1049
|
+
/**
|
|
1050
|
+
* The constructs that take migrations, parents before the tenants inside them.
|
|
1051
|
+
*
|
|
1052
|
+
* A database and each schema tenant: every one has an owner role and a schema
|
|
1053
|
+
* of its own, and so a history of its own. A reader has neither — it reads its
|
|
1054
|
+
* parent's schema — and a cache's table is created by provisioning, not by a
|
|
1055
|
+
* migration anyone writes.
|
|
1056
|
+
*/
|
|
1057
|
+
function migrationTargets(manifest) {
|
|
1058
|
+
return provisionOrder(manifest).flatMap((id) => {
|
|
1059
|
+
const declaration = manifest[id];
|
|
1060
|
+
if (!declaration) return [];
|
|
1061
|
+
if (declaration.kind === "database") return [target(id)];
|
|
1062
|
+
if (declaration.kind === "database-schema") return [{
|
|
1063
|
+
...target(id),
|
|
1064
|
+
of: declaration.of
|
|
1065
|
+
}];
|
|
1066
|
+
return [];
|
|
1067
|
+
});
|
|
1068
|
+
}
|
|
1069
|
+
/**
|
|
1070
|
+
* A construct's folder, relative to the project root.
|
|
1071
|
+
*
|
|
1072
|
+
* Named by the construct — `AuthDatabase` is `db/auth-database` — in the case
|
|
1073
|
+
* every other name outside TypeScript takes. Lowercase, because a folder that
|
|
1074
|
+
* differs from another only in case is two folders on Linux and one on a Mac;
|
|
1075
|
+
* and `canonicalId` reads it back to the construct exactly, which is how a
|
|
1076
|
+
* folder naming nothing is caught rather than skipped.
|
|
1077
|
+
*/
|
|
1078
|
+
function databaseFolder(id) {
|
|
1079
|
+
return `db/${kebabCase(id)}`;
|
|
1080
|
+
}
|
|
1081
|
+
/** Where a construct's migrations live: `db/auth-database/migrations`. */
|
|
1082
|
+
function migrationFolder(id) {
|
|
1083
|
+
return `${databaseFolder(id)}/migrations`;
|
|
1084
|
+
}
|
|
1085
|
+
/**
|
|
1086
|
+
* Where a construct's seeds live: `db/auth-database/seeds`.
|
|
1087
|
+
*
|
|
1088
|
+
* Reference data the app needs to run — a permission catalogue, roles, lookup
|
|
1089
|
+
* tables. Seeds are upserts run on every pass, after the migrations, so a
|
|
1090
|
+
* changed seed is applied by running it again. Sample data is factories'.
|
|
1091
|
+
*/
|
|
1092
|
+
function seedFolder(id) {
|
|
1093
|
+
return `${databaseFolder(id)}/seeds`;
|
|
1094
|
+
}
|
|
1095
|
+
function target(id) {
|
|
1096
|
+
return {
|
|
1097
|
+
id,
|
|
1098
|
+
folder: databaseFolder(id),
|
|
1099
|
+
migrations: migrationFolder(id),
|
|
1100
|
+
seeds: seedFolder(id)
|
|
1101
|
+
};
|
|
979
1102
|
}
|
|
980
|
-
|
|
981
1103
|
//#endregion
|
|
1104
|
+
//#region src/mobile.ts
|
|
1105
|
+
/**
|
|
1106
|
+
* How a mobile app is reached: its URL scheme, and the origins a surface trusts
|
|
1107
|
+
* for it.
|
|
1108
|
+
*
|
|
1109
|
+
* Stated once, here, because three targets ask — the local one (`gkm dev`,
|
|
1110
|
+
* `gkm test`), Dokploy and AWS — and a scheme one of them derived differently
|
|
1111
|
+
* would be an app whose sign-in callback the auth server refuses on exactly one
|
|
1112
|
+
* of them.
|
|
1113
|
+
*/
|
|
1114
|
+
/**
|
|
1115
|
+
* An app's scheme: the one given, or the project's name made a valid scheme.
|
|
1116
|
+
*
|
|
1117
|
+
* One for every stage. A development build and the store build register the
|
|
1118
|
+
* same scheme, so the auth server of whichever stage a build talks to trusts
|
|
1119
|
+
* it, and nothing about the app differs between stages but its URLs.
|
|
1120
|
+
*
|
|
1121
|
+
* A scheme is a letter followed by letters, digits, `+`, `-` or `.` — so
|
|
1122
|
+
* `Corner Shop` becomes `corner-shop`, and a name that starts with a digit gets a
|
|
1123
|
+
* leading `app`.
|
|
1124
|
+
*/
|
|
1125
|
+
function schemeBase(project, given) {
|
|
1126
|
+
const raw = (given ?? project).toLowerCase().replace(/[^a-z0-9+.-]+/g, "-").replace(/^-+|-+$/g, "");
|
|
1127
|
+
if (!raw) return "app";
|
|
1128
|
+
return /^[a-z]/.test(raw) ? raw : `app${raw}`;
|
|
1129
|
+
}
|
|
1130
|
+
/**
|
|
1131
|
+
* The origins a surface trusts for a mobile caller.
|
|
1132
|
+
*
|
|
1133
|
+
* Better Auth's Expo plugin sends the app's scheme as its origin
|
|
1134
|
+
* (`shop://`), and a link can carry a path after it (`shop://*`).
|
|
1135
|
+
* In development, Expo Go sends `exp://<host>:<port>` instead — so a local
|
|
1136
|
+
* stage adds the hosts a device actually reaches Metro on, and Metro's port
|
|
1137
|
+
* when the target placed it: a whole subnet is not trusted because one phone
|
|
1138
|
+
* is on it.
|
|
1139
|
+
*/
|
|
1140
|
+
function mobileOrigins(scheme, metro) {
|
|
1141
|
+
return [
|
|
1142
|
+
`${scheme}://`,
|
|
1143
|
+
`${scheme}://*`,
|
|
1144
|
+
...(metro?.hosts ?? []).flatMap((host) => [`exp://${host}:${metro?.port ?? "*"}`, `exp://${host}:${metro?.port ?? "*"}/**`])
|
|
1145
|
+
];
|
|
1146
|
+
}
|
|
1147
|
+
/** Whether an origin is a web one — what a cookie domain is derived from. */
|
|
1148
|
+
function isWebOrigin(origin) {
|
|
1149
|
+
return origin.startsWith("http://") || origin.startsWith("https://");
|
|
1150
|
+
}
|
|
1151
|
+
//#endregion
|
|
1152
|
+
exports.DATABASE_FOLDERS = DATABASE_FOLDERS;
|
|
982
1153
|
exports.DEFAULT_POSTGRES_VERSION = DEFAULT_POSTGRES_VERSION;
|
|
1154
|
+
exports.DEFAULT_STAGE_URL = DEFAULT_STAGE_URL;
|
|
983
1155
|
exports.DERIVES_FROM = DERIVES_FROM;
|
|
984
1156
|
exports.IllegalDerivation = IllegalDerivation;
|
|
985
1157
|
exports.InvalidConstructId = InvalidConstructId;
|
|
1158
|
+
exports.KMS_SCHEME = KMS_SCHEME;
|
|
1159
|
+
exports.MIGRATIONS_ROOT = MIGRATIONS_ROOT;
|
|
1160
|
+
exports.NoUrlForStage = NoUrlForStage;
|
|
986
1161
|
exports.PUBLIC = PUBLIC;
|
|
987
1162
|
exports.PUBLIC_PREFIX = PUBLIC_PREFIX;
|
|
988
1163
|
exports.UnknownParent = UnknownParent;
|
|
@@ -991,16 +1166,25 @@ exports.cacheTable = cacheTable;
|
|
|
991
1166
|
exports.canonicalId = canonicalId;
|
|
992
1167
|
exports.cloudName = cloudName;
|
|
993
1168
|
exports.cookieDomain = cookieDomain;
|
|
1169
|
+
exports.databaseFolder = databaseFolder;
|
|
994
1170
|
exports.dependenciesOf = dependenciesOf;
|
|
995
1171
|
exports.dependentsOf = dependentsOf;
|
|
996
1172
|
exports.environmentCase = environmentCase;
|
|
997
|
-
exports.
|
|
1173
|
+
exports.externalApiUrl = externalApiUrl;
|
|
998
1174
|
exports.isDerived = isDerived;
|
|
1175
|
+
exports.isWebOrigin = isWebOrigin;
|
|
999
1176
|
exports.kebabCase = kebabCase;
|
|
1177
|
+
exports.kmsUrl = kmsUrl;
|
|
1178
|
+
exports.migrationFolder = migrationFolder;
|
|
1179
|
+
exports.migrationTargets = migrationTargets;
|
|
1180
|
+
exports.mobileOrigins = mobileOrigins;
|
|
1000
1181
|
exports.provideKey = provideKey;
|
|
1001
1182
|
exports.providedKeyFor = providedKeyFor;
|
|
1002
1183
|
exports.provisionOrder = provisionOrder;
|
|
1003
1184
|
exports.publicEnvFor = publicEnvFor;
|
|
1185
|
+
exports.schemeBase = schemeBase;
|
|
1004
1186
|
exports.scopedName = scopedName;
|
|
1187
|
+
exports.seedFolder = seedFolder;
|
|
1005
1188
|
exports.serviceKey = serviceKey;
|
|
1189
|
+
|
|
1006
1190
|
//# sourceMappingURL=index.cjs.map
|