quidproquo-core 0.1.27 → 0.1.29
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/lib/commonjs/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.d.ts +2 -0
- package/lib/commonjs/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.js +6 -0
- package/lib/commonjs/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.js.map +1 -0
- package/lib/commonjs/config/deploySettings/getDeploySetting.d.ts +6 -0
- package/lib/commonjs/config/deploySettings/getDeploySetting.js +18 -0
- package/lib/commonjs/config/deploySettings/getDeploySetting.js.map +1 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingEnvName.d.ts +2 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingEnvName.js +8 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingEnvName.js.map +1 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingList.d.ts +2 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingList.js +11 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingList.js.map +1 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingOrDefault.d.ts +2 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingOrDefault.js +8 -0
- package/lib/commonjs/config/deploySettings/getDeploySettingOrDefault.js.map +1 -0
- package/lib/commonjs/config/deploySettings/index.d.ts +5 -0
- package/lib/commonjs/config/deploySettings/index.js +22 -0
- package/lib/commonjs/config/deploySettings/index.js.map +1 -0
- package/lib/commonjs/config/index.d.ts +1 -0
- package/lib/commonjs/config/index.js +1 -0
- package/lib/commonjs/config/index.js.map +1 -1
- package/lib/commonjs/deployment/QpqAppDeployConfig.d.ts +10 -0
- package/lib/commonjs/deployment/QpqAppDeployConfig.js +3 -0
- package/lib/commonjs/deployment/QpqAppDeployConfig.js.map +1 -0
- package/lib/commonjs/deployment/QpqAppDeploySettings.d.ts +6 -0
- package/lib/commonjs/deployment/QpqAppDeploySettings.js +3 -0
- package/lib/commonjs/deployment/QpqAppDeploySettings.js.map +1 -0
- package/lib/commonjs/deployment/QpqAppDeployment.d.ts +11 -0
- package/lib/commonjs/deployment/QpqAppDeployment.js +3 -0
- package/lib/commonjs/deployment/QpqAppDeployment.js.map +1 -0
- package/lib/commonjs/deployment/QpqAppDeploymentBase.d.ts +8 -0
- package/lib/commonjs/deployment/QpqAppDeploymentBase.js +3 -0
- package/lib/commonjs/deployment/QpqAppDeploymentBase.js.map +1 -0
- package/lib/commonjs/deployment/QpqDeployEnvVar.d.ts +12 -0
- package/lib/commonjs/deployment/QpqDeployEnvVar.js +18 -0
- package/lib/commonjs/deployment/QpqDeployEnvVar.js.map +1 -0
- package/lib/commonjs/deployment/index.d.ts +5 -0
- package/lib/commonjs/deployment/index.js +22 -0
- package/lib/commonjs/deployment/index.js.map +1 -0
- package/lib/commonjs/index.d.ts +1 -0
- package/lib/commonjs/index.js +1 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/utils/uuid/generateUuid.d.ts +9 -5
- package/lib/commonjs/utils/uuid/generateUuid.js +28 -6
- package/lib/commonjs/utils/uuid/generateUuid.js.map +1 -1
- package/lib/esm/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.d.ts +2 -0
- package/lib/esm/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.js +3 -0
- package/lib/esm/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.js.map +1 -0
- package/lib/esm/config/deploySettings/getDeploySetting.d.ts +6 -0
- package/lib/esm/config/deploySettings/getDeploySetting.js +14 -0
- package/lib/esm/config/deploySettings/getDeploySetting.js.map +1 -0
- package/lib/esm/config/deploySettings/getDeploySettingEnvName.d.ts +2 -0
- package/lib/esm/config/deploySettings/getDeploySettingEnvName.js +4 -0
- package/lib/esm/config/deploySettings/getDeploySettingEnvName.js.map +1 -0
- package/lib/esm/config/deploySettings/getDeploySettingList.d.ts +2 -0
- package/lib/esm/config/deploySettings/getDeploySettingList.js +7 -0
- package/lib/esm/config/deploySettings/getDeploySettingList.js.map +1 -0
- package/lib/esm/config/deploySettings/getDeploySettingOrDefault.d.ts +2 -0
- package/lib/esm/config/deploySettings/getDeploySettingOrDefault.js +4 -0
- package/lib/esm/config/deploySettings/getDeploySettingOrDefault.js.map +1 -0
- package/lib/esm/config/deploySettings/index.d.ts +5 -0
- package/lib/esm/config/deploySettings/index.js +6 -0
- package/lib/esm/config/deploySettings/index.js.map +1 -0
- package/lib/esm/config/index.d.ts +1 -0
- package/lib/esm/config/index.js +1 -0
- package/lib/esm/config/index.js.map +1 -1
- package/lib/esm/deployment/QpqAppDeployConfig.d.ts +10 -0
- package/lib/esm/deployment/QpqAppDeployConfig.js +2 -0
- package/lib/esm/deployment/QpqAppDeployConfig.js.map +1 -0
- package/lib/esm/deployment/QpqAppDeploySettings.d.ts +6 -0
- package/lib/esm/deployment/QpqAppDeploySettings.js +2 -0
- package/lib/esm/deployment/QpqAppDeploySettings.js.map +1 -0
- package/lib/esm/deployment/QpqAppDeployment.d.ts +11 -0
- package/lib/esm/deployment/QpqAppDeployment.js +2 -0
- package/lib/esm/deployment/QpqAppDeployment.js.map +1 -0
- package/lib/esm/deployment/QpqAppDeploymentBase.d.ts +8 -0
- package/lib/esm/deployment/QpqAppDeploymentBase.js +2 -0
- package/lib/esm/deployment/QpqAppDeploymentBase.js.map +1 -0
- package/lib/esm/deployment/QpqDeployEnvVar.d.ts +12 -0
- package/lib/esm/deployment/QpqDeployEnvVar.js +15 -0
- package/lib/esm/deployment/QpqDeployEnvVar.js.map +1 -0
- package/lib/esm/deployment/index.d.ts +5 -0
- package/lib/esm/deployment/index.js +6 -0
- package/lib/esm/deployment/index.js.map +1 -0
- package/lib/esm/index.d.ts +1 -0
- package/lib/esm/index.js +1 -0
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/utils/uuid/generateUuid.d.ts +9 -5
- package/lib/esm/utils/uuid/generateUuid.js +27 -6
- package/lib/esm/utils/uuid/generateUuid.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEPLOY_SETTING_ENV_PREFIX = void 0;
|
|
4
|
+
/** Prefix on the env var each deploy setting is delivered through. */
|
|
5
|
+
exports.DEPLOY_SETTING_ENV_PREFIX = 'DEPLOY_SETTING_';
|
|
6
|
+
//# sourceMappingURL=DEPLOY_SETTING_ENV_PREFIX.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DEPLOY_SETTING_ENV_PREFIX.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.ts"],"names":[],"mappings":";;;AAAA,sEAAsE;AACzD,QAAA,yBAAyB,GAAG,iBAAiB,CAAC","sourcesContent":["/** Prefix on the env var each deploy setting is delivered through. */\nexport const DEPLOY_SETTING_ENV_PREFIX = 'DEPLOY_SETTING_';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deploy setting from the selected deployment's `settings` in deploy.config.json,
|
|
3
|
+
* for use in infrastructure.ts and config helpers. Throws when the setting is not
|
|
4
|
+
* defined, so a typo can't deploy an empty value.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDeploySetting: (key: string) => string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeploySetting = void 0;
|
|
4
|
+
const getDeploySettingEnvName_1 = require("./getDeploySettingEnvName");
|
|
5
|
+
/**
|
|
6
|
+
* A deploy setting from the selected deployment's `settings` in deploy.config.json,
|
|
7
|
+
* for use in infrastructure.ts and config helpers. Throws when the setting is not
|
|
8
|
+
* defined, so a typo can't deploy an empty value.
|
|
9
|
+
*/
|
|
10
|
+
const getDeploySetting = (key) => {
|
|
11
|
+
const value = process.env[(0, getDeploySettingEnvName_1.getDeploySettingEnvName)(key)];
|
|
12
|
+
if (value === undefined) {
|
|
13
|
+
throw new Error(`Deploy setting '${key}' is not defined. Add it to the deployment's "settings" in deploy.config.json.`);
|
|
14
|
+
}
|
|
15
|
+
return value;
|
|
16
|
+
};
|
|
17
|
+
exports.getDeploySetting = getDeploySetting;
|
|
18
|
+
//# sourceMappingURL=getDeploySetting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySetting.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySetting.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAEpE;;;;GAIG;AACI,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAU,EAAE;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAA,iDAAuB,EAAC,GAAG,CAAC,CAAC,CAAC;IAExD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,gFAAgF,CAAC,CAAC;IAC1H,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AARW,QAAA,gBAAgB,oBAQ3B","sourcesContent":["import { getDeploySettingEnvName } from './getDeploySettingEnvName';\n\n/**\n * A deploy setting from the selected deployment's `settings` in deploy.config.json,\n * for use in infrastructure.ts and config helpers. Throws when the setting is not\n * defined, so a typo can't deploy an empty value.\n */\nexport const getDeploySetting = (key: string): string => {\n const value = process.env[getDeploySettingEnvName(key)];\n\n if (value === undefined) {\n throw new Error(`Deploy setting '${key}' is not defined. Add it to the deployment's \"settings\" in deploy.config.json.`);\n }\n\n return value;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeploySettingEnvName = void 0;
|
|
4
|
+
const DEPLOY_SETTING_ENV_PREFIX_1 = require("./DEPLOY_SETTING_ENV_PREFIX");
|
|
5
|
+
/** The env var that carries the deploy setting `key` (the key is used verbatim, no case conversion). */
|
|
6
|
+
const getDeploySettingEnvName = (key) => `${DEPLOY_SETTING_ENV_PREFIX_1.DEPLOY_SETTING_ENV_PREFIX}${key}`;
|
|
7
|
+
exports.getDeploySettingEnvName = getDeploySettingEnvName;
|
|
8
|
+
//# sourceMappingURL=getDeploySettingEnvName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingEnvName.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingEnvName.ts"],"names":[],"mappings":";;;AAAA,2EAAwE;AAExE,wGAAwG;AACjG,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,qDAAyB,GAAG,GAAG,EAAE,CAAC;AAAxF,QAAA,uBAAuB,2BAAiE","sourcesContent":["import { DEPLOY_SETTING_ENV_PREFIX } from './DEPLOY_SETTING_ENV_PREFIX';\n\n/** The env var that carries the deploy setting `key` (the key is used verbatim, no case conversion). */\nexport const getDeploySettingEnvName = (key: string): string => `${DEPLOY_SETTING_ENV_PREFIX}${key}`;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeploySettingList = void 0;
|
|
4
|
+
const getDeploySetting_1 = require("./getDeploySetting");
|
|
5
|
+
/** A comma-separated deploy setting as a trimmed list, empty items dropped. Throws like `getDeploySetting` when unset. */
|
|
6
|
+
const getDeploySettingList = (key) => (0, getDeploySetting_1.getDeploySetting)(key)
|
|
7
|
+
.split(',')
|
|
8
|
+
.map((item) => item.trim())
|
|
9
|
+
.filter(Boolean);
|
|
10
|
+
exports.getDeploySettingList = getDeploySettingList;
|
|
11
|
+
//# sourceMappingURL=getDeploySettingList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingList.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingList.ts"],"names":[],"mappings":";;;AAAA,yDAAsD;AAEtD,0HAA0H;AACnH,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAY,EAAE,CAC5D,IAAA,mCAAgB,EAAC,GAAG,CAAC;KAClB,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,OAAO,CAAC,CAAC;AAJR,QAAA,oBAAoB,wBAIZ","sourcesContent":["import { getDeploySetting } from './getDeploySetting';\n\n/** A comma-separated deploy setting as a trimmed list, empty items dropped. Throws like `getDeploySetting` when unset. */\nexport const getDeploySettingList = (key: string): string[] =>\n getDeploySetting(key)\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getDeploySettingOrDefault = void 0;
|
|
4
|
+
const getDeploySettingEnvName_1 = require("./getDeploySettingEnvName");
|
|
5
|
+
/** A deploy setting from the selected deployment, or `fallback` when the deployment does not define it. */
|
|
6
|
+
const getDeploySettingOrDefault = (key, fallback) => { var _a; return (_a = process.env[(0, getDeploySettingEnvName_1.getDeploySettingEnvName)(key)]) !== null && _a !== void 0 ? _a : fallback; };
|
|
7
|
+
exports.getDeploySettingOrDefault = getDeploySettingOrDefault;
|
|
8
|
+
//# sourceMappingURL=getDeploySettingOrDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingOrDefault.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingOrDefault.ts"],"names":[],"mappings":";;;AAAA,uEAAoE;AAEpE,2GAA2G;AACpG,MAAM,yBAAyB,GAAG,CAAC,GAAW,EAAE,QAAgB,EAAU,EAAE,WAAC,OAAA,MAAA,OAAO,CAAC,GAAG,CAAC,IAAA,iDAAuB,EAAC,GAAG,CAAC,CAAC,mCAAI,QAAQ,CAAA,EAAA,CAAC;AAA7H,QAAA,yBAAyB,6BAAoG","sourcesContent":["import { getDeploySettingEnvName } from './getDeploySettingEnvName';\n\n/** A deploy setting from the selected deployment, or `fallback` when the deployment does not define it. */\nexport const getDeploySettingOrDefault = (key: string, fallback: string): string => process.env[getDeploySettingEnvName(key)] ?? fallback;\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./DEPLOY_SETTING_ENV_PREFIX"), exports);
|
|
18
|
+
__exportStar(require("./getDeploySetting"), exports);
|
|
19
|
+
__exportStar(require("./getDeploySettingEnvName"), exports);
|
|
20
|
+
__exportStar(require("./getDeploySettingList"), exports);
|
|
21
|
+
__exportStar(require("./getDeploySettingOrDefault"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,qDAAmC;AACnC,4DAA0C;AAC1C,yDAAuC;AACvC,8DAA4C","sourcesContent":["export * from './DEPLOY_SETTING_ENV_PREFIX';\nexport * from './getDeploySetting';\nexport * from './getDeploySettingEnvName';\nexport * from './getDeploySettingList';\nexport * from './getDeploySettingOrDefault';\n"]}
|
|
@@ -14,6 +14,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./deploySettings"), exports);
|
|
17
18
|
__exportStar(require("./QPQConfig"), exports);
|
|
18
19
|
__exportStar(require("./settings"), exports);
|
|
19
20
|
__exportStar(require("./utils"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './QPQConfig';\nexport * from './settings';\nexport * from './utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,8CAA4B;AAC5B,6CAA2B;AAC3B,0CAAwB","sourcesContent":["export * from './deploySettings';\nexport * from './QPQConfig';\nexport * from './settings';\nexport * from './utils';\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { QpqAppDeployment } from './QpqAppDeployment';
|
|
2
|
+
/**
|
|
3
|
+
* apps/<app>/deploy.config.json: the single source of truth for where and as what
|
|
4
|
+
* an app deploys. Kept as JSON so tooling can read it before any TS executes. Nothing
|
|
5
|
+
* in it is overridden by env vars or flags; to change a value, change the file or add
|
|
6
|
+
* an entry. Holds identity and settings only, never credentials.
|
|
7
|
+
*/
|
|
8
|
+
export type QpqAppDeployConfig = {
|
|
9
|
+
deployments: Record<string, QpqAppDeployment>;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeployConfig.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeployConfig.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeployment } from './QpqAppDeployment';\n\n/**\n * apps/<app>/deploy.config.json: the single source of truth for where and as what\n * an app deploys. Kept as JSON so tooling can read it before any TS executes. Nothing\n * in it is overridden by env vars or flags; to change a value, change the file or add\n * an entry. Holds identity and settings only, never credentials.\n */\nexport type QpqAppDeployConfig = {\n // deployment name -> target. The name is what `qpq go --deployment <name>` selects.\n deployments: Record<string, QpqAppDeployment>;\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-deployment values handed to infrastructure.ts as `DEPLOY_SETTING_<key>` env vars
|
|
3
|
+
* (read them with `getDeploySetting` from quidproquo-core). Keys are used verbatim as
|
|
4
|
+
* the env var suffix, values are always strings. Committed in cleartext: never a secret.
|
|
5
|
+
*/
|
|
6
|
+
export type QpqAppDeploySettings = Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeploySettings.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeploySettings.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Per-deployment values handed to infrastructure.ts as `DEPLOY_SETTING_<key>` env vars\n * (read them with `getDeploySetting` from quidproquo-core). Keys are used verbatim as\n * the env var suffix, values are always strings. Committed in cleartext: never a secret.\n */\nexport type QpqAppDeploySettings = Record<string, string>;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QpqAppDeploymentBase } from './QpqAppDeploymentBase';
|
|
2
|
+
/**
|
|
3
|
+
* One entry under `deployments` in apps/<app>/deploy.config.json. `platform` names the
|
|
4
|
+
* CLI driver; `platformSettings` is a flat string map, like `settings`, whose required
|
|
5
|
+
* keys each platform checks for itself (quidproquo-config-aws for aws), so this layer
|
|
6
|
+
* stays open to platforms it has never heard of.
|
|
7
|
+
*/
|
|
8
|
+
export type QpqAppDeployment = QpqAppDeploymentBase & {
|
|
9
|
+
platform: string;
|
|
10
|
+
platformSettings?: Record<string, string>;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeployment.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeployment.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeploymentBase } from './QpqAppDeploymentBase';\n\n/**\n * One entry under `deployments` in apps/<app>/deploy.config.json. `platform` names the\n * CLI driver; `platformSettings` is a flat string map, like `settings`, whose required\n * keys each platform checks for itself (quidproquo-config-aws for aws), so this layer\n * stays open to platforms it has never heard of.\n */\nexport type QpqAppDeployment = QpqAppDeploymentBase & {\n platform: string;\n platformSettings?: Record<string, string>;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QpqAppDeploySettings } from './QpqAppDeploySettings';
|
|
2
|
+
/** The identity every deployment carries, whatever platform it targets. */
|
|
3
|
+
export type QpqAppDeploymentBase = {
|
|
4
|
+
name: string;
|
|
5
|
+
environment: string;
|
|
6
|
+
feature?: string;
|
|
7
|
+
settings?: QpqAppDeploySettings;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeploymentBase.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeploymentBase.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeploySettings } from './QpqAppDeploySettings';\n\n/** The identity every deployment carries, whatever platform it targets. */\nexport type QpqAppDeploymentBase = {\n // Application name: prefixes every stack and resource, so two deployments of one\n // codebase with different names (say two products built from one repo) never share anything.\n name: string;\n\n environment: string;\n\n // Optional feature/actor suffix for a personal or feature-branch stack set.\n feature?: string;\n\n settings?: QpqAppDeploySettings;\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The env vars a selected deployment is delivered through. Service configs and deploy
|
|
3
|
+
* tooling read these at load time, so they are primed before any infrastructure.ts is
|
|
4
|
+
* required. Platform identity vars are declared by the platform (see quidproquo-config-aws).
|
|
5
|
+
*/
|
|
6
|
+
export declare enum QpqDeployEnvVar {
|
|
7
|
+
deployAppName = "DEPLOY_APP_NAME",
|
|
8
|
+
deployName = "DEPLOY_NAME",
|
|
9
|
+
applicationName = "APPLICATION_NAME",
|
|
10
|
+
environment = "ENVIRONMENT",
|
|
11
|
+
featureName = "FEATURE_NAME"
|
|
12
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.QpqDeployEnvVar = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The env vars a selected deployment is delivered through. Service configs and deploy
|
|
6
|
+
* tooling read these at load time, so they are primed before any infrastructure.ts is
|
|
7
|
+
* required. Platform identity vars are declared by the platform (see quidproquo-config-aws).
|
|
8
|
+
*/
|
|
9
|
+
var QpqDeployEnvVar;
|
|
10
|
+
(function (QpqDeployEnvVar) {
|
|
11
|
+
// The app folder under apps/ and the deployment name within its deploy.config.json.
|
|
12
|
+
QpqDeployEnvVar["deployAppName"] = "DEPLOY_APP_NAME";
|
|
13
|
+
QpqDeployEnvVar["deployName"] = "DEPLOY_NAME";
|
|
14
|
+
QpqDeployEnvVar["applicationName"] = "APPLICATION_NAME";
|
|
15
|
+
QpqDeployEnvVar["environment"] = "ENVIRONMENT";
|
|
16
|
+
QpqDeployEnvVar["featureName"] = "FEATURE_NAME";
|
|
17
|
+
})(QpqDeployEnvVar || (exports.QpqDeployEnvVar = QpqDeployEnvVar = {}));
|
|
18
|
+
//# sourceMappingURL=QpqDeployEnvVar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqDeployEnvVar.js","sourceRoot":"","sources":["../../../src/deployment/QpqDeployEnvVar.ts"],"names":[],"mappings":";;;AAAA;;;;GAIG;AACH,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,oFAAoF;IACpF,oDAAiC,CAAA;IACjC,6CAA0B,CAAA;IAE1B,uDAAoC,CAAA;IACpC,8CAA2B,CAAA;IAC3B,+CAA4B,CAAA;AAC9B,CAAC,EARW,eAAe,+BAAf,eAAe,QAQ1B","sourcesContent":["/**\n * The env vars a selected deployment is delivered through. Service configs and deploy\n * tooling read these at load time, so they are primed before any infrastructure.ts is\n * required. Platform identity vars are declared by the platform (see quidproquo-config-aws).\n */\nexport enum QpqDeployEnvVar {\n // The app folder under apps/ and the deployment name within its deploy.config.json.\n deployAppName = 'DEPLOY_APP_NAME',\n deployName = 'DEPLOY_NAME',\n\n applicationName = 'APPLICATION_NAME',\n environment = 'ENVIRONMENT',\n featureName = 'FEATURE_NAME',\n}\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./QpqAppDeployConfig"), exports);
|
|
18
|
+
__exportStar(require("./QpqAppDeployment"), exports);
|
|
19
|
+
__exportStar(require("./QpqAppDeploymentBase"), exports);
|
|
20
|
+
__exportStar(require("./QpqAppDeploySettings"), exports);
|
|
21
|
+
__exportStar(require("./QpqDeployEnvVar"), exports);
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deployment/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,uDAAqC;AACrC,qDAAmC;AACnC,yDAAuC;AACvC,yDAAuC;AACvC,oDAAkC","sourcesContent":["export * from './QpqAppDeployConfig';\nexport * from './QpqAppDeployment';\nexport * from './QpqAppDeploymentBase';\nexport * from './QpqAppDeploySettings';\nexport * from './QpqDeployEnvVar';\n"]}
|
package/lib/commonjs/index.d.ts
CHANGED
package/lib/commonjs/index.js
CHANGED
|
@@ -18,6 +18,7 @@ __exportStar(require("./actions"), exports);
|
|
|
18
18
|
__exportStar(require("./config"), exports);
|
|
19
19
|
__exportStar(require("./constants"), exports);
|
|
20
20
|
__exportStar(require("./createImplementationRuntime"), exports);
|
|
21
|
+
__exportStar(require("./deployment"), exports);
|
|
21
22
|
__exportStar(require("./logic"), exports);
|
|
22
23
|
__exportStar(require("./logic/actionLogic"), exports);
|
|
23
24
|
__exportStar(require("./proiseify"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,8CAA4B;AAC5B,gEAA8C;AAC9C,0CAAwB;AACxB,sDAAoC;AACpC,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,+CAA6B","sourcesContent":["export * from './actions';\nexport * from './config';\nexport * from './constants';\nexport * from './createImplementationRuntime';\nexport * from './logic';\nexport * from './logic/actionLogic';\nexport * from './proiseify';\nexport * from './qpqCoreUtilsLib';\nexport * from './qpqExecuteLog';\nexport * from './runtime';\nexport * from './stories';\nexport * from './testing';\nexport * from './types';\nexport * from './utils';\nexport * from './validators';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,4CAA0B;AAC1B,2CAAyB;AACzB,8CAA4B;AAC5B,gEAA8C;AAC9C,+CAA6B;AAC7B,0CAAwB;AACxB,sDAAoC;AACpC,8CAA4B;AAC5B,oDAAkC;AAClC,kDAAgC;AAChC,4CAA0B;AAC1B,4CAA0B;AAC1B,4CAA0B;AAC1B,0CAAwB;AACxB,0CAAwB;AACxB,+CAA6B","sourcesContent":["export * from './actions';\nexport * from './config';\nexport * from './constants';\nexport * from './createImplementationRuntime';\nexport * from './deployment';\nexport * from './logic';\nexport * from './logic/actionLogic';\nexport * from './proiseify';\nexport * from './qpqCoreUtilsLib';\nexport * from './qpqExecuteLog';\nexport * from './runtime';\nexport * from './stories';\nexport * from './testing';\nexport * from './types';\nexport * from './utils';\nexport * from './validators';\n"]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates a new random (version 4) UUID.
|
|
3
3
|
*
|
|
4
|
-
* This is the single place in quidproquo to mint a v4 UUID
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* This is the single place in quidproquo to mint a v4 UUID, so it works across
|
|
5
|
+
* both backend and frontend packages with no external dependency.
|
|
6
|
+
*
|
|
7
|
+
* It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a
|
|
8
|
+
* SECURE context: https or localhost). Browsers deliberately hide that method on
|
|
9
|
+
* plain-http origins, which is exactly where a self-hosted app on a LAN ip lives
|
|
10
|
+
* (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout
|
|
11
|
+
* from `crypto.getRandomValues()`, which is available everywhere.
|
|
9
12
|
*
|
|
10
13
|
* @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.
|
|
11
14
|
*/
|
|
12
15
|
export declare function generateUuid(): string;
|
|
16
|
+
export declare function generateUuidFromRandomValues(cryptoApi: Pick<Crypto, 'getRandomValues'>): string;
|
|
@@ -1,18 +1,40 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.generateUuid = generateUuid;
|
|
4
|
+
exports.generateUuidFromRandomValues = generateUuidFromRandomValues;
|
|
4
5
|
/**
|
|
5
6
|
* Generates a new random (version 4) UUID.
|
|
6
7
|
*
|
|
7
|
-
* This is the single place in quidproquo to mint a v4 UUID
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
8
|
+
* This is the single place in quidproquo to mint a v4 UUID, so it works across
|
|
9
|
+
* both backend and frontend packages with no external dependency.
|
|
10
|
+
*
|
|
11
|
+
* It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a
|
|
12
|
+
* SECURE context: https or localhost). Browsers deliberately hide that method on
|
|
13
|
+
* plain-http origins, which is exactly where a self-hosted app on a LAN ip lives
|
|
14
|
+
* (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout
|
|
15
|
+
* from `crypto.getRandomValues()`, which is available everywhere.
|
|
12
16
|
*
|
|
13
17
|
* @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.
|
|
14
18
|
*/
|
|
15
19
|
function generateUuid() {
|
|
16
|
-
|
|
20
|
+
// lib.dom types the global as always present; older runtimes (Node before 19,
|
|
21
|
+
// some workers) don't expose it, so treat it as optional and fail loudly. No
|
|
22
|
+
// Math.random() last resort: a guessable id is worse than no id.
|
|
23
|
+
const cryptoApi = globalThis.crypto;
|
|
24
|
+
if (typeof (cryptoApi === null || cryptoApi === void 0 ? void 0 : cryptoApi.randomUUID) === 'function') {
|
|
25
|
+
return cryptoApi.randomUUID();
|
|
26
|
+
}
|
|
27
|
+
if (typeof (cryptoApi === null || cryptoApi === void 0 ? void 0 : cryptoApi.getRandomValues) !== 'function') {
|
|
28
|
+
throw new Error('generateUuid: no Web Crypto API available in this environment');
|
|
29
|
+
}
|
|
30
|
+
return generateUuidFromRandomValues(cryptoApi);
|
|
31
|
+
}
|
|
32
|
+
// RFC 4122 v4 from 16 random bytes: version nibble 4 in byte 6, variant 10xx in byte 8.
|
|
33
|
+
function generateUuidFromRandomValues(cryptoApi) {
|
|
34
|
+
const bytes = cryptoApi.getRandomValues(new Uint8Array(16));
|
|
35
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
36
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
37
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
38
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
17
39
|
}
|
|
18
40
|
//# sourceMappingURL=generateUuid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateUuid.js","sourceRoot":"","sources":["../../../../src/utils/uuid/generateUuid.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"generateUuid.js","sourceRoot":"","sources":["../../../../src/utils/uuid/generateUuid.ts"],"names":[],"mappings":";;AAcA,oCAeC;AAGD,oEASC;AAzCD;;;;;;;;;;;;;GAaG;AACH,SAAgB,YAAY;IAC1B,8EAA8E;IAC9E,6EAA6E;IAC7E,iEAAiE;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,MAA4B,CAAC;IAE1D,IAAI,OAAO,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,UAAU,CAAA,KAAK,UAAU,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,CAAA,SAAS,aAAT,SAAS,uBAAT,SAAS,CAAE,eAAe,CAAA,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,4BAA4B,CAAC,SAAS,CAAC,CAAC;AACjD,CAAC;AAED,wFAAwF;AACxF,SAAgB,4BAA4B,CAAC,SAA0C;IACrF,MAAM,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5D,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAErF,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * Generates a new random (version 4) UUID.\n *\n * This is the single place in quidproquo to mint a v4 UUID, so it works across\n * both backend and frontend packages with no external dependency.\n *\n * It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a\n * SECURE context: https or localhost). Browsers deliberately hide that method on\n * plain-http origins, which is exactly where a self-hosted app on a LAN ip lives\n * (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout\n * from `crypto.getRandomValues()`, which is available everywhere.\n *\n * @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.\n */\nexport function generateUuid(): string {\n // lib.dom types the global as always present; older runtimes (Node before 19,\n // some workers) don't expose it, so treat it as optional and fail loudly. No\n // Math.random() last resort: a guessable id is worse than no id.\n const cryptoApi = globalThis.crypto as Crypto | undefined;\n\n if (typeof cryptoApi?.randomUUID === 'function') {\n return cryptoApi.randomUUID();\n }\n\n if (typeof cryptoApi?.getRandomValues !== 'function') {\n throw new Error('generateUuid: no Web Crypto API available in this environment');\n }\n\n return generateUuidFromRandomValues(cryptoApi);\n}\n\n// RFC 4122 v4 from 16 random bytes: version nibble 4 in byte 6, variant 10xx in byte 8.\nexport function generateUuidFromRandomValues(cryptoApi: Pick<Crypto, 'getRandomValues'>): string {\n const bytes = cryptoApi.getRandomValues(new Uint8Array(16));\n\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DEPLOY_SETTING_ENV_PREFIX.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/DEPLOY_SETTING_ENV_PREFIX.ts"],"names":[],"mappings":"AAAA,sEAAsE;AACtE,MAAM,CAAC,MAAM,yBAAyB,GAAG,iBAAiB,CAAC","sourcesContent":["/** Prefix on the env var each deploy setting is delivered through. */\nexport const DEPLOY_SETTING_ENV_PREFIX = 'DEPLOY_SETTING_';\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A deploy setting from the selected deployment's `settings` in deploy.config.json,
|
|
3
|
+
* for use in infrastructure.ts and config helpers. Throws when the setting is not
|
|
4
|
+
* defined, so a typo can't deploy an empty value.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getDeploySetting: (key: string) => string;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { getDeploySettingEnvName } from './getDeploySettingEnvName';
|
|
2
|
+
/**
|
|
3
|
+
* A deploy setting from the selected deployment's `settings` in deploy.config.json,
|
|
4
|
+
* for use in infrastructure.ts and config helpers. Throws when the setting is not
|
|
5
|
+
* defined, so a typo can't deploy an empty value.
|
|
6
|
+
*/
|
|
7
|
+
export const getDeploySetting = (key) => {
|
|
8
|
+
const value = process.env[getDeploySettingEnvName(key)];
|
|
9
|
+
if (value === undefined) {
|
|
10
|
+
throw new Error(`Deploy setting '${key}' is not defined. Add it to the deployment's "settings" in deploy.config.json.`);
|
|
11
|
+
}
|
|
12
|
+
return value;
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=getDeploySetting.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySetting.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySetting.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,GAAW,EAAU,EAAE;IACtD,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,CAAC;IAExD,IAAI,KAAK,KAAK,SAAS,EAAE,CAAC;QACxB,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,gFAAgF,CAAC,CAAC;IAC1H,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC","sourcesContent":["import { getDeploySettingEnvName } from './getDeploySettingEnvName';\n\n/**\n * A deploy setting from the selected deployment's `settings` in deploy.config.json,\n * for use in infrastructure.ts and config helpers. Throws when the setting is not\n * defined, so a typo can't deploy an empty value.\n */\nexport const getDeploySetting = (key: string): string => {\n const value = process.env[getDeploySettingEnvName(key)];\n\n if (value === undefined) {\n throw new Error(`Deploy setting '${key}' is not defined. Add it to the deployment's \"settings\" in deploy.config.json.`);\n }\n\n return value;\n};\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { DEPLOY_SETTING_ENV_PREFIX } from './DEPLOY_SETTING_ENV_PREFIX';
|
|
2
|
+
/** The env var that carries the deploy setting `key` (the key is used verbatim, no case conversion). */
|
|
3
|
+
export const getDeploySettingEnvName = (key) => `${DEPLOY_SETTING_ENV_PREFIX}${key}`;
|
|
4
|
+
//# sourceMappingURL=getDeploySettingEnvName.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingEnvName.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingEnvName.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE,wGAAwG;AACxG,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAAW,EAAU,EAAE,CAAC,GAAG,yBAAyB,GAAG,GAAG,EAAE,CAAC","sourcesContent":["import { DEPLOY_SETTING_ENV_PREFIX } from './DEPLOY_SETTING_ENV_PREFIX';\n\n/** The env var that carries the deploy setting `key` (the key is used verbatim, no case conversion). */\nexport const getDeploySettingEnvName = (key: string): string => `${DEPLOY_SETTING_ENV_PREFIX}${key}`;\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { getDeploySetting } from './getDeploySetting';
|
|
2
|
+
/** A comma-separated deploy setting as a trimmed list, empty items dropped. Throws like `getDeploySetting` when unset. */
|
|
3
|
+
export const getDeploySettingList = (key) => getDeploySetting(key)
|
|
4
|
+
.split(',')
|
|
5
|
+
.map((item) => item.trim())
|
|
6
|
+
.filter(Boolean);
|
|
7
|
+
//# sourceMappingURL=getDeploySettingList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingList.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingList.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAEtD,0HAA0H;AAC1H,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAW,EAAY,EAAE,CAC5D,gBAAgB,CAAC,GAAG,CAAC;KAClB,KAAK,CAAC,GAAG,CAAC;KACV,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC;KAC1B,MAAM,CAAC,OAAO,CAAC,CAAC","sourcesContent":["import { getDeploySetting } from './getDeploySetting';\n\n/** A comma-separated deploy setting as a trimmed list, empty items dropped. Throws like `getDeploySetting` when unset. */\nexport const getDeploySettingList = (key: string): string[] =>\n getDeploySetting(key)\n .split(',')\n .map((item) => item.trim())\n .filter(Boolean);\n"]}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { getDeploySettingEnvName } from './getDeploySettingEnvName';
|
|
2
|
+
/** A deploy setting from the selected deployment, or `fallback` when the deployment does not define it. */
|
|
3
|
+
export const getDeploySettingOrDefault = (key, fallback) => process.env[getDeploySettingEnvName(key)] ?? fallback;
|
|
4
|
+
//# sourceMappingURL=getDeploySettingOrDefault.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getDeploySettingOrDefault.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/getDeploySettingOrDefault.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,uBAAuB,EAAE,MAAM,2BAA2B,CAAC;AAEpE,2GAA2G;AAC3G,MAAM,CAAC,MAAM,yBAAyB,GAAG,CAAC,GAAW,EAAE,QAAgB,EAAU,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC,IAAI,QAAQ,CAAC","sourcesContent":["import { getDeploySettingEnvName } from './getDeploySettingEnvName';\n\n/** A deploy setting from the selected deployment, or `fallback` when the deployment does not define it. */\nexport const getDeploySettingOrDefault = (key: string, fallback: string): string => process.env[getDeploySettingEnvName(key)] ?? fallback;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/config/deploySettings/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oBAAoB,CAAC;AACnC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC","sourcesContent":["export * from './DEPLOY_SETTING_ENV_PREFIX';\nexport * from './getDeploySetting';\nexport * from './getDeploySettingEnvName';\nexport * from './getDeploySettingList';\nexport * from './getDeploySettingOrDefault';\n"]}
|
package/lib/esm/config/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './QPQConfig';\nexport * from './settings';\nexport * from './utils';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/config/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,SAAS,CAAC","sourcesContent":["export * from './deploySettings';\nexport * from './QPQConfig';\nexport * from './settings';\nexport * from './utils';\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { QpqAppDeployment } from './QpqAppDeployment';
|
|
2
|
+
/**
|
|
3
|
+
* apps/<app>/deploy.config.json: the single source of truth for where and as what
|
|
4
|
+
* an app deploys. Kept as JSON so tooling can read it before any TS executes. Nothing
|
|
5
|
+
* in it is overridden by env vars or flags; to change a value, change the file or add
|
|
6
|
+
* an entry. Holds identity and settings only, never credentials.
|
|
7
|
+
*/
|
|
8
|
+
export type QpqAppDeployConfig = {
|
|
9
|
+
deployments: Record<string, QpqAppDeployment>;
|
|
10
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeployConfig.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeployConfig.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeployment } from './QpqAppDeployment';\n\n/**\n * apps/<app>/deploy.config.json: the single source of truth for where and as what\n * an app deploys. Kept as JSON so tooling can read it before any TS executes. Nothing\n * in it is overridden by env vars or flags; to change a value, change the file or add\n * an entry. Holds identity and settings only, never credentials.\n */\nexport type QpqAppDeployConfig = {\n // deployment name -> target. The name is what `qpq go --deployment <name>` selects.\n deployments: Record<string, QpqAppDeployment>;\n};\n"]}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-deployment values handed to infrastructure.ts as `DEPLOY_SETTING_<key>` env vars
|
|
3
|
+
* (read them with `getDeploySetting` from quidproquo-core). Keys are used verbatim as
|
|
4
|
+
* the env var suffix, values are always strings. Committed in cleartext: never a secret.
|
|
5
|
+
*/
|
|
6
|
+
export type QpqAppDeploySettings = Record<string, string>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeploySettings.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeploySettings.ts"],"names":[],"mappings":"","sourcesContent":["/**\n * Per-deployment values handed to infrastructure.ts as `DEPLOY_SETTING_<key>` env vars\n * (read them with `getDeploySetting` from quidproquo-core). Keys are used verbatim as\n * the env var suffix, values are always strings. Committed in cleartext: never a secret.\n */\nexport type QpqAppDeploySettings = Record<string, string>;\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { QpqAppDeploymentBase } from './QpqAppDeploymentBase';
|
|
2
|
+
/**
|
|
3
|
+
* One entry under `deployments` in apps/<app>/deploy.config.json. `platform` names the
|
|
4
|
+
* CLI driver; `platformSettings` is a flat string map, like `settings`, whose required
|
|
5
|
+
* keys each platform checks for itself (quidproquo-config-aws for aws), so this layer
|
|
6
|
+
* stays open to platforms it has never heard of.
|
|
7
|
+
*/
|
|
8
|
+
export type QpqAppDeployment = QpqAppDeploymentBase & {
|
|
9
|
+
platform: string;
|
|
10
|
+
platformSettings?: Record<string, string>;
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeployment.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeployment.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeploymentBase } from './QpqAppDeploymentBase';\n\n/**\n * One entry under `deployments` in apps/<app>/deploy.config.json. `platform` names the\n * CLI driver; `platformSettings` is a flat string map, like `settings`, whose required\n * keys each platform checks for itself (quidproquo-config-aws for aws), so this layer\n * stays open to platforms it has never heard of.\n */\nexport type QpqAppDeployment = QpqAppDeploymentBase & {\n platform: string;\n platformSettings?: Record<string, string>;\n};\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { QpqAppDeploySettings } from './QpqAppDeploySettings';
|
|
2
|
+
/** The identity every deployment carries, whatever platform it targets. */
|
|
3
|
+
export type QpqAppDeploymentBase = {
|
|
4
|
+
name: string;
|
|
5
|
+
environment: string;
|
|
6
|
+
feature?: string;
|
|
7
|
+
settings?: QpqAppDeploySettings;
|
|
8
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqAppDeploymentBase.js","sourceRoot":"","sources":["../../../src/deployment/QpqAppDeploymentBase.ts"],"names":[],"mappings":"","sourcesContent":["import { QpqAppDeploySettings } from './QpqAppDeploySettings';\n\n/** The identity every deployment carries, whatever platform it targets. */\nexport type QpqAppDeploymentBase = {\n // Application name: prefixes every stack and resource, so two deployments of one\n // codebase with different names (say two products built from one repo) never share anything.\n name: string;\n\n environment: string;\n\n // Optional feature/actor suffix for a personal or feature-branch stack set.\n feature?: string;\n\n settings?: QpqAppDeploySettings;\n};\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The env vars a selected deployment is delivered through. Service configs and deploy
|
|
3
|
+
* tooling read these at load time, so they are primed before any infrastructure.ts is
|
|
4
|
+
* required. Platform identity vars are declared by the platform (see quidproquo-config-aws).
|
|
5
|
+
*/
|
|
6
|
+
export declare enum QpqDeployEnvVar {
|
|
7
|
+
deployAppName = "DEPLOY_APP_NAME",
|
|
8
|
+
deployName = "DEPLOY_NAME",
|
|
9
|
+
applicationName = "APPLICATION_NAME",
|
|
10
|
+
environment = "ENVIRONMENT",
|
|
11
|
+
featureName = "FEATURE_NAME"
|
|
12
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The env vars a selected deployment is delivered through. Service configs and deploy
|
|
3
|
+
* tooling read these at load time, so they are primed before any infrastructure.ts is
|
|
4
|
+
* required. Platform identity vars are declared by the platform (see quidproquo-config-aws).
|
|
5
|
+
*/
|
|
6
|
+
export var QpqDeployEnvVar;
|
|
7
|
+
(function (QpqDeployEnvVar) {
|
|
8
|
+
// The app folder under apps/ and the deployment name within its deploy.config.json.
|
|
9
|
+
QpqDeployEnvVar["deployAppName"] = "DEPLOY_APP_NAME";
|
|
10
|
+
QpqDeployEnvVar["deployName"] = "DEPLOY_NAME";
|
|
11
|
+
QpqDeployEnvVar["applicationName"] = "APPLICATION_NAME";
|
|
12
|
+
QpqDeployEnvVar["environment"] = "ENVIRONMENT";
|
|
13
|
+
QpqDeployEnvVar["featureName"] = "FEATURE_NAME";
|
|
14
|
+
})(QpqDeployEnvVar || (QpqDeployEnvVar = {}));
|
|
15
|
+
//# sourceMappingURL=QpqDeployEnvVar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"QpqDeployEnvVar.js","sourceRoot":"","sources":["../../../src/deployment/QpqDeployEnvVar.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,oFAAoF;IACpF,oDAAiC,CAAA;IACjC,6CAA0B,CAAA;IAE1B,uDAAoC,CAAA;IACpC,8CAA2B,CAAA;IAC3B,+CAA4B,CAAA;AAC9B,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B","sourcesContent":["/**\n * The env vars a selected deployment is delivered through. Service configs and deploy\n * tooling read these at load time, so they are primed before any infrastructure.ts is\n * required. Platform identity vars are declared by the platform (see quidproquo-config-aws).\n */\nexport enum QpqDeployEnvVar {\n // The app folder under apps/ and the deployment name within its deploy.config.json.\n deployAppName = 'DEPLOY_APP_NAME',\n deployName = 'DEPLOY_NAME',\n\n applicationName = 'APPLICATION_NAME',\n environment = 'ENVIRONMENT',\n featureName = 'FEATURE_NAME',\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/deployment/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC","sourcesContent":["export * from './QpqAppDeployConfig';\nexport * from './QpqAppDeployment';\nexport * from './QpqAppDeploymentBase';\nexport * from './QpqAppDeploySettings';\nexport * from './QpqDeployEnvVar';\n"]}
|
package/lib/esm/index.d.ts
CHANGED
package/lib/esm/index.js
CHANGED
package/lib/esm/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC","sourcesContent":["export * from './actions';\nexport * from './config';\nexport * from './constants';\nexport * from './createImplementationRuntime';\nexport * from './logic';\nexport * from './logic/actionLogic';\nexport * from './proiseify';\nexport * from './qpqCoreUtilsLib';\nexport * from './qpqExecuteLog';\nexport * from './runtime';\nexport * from './stories';\nexport * from './testing';\nexport * from './types';\nexport * from './utils';\nexport * from './validators';\n"]}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,+BAA+B,CAAC;AAC9C,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,iBAAiB,CAAC;AAChC,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,cAAc,CAAC","sourcesContent":["export * from './actions';\nexport * from './config';\nexport * from './constants';\nexport * from './createImplementationRuntime';\nexport * from './deployment';\nexport * from './logic';\nexport * from './logic/actionLogic';\nexport * from './proiseify';\nexport * from './qpqCoreUtilsLib';\nexport * from './qpqExecuteLog';\nexport * from './runtime';\nexport * from './stories';\nexport * from './testing';\nexport * from './types';\nexport * from './utils';\nexport * from './validators';\n"]}
|
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates a new random (version 4) UUID.
|
|
3
3
|
*
|
|
4
|
-
* This is the single place in quidproquo to mint a v4 UUID
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* This is the single place in quidproquo to mint a v4 UUID, so it works across
|
|
5
|
+
* both backend and frontend packages with no external dependency.
|
|
6
|
+
*
|
|
7
|
+
* It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a
|
|
8
|
+
* SECURE context: https or localhost). Browsers deliberately hide that method on
|
|
9
|
+
* plain-http origins, which is exactly where a self-hosted app on a LAN ip lives
|
|
10
|
+
* (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout
|
|
11
|
+
* from `crypto.getRandomValues()`, which is available everywhere.
|
|
9
12
|
*
|
|
10
13
|
* @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.
|
|
11
14
|
*/
|
|
12
15
|
export declare function generateUuid(): string;
|
|
16
|
+
export declare function generateUuidFromRandomValues(cryptoApi: Pick<Crypto, 'getRandomValues'>): string;
|
|
@@ -1,15 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Generates a new random (version 4) UUID.
|
|
3
3
|
*
|
|
4
|
-
* This is the single place in quidproquo to mint a v4 UUID
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
4
|
+
* This is the single place in quidproquo to mint a v4 UUID, so it works across
|
|
5
|
+
* both backend and frontend packages with no external dependency.
|
|
6
|
+
*
|
|
7
|
+
* It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a
|
|
8
|
+
* SECURE context: https or localhost). Browsers deliberately hide that method on
|
|
9
|
+
* plain-http origins, which is exactly where a self-hosted app on a LAN ip lives
|
|
10
|
+
* (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout
|
|
11
|
+
* from `crypto.getRandomValues()`, which is available everywhere.
|
|
9
12
|
*
|
|
10
13
|
* @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.
|
|
11
14
|
*/
|
|
12
15
|
export function generateUuid() {
|
|
13
|
-
|
|
16
|
+
// lib.dom types the global as always present; older runtimes (Node before 19,
|
|
17
|
+
// some workers) don't expose it, so treat it as optional and fail loudly. No
|
|
18
|
+
// Math.random() last resort: a guessable id is worse than no id.
|
|
19
|
+
const cryptoApi = globalThis.crypto;
|
|
20
|
+
if (typeof cryptoApi?.randomUUID === 'function') {
|
|
21
|
+
return cryptoApi.randomUUID();
|
|
22
|
+
}
|
|
23
|
+
if (typeof cryptoApi?.getRandomValues !== 'function') {
|
|
24
|
+
throw new Error('generateUuid: no Web Crypto API available in this environment');
|
|
25
|
+
}
|
|
26
|
+
return generateUuidFromRandomValues(cryptoApi);
|
|
27
|
+
}
|
|
28
|
+
// RFC 4122 v4 from 16 random bytes: version nibble 4 in byte 6, variant 10xx in byte 8.
|
|
29
|
+
export function generateUuidFromRandomValues(cryptoApi) {
|
|
30
|
+
const bytes = cryptoApi.getRandomValues(new Uint8Array(16));
|
|
31
|
+
bytes[6] = (bytes[6] & 0x0f) | 0x40;
|
|
32
|
+
bytes[8] = (bytes[8] & 0x3f) | 0x80;
|
|
33
|
+
const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');
|
|
34
|
+
return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;
|
|
14
35
|
}
|
|
15
36
|
//# sourceMappingURL=generateUuid.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"generateUuid.js","sourceRoot":"","sources":["../../../../src/utils/uuid/generateUuid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"generateUuid.js","sourceRoot":"","sources":["../../../../src/utils/uuid/generateUuid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,YAAY;IAC1B,8EAA8E;IAC9E,6EAA6E;IAC7E,iEAAiE;IACjE,MAAM,SAAS,GAAG,UAAU,CAAC,MAA4B,CAAC;IAE1D,IAAI,OAAO,SAAS,EAAE,UAAU,KAAK,UAAU,EAAE,CAAC;QAChD,OAAO,SAAS,CAAC,UAAU,EAAE,CAAC;IAChC,CAAC;IAED,IAAI,OAAO,SAAS,EAAE,eAAe,KAAK,UAAU,EAAE,CAAC;QACrD,MAAM,IAAI,KAAK,CAAC,+DAA+D,CAAC,CAAC;IACnF,CAAC;IAED,OAAO,4BAA4B,CAAC,SAAS,CAAC,CAAC;AACjD,CAAC;AAED,wFAAwF;AACxF,MAAM,UAAU,4BAA4B,CAAC,SAA0C;IACrF,MAAM,KAAK,GAAG,SAAS,CAAC,eAAe,CAAC,IAAI,UAAU,CAAC,EAAE,CAAC,CAAC,CAAC;IAE5D,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IACpC,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,GAAG,IAAI,CAAC;IAEpC,MAAM,GAAG,GAAG,KAAK,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAErF,OAAO,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;AAC7G,CAAC","sourcesContent":["/**\n * Generates a new random (version 4) UUID.\n *\n * This is the single place in quidproquo to mint a v4 UUID, so it works across\n * both backend and frontend packages with no external dependency.\n *\n * It prefers the native `crypto.randomUUID()` (Node 20+, and browsers in a\n * SECURE context: https or localhost). Browsers deliberately hide that method on\n * plain-http origins, which is exactly where a self-hosted app on a LAN ip lives\n * (e.g. http://192.168.x.x), so it falls back to assembling the same v4 layout\n * from `crypto.getRandomValues()`, which is available everywhere.\n *\n * @returns {string} A randomly generated v4 UUID, e.g. `109156be-c4fb-41ea-b1b4-efe1671c5836`.\n */\nexport function generateUuid(): string {\n // lib.dom types the global as always present; older runtimes (Node before 19,\n // some workers) don't expose it, so treat it as optional and fail loudly. No\n // Math.random() last resort: a guessable id is worse than no id.\n const cryptoApi = globalThis.crypto as Crypto | undefined;\n\n if (typeof cryptoApi?.randomUUID === 'function') {\n return cryptoApi.randomUUID();\n }\n\n if (typeof cryptoApi?.getRandomValues !== 'function') {\n throw new Error('generateUuid: no Web Crypto API available in this environment');\n }\n\n return generateUuidFromRandomValues(cryptoApi);\n}\n\n// RFC 4122 v4 from 16 random bytes: version nibble 4 in byte 6, variant 10xx in byte 8.\nexport function generateUuidFromRandomValues(cryptoApi: Pick<Crypto, 'getRandomValues'>): string {\n const bytes = cryptoApi.getRandomValues(new Uint8Array(16));\n\n bytes[6] = (bytes[6] & 0x0f) | 0x40;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n const hex = Array.from(bytes, (byte) => byte.toString(16).padStart(2, '0')).join('');\n\n return `${hex.slice(0, 8)}-${hex.slice(8, 12)}-${hex.slice(12, 16)}-${hex.slice(16, 20)}-${hex.slice(20)}`;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "quidproquo-core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.29",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/commonjs/index.js",
|
|
6
6
|
"module": "./lib/esm/index.js",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"homepage": "https://github.com/qpqjs/quidproquo#readme",
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/node": "^24.2.1",
|
|
39
|
-
"quidproquo-tsconfig": "0.1.
|
|
39
|
+
"quidproquo-tsconfig": "0.1.29",
|
|
40
40
|
"typescript": "^5.8.2"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|