@schemavaults/send-email 0.0.18 → 0.2.1
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 +5 -0
- package/bun.lock +16 -17
- package/dist/cli.js +68 -685
- package/dist/cli.js.map +1 -1
- package/dist/env/get-api-key.js.map +1 -0
- package/dist/env/get-mail-server-url.d.ts +6 -0
- package/dist/env/get-mail-server-url.js +14 -0
- package/dist/env/get-mail-server-url.js.map +1 -0
- package/dist/env/get-mailing-list-id.d.ts +2 -0
- package/dist/env/get-mailing-list-id.js +9 -0
- package/dist/env/get-mailing-list-id.js.map +1 -0
- package/dist/index.d.ts +9 -4
- package/dist/index.js +7 -4
- package/dist/index.js.map +1 -1
- package/dist/list-email-templates.d.ts +0 -2
- package/dist/list-email-templates.js +4 -16
- package/dist/list-email-templates.js.map +1 -1
- package/dist/parse-mail-server-url-with-env-fallback.d.ts +1 -0
- package/dist/parse-mail-server-url-with-env-fallback.js +27 -0
- package/dist/parse-mail-server-url-with-env-fallback.js.map +1 -0
- package/dist/send-email-request-body-schema.js +1 -1
- package/dist/send-email-request-body-schema.js.map +1 -1
- package/dist/send-email-to-mailing-list.d.ts +1 -1
- package/dist/send-email-to-mailing-list.js +4 -12
- package/dist/send-email-to-mailing-list.js.map +1 -1
- package/dist/send-email.d.ts +1 -3
- package/dist/send-email.js +4 -25
- package/dist/send-email.js.map +1 -1
- package/dist/validators/email-template-id-schema.js.map +1 -0
- package/dist/validators/is-valid-url.d.ts +1 -0
- package/dist/validators/is-valid-url.js +5 -0
- package/dist/validators/is-valid-url.js.map +1 -0
- package/dist/validators/is-valid-uuid.d.ts +1 -0
- package/dist/validators/is-valid-uuid.js +5 -0
- package/dist/validators/is-valid-uuid.js.map +1 -0
- package/package.json +1 -2
- package/dist/email-template-id-schema.js.map +0 -1
- package/dist/get-api-key.js.map +0 -1
- /package/dist/{get-api-key.d.ts → env/get-api-key.d.ts} +0 -0
- /package/dist/{get-api-key.js → env/get-api-key.js} +0 -0
- /package/dist/{email-template-id-schema.d.ts → validators/email-template-id-schema.d.ts} +0 -0
- /package/dist/{email-template-id-schema.js → validators/email-template-id-schema.js} +0 -0
package/dist/cli.js
CHANGED
|
@@ -7541,641 +7541,7 @@ var coerce = {
|
|
|
7541
7541
|
};
|
|
7542
7542
|
var NEVER = INVALID;
|
|
7543
7543
|
|
|
7544
|
-
//
|
|
7545
|
-
var defaultHardcodedAppCreationTime = new Date(new Date((/* @__PURE__ */ new Date()).setFullYear(2024)).setMonth(7)).setDate(27);
|
|
7546
|
-
|
|
7547
|
-
// node_modules/@schemavaults/app-definitions/dist/hardcoded-core-schemavaults-apps.js
|
|
7548
|
-
var SCHEMAVAULTS_WEB = {
|
|
7549
|
-
app_id: "schemavaults-web",
|
|
7550
|
-
app_description: "Access SchemaVaults from the web",
|
|
7551
|
-
public: true,
|
|
7552
|
-
app_name: "SchemaVaults Web",
|
|
7553
|
-
created_at: defaultHardcodedAppCreationTime,
|
|
7554
|
-
web: true,
|
|
7555
|
-
hardcoded: true,
|
|
7556
|
-
owner_organization_id: "schemavaults"
|
|
7557
|
-
};
|
|
7558
|
-
var SCHEMAVAULTS_CLI = {
|
|
7559
|
-
app_id: "schemavaults-cli",
|
|
7560
|
-
app_description: "Access SchemaVaults from your command-line terminal",
|
|
7561
|
-
public: true,
|
|
7562
|
-
app_name: "SchemaVaults CLI",
|
|
7563
|
-
created_at: defaultHardcodedAppCreationTime,
|
|
7564
|
-
hardcoded: true,
|
|
7565
|
-
web: false,
|
|
7566
|
-
owner_organization_id: "schemavaults"
|
|
7567
|
-
};
|
|
7568
|
-
var SCHEMAVAULTS_AUTH_APP_DEFINITION = {
|
|
7569
|
-
app_id: "schemavaults-auth",
|
|
7570
|
-
app_description: "SchemaVaults Authentication Platform",
|
|
7571
|
-
public: true,
|
|
7572
|
-
app_name: "SchemaVaults Auth",
|
|
7573
|
-
created_at: defaultHardcodedAppCreationTime,
|
|
7574
|
-
web: true,
|
|
7575
|
-
hardcoded: true,
|
|
7576
|
-
owner_organization_id: "schemavaults"
|
|
7577
|
-
};
|
|
7578
|
-
var SCHEMAVAULTS_MAIL_APP_DEFINITION = {
|
|
7579
|
-
app_id: "schemavaults-mail",
|
|
7580
|
-
app_description: "SchemaVaults Mail Platform",
|
|
7581
|
-
public: false,
|
|
7582
|
-
app_name: "SchemaVaults Mail",
|
|
7583
|
-
created_at: defaultHardcodedAppCreationTime,
|
|
7584
|
-
web: true,
|
|
7585
|
-
hardcoded: true,
|
|
7586
|
-
owner_organization_id: "schemavaults"
|
|
7587
|
-
};
|
|
7588
|
-
var HARDCODED_CORE_SCHEMAVAULTS_APPS = [
|
|
7589
|
-
SCHEMAVAULTS_WEB,
|
|
7590
|
-
SCHEMAVAULTS_CLI,
|
|
7591
|
-
SCHEMAVAULTS_AUTH_APP_DEFINITION,
|
|
7592
|
-
SCHEMAVAULTS_MAIL_APP_DEFINITION
|
|
7593
|
-
];
|
|
7594
|
-
var HARDCODED_CORE_SCHEMAVAULTS_APPS_MAP = new Map(HARDCODED_CORE_SCHEMAVAULTS_APPS.map((app) => [app.app_id, app]));
|
|
7595
|
-
var hardcoded_app_ids = HARDCODED_CORE_SCHEMAVAULTS_APPS.map((hardcoded_app) => hardcoded_app.app_id);
|
|
7596
|
-
var hardcodedAppIdSchema = external_exports.string().refine((app_id) => {
|
|
7597
|
-
return hardcoded_app_ids.includes(app_id);
|
|
7598
|
-
}, "Invalid hardcoded app ID");
|
|
7599
|
-
|
|
7600
|
-
// node_modules/@schemavaults/app-definitions/dist/app-id.js
|
|
7601
|
-
var appIdSchema = external_exports.union([
|
|
7602
|
-
external_exports.string().uuid(),
|
|
7603
|
-
// dynamically defined app
|
|
7604
|
-
hardcodedAppIdSchema
|
|
7605
|
-
]);
|
|
7606
|
-
|
|
7607
|
-
// node_modules/@schemavaults/app-definitions/dist/app-environments.js
|
|
7608
|
-
var schemaVaultsAppEnvironments = [
|
|
7609
|
-
"development",
|
|
7610
|
-
"staging",
|
|
7611
|
-
"test",
|
|
7612
|
-
"production"
|
|
7613
|
-
];
|
|
7614
|
-
var schemaVaultsAppEnvironmentSchema = external_exports.enum(schemaVaultsAppEnvironments);
|
|
7615
|
-
|
|
7616
|
-
// node_modules/@schemavaults/app-definitions/dist/client-app-definition.js
|
|
7617
|
-
var baseSchemaVaultsAppDefinitionSchema = external_exports.object({
|
|
7618
|
-
app_id: external_exports.string(),
|
|
7619
|
-
app_name: external_exports.string().max(64),
|
|
7620
|
-
app_description: external_exports.string().max(512),
|
|
7621
|
-
created_at: external_exports.number().nonnegative(),
|
|
7622
|
-
public: external_exports.boolean(),
|
|
7623
|
-
// whether the app is publicly listed
|
|
7624
|
-
hardcoded: external_exports.boolean(),
|
|
7625
|
-
web: external_exports.boolean(),
|
|
7626
|
-
// whether this app can be opened by url or requires native installation
|
|
7627
|
-
owner_organization_id: external_exports.string().nullable().optional()
|
|
7628
|
-
}).required({
|
|
7629
|
-
app_id: true,
|
|
7630
|
-
app_name: true,
|
|
7631
|
-
created_at: true,
|
|
7632
|
-
public: true,
|
|
7633
|
-
hardcoded: true,
|
|
7634
|
-
web: true
|
|
7635
|
-
}).strict();
|
|
7636
|
-
var schemaVaultsAppDefinitionSchema = baseSchemaVaultsAppDefinitionSchema.refine((values) => appIdSchema.safeParse(values.app_id).success, "Invalid client application ID");
|
|
7637
|
-
var schemaVaultsAppDomainRefSchema = external_exports.object({
|
|
7638
|
-
app_domain_ref_id: external_exports.string().uuid(),
|
|
7639
|
-
app_id: appIdSchema,
|
|
7640
|
-
domain: external_exports.string().max(255),
|
|
7641
|
-
environment: schemaVaultsAppEnvironmentSchema,
|
|
7642
|
-
created_at: external_exports.number().nonnegative(),
|
|
7643
|
-
hardcoded: external_exports.boolean()
|
|
7644
|
-
}).required({
|
|
7645
|
-
app_domain_ref_id: true,
|
|
7646
|
-
app_id: true,
|
|
7647
|
-
domain: true,
|
|
7648
|
-
environment: true,
|
|
7649
|
-
created_at: true,
|
|
7650
|
-
hardcoded: true
|
|
7651
|
-
}).strict();
|
|
7652
|
-
|
|
7653
|
-
// node_modules/@schemavaults/app-definitions/dist/list-registry-apps-query-params.js
|
|
7654
|
-
var list_apps_query_type = [
|
|
7655
|
-
"all",
|
|
7656
|
-
// admin-only
|
|
7657
|
-
"public",
|
|
7658
|
-
// publicly listed apps
|
|
7659
|
-
"authorized",
|
|
7660
|
-
// apps that the requesting user has authorized
|
|
7661
|
-
"org"
|
|
7662
|
-
// apps owned by a specific organization
|
|
7663
|
-
];
|
|
7664
|
-
var listAppsQueryTypeSchema = external_exports.string().refine((val) => list_apps_query_type.includes(val), `Invalid list apps query type. Should be one of: ${list_apps_query_type.map((val) => `"${val}"`).join(", ")}`);
|
|
7665
|
-
|
|
7666
|
-
// node_modules/@schemavaults/app-definitions/dist/hardcoded-core-schemavaults-api-servers.js
|
|
7667
|
-
var createdAt = new Date(new Date((/* @__PURE__ */ new Date()).setFullYear(2024)).setMonth(7)).setDate(27);
|
|
7668
|
-
var SCHEMAVAULTS_AUTH_SERVER = {
|
|
7669
|
-
api_server_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
7670
|
-
api_server_name: "SchemaVaults Auth",
|
|
7671
|
-
api_server_description: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_description,
|
|
7672
|
-
public: true,
|
|
7673
|
-
created_at: createdAt,
|
|
7674
|
-
hardcoded: true,
|
|
7675
|
-
owner_organization_id: "schemavaults"
|
|
7676
|
-
};
|
|
7677
|
-
var SCHEMAVAULTS_REGISTRY_SERVER = {
|
|
7678
|
-
api_server_id: "schemavaults-registry",
|
|
7679
|
-
api_server_name: "SchemaVaults Registry",
|
|
7680
|
-
api_server_description: "Store schemas and other SchemaVaults data",
|
|
7681
|
-
public: true,
|
|
7682
|
-
created_at: createdAt,
|
|
7683
|
-
hardcoded: true,
|
|
7684
|
-
owner_organization_id: "schemavaults"
|
|
7685
|
-
};
|
|
7686
|
-
var SCHEMAVAULTS_MAIL_SERVER = {
|
|
7687
|
-
api_server_id: "schemavaults-mail",
|
|
7688
|
-
api_server_name: "SchemaVaults Mail",
|
|
7689
|
-
api_server_description: "Send e-mails to SchemaVaults users & mailing list(s).",
|
|
7690
|
-
public: true,
|
|
7691
|
-
created_at: createdAt,
|
|
7692
|
-
hardcoded: true,
|
|
7693
|
-
owner_organization_id: "schemavaults"
|
|
7694
|
-
};
|
|
7695
|
-
var HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS = [
|
|
7696
|
-
SCHEMAVAULTS_REGISTRY_SERVER,
|
|
7697
|
-
SCHEMAVAULTS_MAIL_SERVER,
|
|
7698
|
-
SCHEMAVAULTS_AUTH_SERVER
|
|
7699
|
-
];
|
|
7700
|
-
var HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS_MAP = new Map(HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS.map((api_server) => [api_server.api_server_id, api_server]));
|
|
7701
|
-
var hardcoded_api_server_ids = HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS.map((hardcoded_api_server_id) => hardcoded_api_server_id.api_server_id);
|
|
7702
|
-
var hardcodedApiServerIdSchema = external_exports.string().refine((api_server_id) => {
|
|
7703
|
-
return hardcoded_api_server_ids.includes(api_server_id);
|
|
7704
|
-
}, "Invalid hardcoded API server ID");
|
|
7705
|
-
function isHardcodedApiServerId(api_server_id) {
|
|
7706
|
-
return hardcodedApiServerIdSchema.safeParse(api_server_id).success;
|
|
7707
|
-
}
|
|
7708
|
-
function getHardcodedApiServer(api_server_id) {
|
|
7709
|
-
if (isHardcodedApiServerId(api_server_id)) {
|
|
7710
|
-
const api_server_definition = HARDCODED_CORE_SCHEMAVAULTS_API_SERVERS_MAP.get(api_server_id);
|
|
7711
|
-
if (api_server_definition)
|
|
7712
|
-
return api_server_definition;
|
|
7713
|
-
throw new Error(`Failed to retrieve hardcoded API server with ID '${api_server_id}'`);
|
|
7714
|
-
} else {
|
|
7715
|
-
throw new Error(`API server with ID '${api_server_id}' is not a hardcoded API server!`);
|
|
7716
|
-
}
|
|
7717
|
-
}
|
|
7718
|
-
|
|
7719
|
-
// node_modules/@schemavaults/app-definitions/dist/api-server-id.js
|
|
7720
|
-
var apiServerIdSchema = external_exports.union([
|
|
7721
|
-
external_exports.string().uuid(),
|
|
7722
|
-
// dynamically defined api server
|
|
7723
|
-
hardcodedApiServerIdSchema
|
|
7724
|
-
]);
|
|
7725
|
-
|
|
7726
|
-
// node_modules/@schemavaults/app-definitions/dist/api-server-definition.js
|
|
7727
|
-
var baseSchemaVaultsApiServerDefinitionSchema = external_exports.object({
|
|
7728
|
-
api_server_id: external_exports.string(),
|
|
7729
|
-
api_server_name: external_exports.string().max(64),
|
|
7730
|
-
api_server_description: external_exports.string().max(512),
|
|
7731
|
-
created_at: external_exports.number().nonnegative(),
|
|
7732
|
-
public: external_exports.boolean(),
|
|
7733
|
-
// whether the app is publicly listed
|
|
7734
|
-
hardcoded: external_exports.boolean(),
|
|
7735
|
-
owner_organization_id: external_exports.string().nullable().optional()
|
|
7736
|
-
}).required({
|
|
7737
|
-
api_server_id: true,
|
|
7738
|
-
api_server_name: true,
|
|
7739
|
-
created_at: true,
|
|
7740
|
-
public: true,
|
|
7741
|
-
hardcoded: true
|
|
7742
|
-
}).strict();
|
|
7743
|
-
var schemaVaultsApiServerDefinitionSchema = baseSchemaVaultsApiServerDefinitionSchema.refine((values) => apiServerIdSchema.safeParse(values.api_server_id).success, "Invalid API server ID");
|
|
7744
|
-
var schemaVaultsApiServerDomainRefSchema = external_exports.object({
|
|
7745
|
-
api_server_domain_ref_id: external_exports.string().uuid(),
|
|
7746
|
-
api_server_id: apiServerIdSchema,
|
|
7747
|
-
domain: external_exports.string().max(255),
|
|
7748
|
-
environment: schemaVaultsAppEnvironmentSchema,
|
|
7749
|
-
created_at: external_exports.number().nonnegative(),
|
|
7750
|
-
hardcoded: external_exports.boolean()
|
|
7751
|
-
}).required({
|
|
7752
|
-
api_server_domain_ref_id: true,
|
|
7753
|
-
api_server_id: true,
|
|
7754
|
-
domain: true,
|
|
7755
|
-
environment: true,
|
|
7756
|
-
created_at: true,
|
|
7757
|
-
hardcoded: true
|
|
7758
|
-
}).strict();
|
|
7759
|
-
|
|
7760
|
-
// node_modules/@schemavaults/app-definitions/dist/list-registry-api-servers-query-params.js
|
|
7761
|
-
var list_api_servers_query_type = [
|
|
7762
|
-
"all",
|
|
7763
|
-
// admin-only
|
|
7764
|
-
"org"
|
|
7765
|
-
];
|
|
7766
|
-
var listApiServersQueryTypeSchema = external_exports.string().refine((val) => list_api_servers_query_type.includes(val), `Invalid list API servers query type. Should be one of: ${list_api_servers_query_type.map((val) => `"${val}"`).join(", ")}`);
|
|
7767
|
-
|
|
7768
|
-
// node_modules/@schemavaults/app-definitions/dist/app_to_api_permission_def.js
|
|
7769
|
-
var appToApiPermissionSchema = external_exports.object({
|
|
7770
|
-
client_app_id: appIdSchema,
|
|
7771
|
-
api_server_id: apiServerIdSchema,
|
|
7772
|
-
created_at: external_exports.number().nonnegative(),
|
|
7773
|
-
created_by: external_exports.string().uuid().optional().nullable()
|
|
7774
|
-
}).required({
|
|
7775
|
-
client_app_id: true,
|
|
7776
|
-
api_server_id: true,
|
|
7777
|
-
created_at: true
|
|
7778
|
-
}).strict();
|
|
7779
|
-
|
|
7780
|
-
// node_modules/@schemavaults/app-definitions/dist/hardcoded-core-schemavaults-app-domains.js
|
|
7781
|
-
var SCHEMAVAULTS_WEB_APP_DEVELOPMENT_DOMAIN = {
|
|
7782
|
-
app_domain_ref_id: "17546803-f105-42f4-bee2-13b2513eb48e",
|
|
7783
|
-
app_id: SCHEMAVAULTS_WEB.app_id,
|
|
7784
|
-
domain: "http://localhost:3000",
|
|
7785
|
-
environment: "development",
|
|
7786
|
-
hardcoded: true,
|
|
7787
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7788
|
-
};
|
|
7789
|
-
var SCHEMAVAULTS_WEB_APP_PRODUCTION_DOMAIN = {
|
|
7790
|
-
app_domain_ref_id: "41d3dc3f-2d46-437c-9035-1be4df3d1dca",
|
|
7791
|
-
app_id: SCHEMAVAULTS_WEB.app_id,
|
|
7792
|
-
domain: "https://schemavaults.com",
|
|
7793
|
-
environment: "production",
|
|
7794
|
-
hardcoded: true,
|
|
7795
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7796
|
-
};
|
|
7797
|
-
var SCHEMAVAULTS_WEB_APP_TEST_DOMAIN = {
|
|
7798
|
-
app_domain_ref_id: "903b8931-e400-4d71-b9dd-2d767268e7c4",
|
|
7799
|
-
app_id: SCHEMAVAULTS_WEB.app_id,
|
|
7800
|
-
domain: "http://schemavaults-web",
|
|
7801
|
-
environment: "test",
|
|
7802
|
-
hardcoded: true,
|
|
7803
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7804
|
-
};
|
|
7805
|
-
var SCHEMAVAULTS_WEB_APP_STAGING_DOMAIN = {
|
|
7806
|
-
app_domain_ref_id: "55f8e59f-7d6f-426c-9251-51cd3026328e",
|
|
7807
|
-
app_id: SCHEMAVAULTS_WEB.app_id,
|
|
7808
|
-
domain: "https://staging.schemavaults.com",
|
|
7809
|
-
environment: "staging",
|
|
7810
|
-
hardcoded: true,
|
|
7811
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7812
|
-
};
|
|
7813
|
-
var HARDCODED_CORE_SCHEMAVAULTS_WEB_APP_DOMAINS = [
|
|
7814
|
-
SCHEMAVAULTS_WEB_APP_DEVELOPMENT_DOMAIN,
|
|
7815
|
-
SCHEMAVAULTS_WEB_APP_PRODUCTION_DOMAIN,
|
|
7816
|
-
SCHEMAVAULTS_WEB_APP_TEST_DOMAIN,
|
|
7817
|
-
SCHEMAVAULTS_WEB_APP_STAGING_DOMAIN
|
|
7818
|
-
];
|
|
7819
|
-
var SCHEMAVAULTS_AUTH_APP_PRODUCTION_DOMAIN = {
|
|
7820
|
-
app_domain_ref_id: "539e8ff5-cc5a-4674-9053-d3f12ba3b497",
|
|
7821
|
-
app_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
7822
|
-
domain: "https://auth.schemavaults.com",
|
|
7823
|
-
environment: "production",
|
|
7824
|
-
hardcoded: true,
|
|
7825
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7826
|
-
};
|
|
7827
|
-
var SCHEMAVAULTS_AUTH_APP_DEVELOPMENT_DOMAIN = {
|
|
7828
|
-
app_domain_ref_id: "0c6e6234-2974-45d7-8c13-883b21053acb",
|
|
7829
|
-
app_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
7830
|
-
domain: "http://localhost:6767",
|
|
7831
|
-
environment: "development",
|
|
7832
|
-
hardcoded: true,
|
|
7833
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7834
|
-
};
|
|
7835
|
-
var SCHEMAVAULTS_AUTH_APP_TEST_DOMAIN = {
|
|
7836
|
-
app_domain_ref_id: "2cffcc0a-0ce8-488c-9dc3-8ea5f1146594",
|
|
7837
|
-
app_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
7838
|
-
domain: "http://schemavaults-auth",
|
|
7839
|
-
environment: "test",
|
|
7840
|
-
hardcoded: true,
|
|
7841
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7842
|
-
};
|
|
7843
|
-
var SCHEMAVAULTS_AUTH_APP_STAGING_DOMAIN = {
|
|
7844
|
-
app_domain_ref_id: "e90f04e5-2bab-4a11-ac56-b2c336ea993a",
|
|
7845
|
-
app_id: SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id,
|
|
7846
|
-
domain: "https://auth-staging.schemavaults.com",
|
|
7847
|
-
environment: "staging",
|
|
7848
|
-
hardcoded: true,
|
|
7849
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7850
|
-
};
|
|
7851
|
-
var HARDCODED_CORE_SCHEMAVAULTS_AUTH_APP_DOMAINS = [
|
|
7852
|
-
SCHEMAVAULTS_AUTH_APP_PRODUCTION_DOMAIN,
|
|
7853
|
-
SCHEMAVAULTS_AUTH_APP_DEVELOPMENT_DOMAIN,
|
|
7854
|
-
SCHEMAVAULTS_AUTH_APP_TEST_DOMAIN,
|
|
7855
|
-
SCHEMAVAULTS_AUTH_APP_STAGING_DOMAIN
|
|
7856
|
-
];
|
|
7857
|
-
var SCHEMAVAULTS_MAIL_APP_PRODUCTION_DOMAIN = {
|
|
7858
|
-
app_domain_ref_id: "4a4dd0be-9e11-4880-be6c-9867137caac5",
|
|
7859
|
-
app_id: SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
7860
|
-
domain: "https://mail.schemavaults.com",
|
|
7861
|
-
environment: "production",
|
|
7862
|
-
hardcoded: true,
|
|
7863
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7864
|
-
};
|
|
7865
|
-
var SCHEMAVAULTS_MAIL_APP_DEVELOPMENT_DOMAIN = {
|
|
7866
|
-
app_domain_ref_id: "1ed4cea6-d184-4a19-a806-3c227b1beed7",
|
|
7867
|
-
app_id: SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
7868
|
-
domain: "http://localhost:5346",
|
|
7869
|
-
environment: "development",
|
|
7870
|
-
hardcoded: true,
|
|
7871
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7872
|
-
};
|
|
7873
|
-
var SCHEMAVAULTS_MAIL_APP_TEST_DOMAIN = {
|
|
7874
|
-
app_domain_ref_id: "dae9b071-894c-4060-a08a-5a693966a34b",
|
|
7875
|
-
app_id: SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
7876
|
-
domain: "http://schemavaults-mail",
|
|
7877
|
-
environment: "test",
|
|
7878
|
-
hardcoded: true,
|
|
7879
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7880
|
-
};
|
|
7881
|
-
var SCHEMAVAULTS_MAIL_APP_STAGING_DOMAIN = {
|
|
7882
|
-
app_domain_ref_id: "34c1fdf5-e7d6-4858-b4f5-027eeb008fc6",
|
|
7883
|
-
app_id: SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
7884
|
-
domain: "https://mail-staging.schemavaults.com",
|
|
7885
|
-
environment: "staging",
|
|
7886
|
-
hardcoded: true,
|
|
7887
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7888
|
-
};
|
|
7889
|
-
var HARDCODED_CORE_SCHEMAVAULTS_MAIL_APP_DOMAINS = [
|
|
7890
|
-
SCHEMAVAULTS_MAIL_APP_PRODUCTION_DOMAIN,
|
|
7891
|
-
SCHEMAVAULTS_MAIL_APP_DEVELOPMENT_DOMAIN,
|
|
7892
|
-
SCHEMAVAULTS_MAIL_APP_TEST_DOMAIN,
|
|
7893
|
-
SCHEMAVAULTS_MAIL_APP_STAGING_DOMAIN
|
|
7894
|
-
];
|
|
7895
|
-
var HARDCODED_CORE_SCHEMAVAULTS_APP_DOMAINS = [
|
|
7896
|
-
...HARDCODED_CORE_SCHEMAVAULTS_WEB_APP_DOMAINS,
|
|
7897
|
-
...HARDCODED_CORE_SCHEMAVAULTS_AUTH_APP_DOMAINS,
|
|
7898
|
-
...HARDCODED_CORE_SCHEMAVAULTS_MAIL_APP_DOMAINS
|
|
7899
|
-
];
|
|
7900
|
-
|
|
7901
|
-
// node_modules/@schemavaults/app-definitions/dist/get-hardcoded-client-web-app-domain.js
|
|
7902
|
-
var DEBUG = false;
|
|
7903
|
-
function getHardcodedClientWebAppDomain(web_app_id, environment) {
|
|
7904
|
-
if (typeof web_app_id !== "string" || !HARDCODED_CORE_SCHEMAVAULTS_APPS.some((app) => app.app_id === web_app_id)) {
|
|
7905
|
-
throw new Error("Failed to find hardcoded app with that app ID!");
|
|
7906
|
-
}
|
|
7907
|
-
if (!schemaVaultsAppEnvironmentSchema.safeParse(environment).success) {
|
|
7908
|
-
console.error("Invalid SchemaVaults app environment: ", environment);
|
|
7909
|
-
throw new Error("Invalid app environment!");
|
|
7910
|
-
}
|
|
7911
|
-
if (DEBUG) {
|
|
7912
|
-
console.log(`[getHardcodedClientWebAppDomain] Attempting to find domain for hardcoded app with ID: "${web_app_id}" in environment: "${environment}"`);
|
|
7913
|
-
}
|
|
7914
|
-
const appDomains = HARDCODED_CORE_SCHEMAVAULTS_APP_DOMAINS.filter((app) => app.app_id === web_app_id);
|
|
7915
|
-
if (appDomains.length === 0) {
|
|
7916
|
-
throw new Error(`No domains found for hardcoded app (with ID "${web_app_id}") (in any environment!)`);
|
|
7917
|
-
}
|
|
7918
|
-
const domainForAppEnv = appDomains.find((app_domain) => app_domain.environment === environment);
|
|
7919
|
-
if (!domainForAppEnv) {
|
|
7920
|
-
console.error("App environment: ", environment);
|
|
7921
|
-
throw new Error(`No domains found for hardcoded app (with ID "${web_app_id}") in app environment "${environment}"`);
|
|
7922
|
-
}
|
|
7923
|
-
const domain = domainForAppEnv.domain;
|
|
7924
|
-
if (DEBUG) {
|
|
7925
|
-
console.log(`[getHardcodedClientWebAppDomain] Found domain for hardcoded app (with ID: "${web_app_id}") in environment "${environment}": `, domain);
|
|
7926
|
-
}
|
|
7927
|
-
return domain;
|
|
7928
|
-
}
|
|
7929
|
-
|
|
7930
|
-
// node_modules/@schemavaults/app-definitions/dist/hardcoded-core-schemavaults-api-server-domains.js
|
|
7931
|
-
var SCHEMAVAULTS_REGISTRY_SERVER_DEVELOPMENT_DOMAIN = {
|
|
7932
|
-
api_server_domain_ref_id: "b056acd9-0b56-4e11-9d32-ac36036c414f",
|
|
7933
|
-
api_server_id: SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
7934
|
-
domain: "http://localhost:8080",
|
|
7935
|
-
environment: "development",
|
|
7936
|
-
hardcoded: true,
|
|
7937
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7938
|
-
};
|
|
7939
|
-
var SCHEMAVAULTS_REGISTRY_SERVER_TEST_DOMAIN = {
|
|
7940
|
-
api_server_domain_ref_id: "13fe64de-67c5-41a8-9ceb-a80a2c68123f",
|
|
7941
|
-
api_server_id: SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
7942
|
-
domain: "http://schemavaults-registry",
|
|
7943
|
-
environment: "test",
|
|
7944
|
-
hardcoded: true,
|
|
7945
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7946
|
-
};
|
|
7947
|
-
var SCHEMAVAULTS_REGISTRY_SERVER_STAGING_DOMAIN = {
|
|
7948
|
-
api_server_domain_ref_id: "b3d96099-299a-49af-86eb-1b5e34d9b56b",
|
|
7949
|
-
api_server_id: SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
7950
|
-
domain: "https://registry-staging.schemavaults.com",
|
|
7951
|
-
environment: "staging",
|
|
7952
|
-
hardcoded: true,
|
|
7953
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7954
|
-
};
|
|
7955
|
-
var SCHEMAVAULTS_REGISTRY_SERVER_PRODUCTION_DOMAIN = {
|
|
7956
|
-
api_server_domain_ref_id: "f1ebac97-9869-422b-ad83-fbbb13642cad",
|
|
7957
|
-
api_server_id: SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
7958
|
-
domain: "https://api.schemavaults.com",
|
|
7959
|
-
environment: "production",
|
|
7960
|
-
hardcoded: true,
|
|
7961
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7962
|
-
};
|
|
7963
|
-
var HARDCODED_SCHEMAVAULTS_REGISTRY_SERVER_DOMAINS = [
|
|
7964
|
-
SCHEMAVAULTS_REGISTRY_SERVER_DEVELOPMENT_DOMAIN,
|
|
7965
|
-
SCHEMAVAULTS_REGISTRY_SERVER_TEST_DOMAIN,
|
|
7966
|
-
SCHEMAVAULTS_REGISTRY_SERVER_STAGING_DOMAIN,
|
|
7967
|
-
SCHEMAVAULTS_REGISTRY_SERVER_PRODUCTION_DOMAIN
|
|
7968
|
-
];
|
|
7969
|
-
var SCHEMAVAULTS_MAIL_SERVER_DEVELOPMENT_DOMAIN = {
|
|
7970
|
-
api_server_domain_ref_id: "7e1781b4-5f8b-4f63-9c8b-7df1e6e20384",
|
|
7971
|
-
api_server_id: SCHEMAVAULTS_MAIL_SERVER.api_server_id,
|
|
7972
|
-
domain: "http://localhost:5346",
|
|
7973
|
-
environment: "development",
|
|
7974
|
-
hardcoded: true,
|
|
7975
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7976
|
-
};
|
|
7977
|
-
var SCHEMAVAULTS_MAIL_SERVER_TEST_DOMAIN = {
|
|
7978
|
-
api_server_domain_ref_id: "7c824625-0d56-4131-94b9-816f0b00267c",
|
|
7979
|
-
api_server_id: SCHEMAVAULTS_MAIL_SERVER.api_server_id,
|
|
7980
|
-
domain: "http://schemavaults-mail",
|
|
7981
|
-
environment: "test",
|
|
7982
|
-
hardcoded: true,
|
|
7983
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7984
|
-
};
|
|
7985
|
-
var SCHEMAVAULTS_MAIL_SERVER_STAGING_DOMAIN = {
|
|
7986
|
-
api_server_domain_ref_id: "9ffcff5a-7800-402b-b361-a3fdf6e36dcc",
|
|
7987
|
-
api_server_id: SCHEMAVAULTS_MAIL_SERVER.api_server_id,
|
|
7988
|
-
domain: "https://mail-staging.schemavaults.com",
|
|
7989
|
-
environment: "staging",
|
|
7990
|
-
hardcoded: true,
|
|
7991
|
-
created_at: defaultHardcodedAppCreationTime
|
|
7992
|
-
};
|
|
7993
|
-
var SCHEMAVAULTS_MAIL_SERVER_PRODUCTION_DOMAIN = {
|
|
7994
|
-
api_server_domain_ref_id: "97178de1-96d5-44dd-a7eb-3dd39e0f3fa5",
|
|
7995
|
-
api_server_id: SCHEMAVAULTS_MAIL_SERVER.api_server_id,
|
|
7996
|
-
domain: "https://mail.schemavaults.com",
|
|
7997
|
-
environment: "production",
|
|
7998
|
-
hardcoded: true,
|
|
7999
|
-
created_at: defaultHardcodedAppCreationTime
|
|
8000
|
-
};
|
|
8001
|
-
var HARDCODED_SCHEMAVAULTS_MAIL_SERVER_DOMAINS = [
|
|
8002
|
-
SCHEMAVAULTS_MAIL_SERVER_DEVELOPMENT_DOMAIN,
|
|
8003
|
-
SCHEMAVAULTS_MAIL_SERVER_TEST_DOMAIN,
|
|
8004
|
-
SCHEMAVAULTS_MAIL_SERVER_STAGING_DOMAIN,
|
|
8005
|
-
SCHEMAVAULTS_MAIL_SERVER_PRODUCTION_DOMAIN
|
|
8006
|
-
];
|
|
8007
|
-
var SCHEMAVAULTS_AUTH_SERVER_DEVELOPMENT_DOMAIN = {
|
|
8008
|
-
api_server_domain_ref_id: "7b2d301b-e7a5-4805-a165-c566b77d0b47",
|
|
8009
|
-
api_server_id: SCHEMAVAULTS_AUTH_SERVER.api_server_id,
|
|
8010
|
-
domain: "http://localhost:6767",
|
|
8011
|
-
environment: "development",
|
|
8012
|
-
hardcoded: true,
|
|
8013
|
-
created_at: defaultHardcodedAppCreationTime
|
|
8014
|
-
};
|
|
8015
|
-
var SCHEMAVAULTS_AUTH_SERVER_TEST_DOMAIN = {
|
|
8016
|
-
api_server_domain_ref_id: "7df3761e-920c-49f8-bcb6-752987135879",
|
|
8017
|
-
api_server_id: SCHEMAVAULTS_AUTH_SERVER.api_server_id,
|
|
8018
|
-
domain: "http://schemavaults-auth",
|
|
8019
|
-
environment: "test",
|
|
8020
|
-
hardcoded: true,
|
|
8021
|
-
created_at: defaultHardcodedAppCreationTime
|
|
8022
|
-
};
|
|
8023
|
-
var SCHEMAVAULTS_AUTH_SERVER_STAGING_DOMAIN = {
|
|
8024
|
-
api_server_domain_ref_id: "d38e47ab-bb36-46f1-ac35-ff38659007a8",
|
|
8025
|
-
api_server_id: SCHEMAVAULTS_AUTH_SERVER.api_server_id,
|
|
8026
|
-
domain: "https://auth-staging.schemavaults.com",
|
|
8027
|
-
environment: "staging",
|
|
8028
|
-
hardcoded: true,
|
|
8029
|
-
created_at: defaultHardcodedAppCreationTime
|
|
8030
|
-
};
|
|
8031
|
-
var SCHEMAVAULTS_AUTH_SERVER_PRODUCTION_DOMAIN = {
|
|
8032
|
-
api_server_domain_ref_id: "a06b59ca-2a9f-43c1-821c-b86dfe8efd1f",
|
|
8033
|
-
api_server_id: SCHEMAVAULTS_AUTH_SERVER.api_server_id,
|
|
8034
|
-
domain: "https://auth.schemavaults.com",
|
|
8035
|
-
environment: "production",
|
|
8036
|
-
hardcoded: true,
|
|
8037
|
-
created_at: defaultHardcodedAppCreationTime
|
|
8038
|
-
};
|
|
8039
|
-
var HARDCODED_SCHEMAVAULTS_AUTH_SERVER_DOMAINS = [
|
|
8040
|
-
SCHEMAVAULTS_AUTH_SERVER_DEVELOPMENT_DOMAIN,
|
|
8041
|
-
SCHEMAVAULTS_AUTH_SERVER_TEST_DOMAIN,
|
|
8042
|
-
SCHEMAVAULTS_AUTH_SERVER_STAGING_DOMAIN,
|
|
8043
|
-
SCHEMAVAULTS_AUTH_SERVER_PRODUCTION_DOMAIN
|
|
8044
|
-
];
|
|
8045
|
-
var HARDCODED_CORE_SCHEMAVAULTS_API_SERVER_DOMAINS = [
|
|
8046
|
-
...HARDCODED_SCHEMAVAULTS_REGISTRY_SERVER_DOMAINS,
|
|
8047
|
-
...HARDCODED_SCHEMAVAULTS_MAIL_SERVER_DOMAINS,
|
|
8048
|
-
...HARDCODED_SCHEMAVAULTS_AUTH_SERVER_DOMAINS
|
|
8049
|
-
];
|
|
8050
|
-
|
|
8051
|
-
// node_modules/@schemavaults/app-definitions/dist/get-hardcoded-api-server-domain.js
|
|
8052
|
-
function getHardcodedApiServerDomain(api_server_id, environment) {
|
|
8053
|
-
const hardcodedApi = getHardcodedApiServer(api_server_id);
|
|
8054
|
-
if (!hardcodedApi) {
|
|
8055
|
-
throw new Error(`Failed to load hardcoded API server with ID '${api_server_id}'`);
|
|
8056
|
-
}
|
|
8057
|
-
const hardcodedDomain = HARDCODED_CORE_SCHEMAVAULTS_API_SERVER_DOMAINS.find((domain) => domain.api_server_id === api_server_id && domain.environment === environment && domain.hardcoded);
|
|
8058
|
-
if (!hardcodedDomain) {
|
|
8059
|
-
throw new Error(`Failed to find domain for hardcoded API server with ID '${api_server_id}' in environment '${environment}'`);
|
|
8060
|
-
}
|
|
8061
|
-
return hardcodedDomain;
|
|
8062
|
-
}
|
|
8063
|
-
|
|
8064
|
-
// node_modules/@schemavaults/app-definitions/dist/production-auth-server-url.js
|
|
8065
|
-
var PRODUCTION_AUTH_SERVER_URL = getHardcodedClientWebAppDomain(SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id, "production");
|
|
8066
|
-
|
|
8067
|
-
// node_modules/@schemavaults/app-definitions/dist/get-app-environment/isBrowserRuntime.js
|
|
8068
|
-
function isBrowser() {
|
|
8069
|
-
let isWindowGlobalVariableSet = false;
|
|
8070
|
-
try {
|
|
8071
|
-
if (window) {
|
|
8072
|
-
isWindowGlobalVariableSet = true;
|
|
8073
|
-
}
|
|
8074
|
-
} catch (e) {
|
|
8075
|
-
void e;
|
|
8076
|
-
isWindowGlobalVariableSet = false;
|
|
8077
|
-
}
|
|
8078
|
-
return isWindowGlobalVariableSet;
|
|
8079
|
-
}
|
|
8080
|
-
|
|
8081
|
-
// node_modules/@schemavaults/app-definitions/dist/get-app-environment/parse-app-environment-from-processDotEnv.js
|
|
8082
|
-
function stripQuotes(maybeQuotes) {
|
|
8083
|
-
if (!maybeQuotes)
|
|
8084
|
-
return maybeQuotes;
|
|
8085
|
-
const trimmed = maybeQuotes.trim();
|
|
8086
|
-
if (trimmed.startsWith('"') && trimmed.endsWith('"')) {
|
|
8087
|
-
return trimmed.slice(1, -1);
|
|
8088
|
-
}
|
|
8089
|
-
if (trimmed.startsWith("'") && trimmed.endsWith("'")) {
|
|
8090
|
-
return trimmed.slice(1, -1);
|
|
8091
|
-
}
|
|
8092
|
-
return trimmed;
|
|
8093
|
-
}
|
|
8094
|
-
function parseAppEnvironmentFromProcessDotEnv(DEBUG_GET_APP_ENVIRONMENT = false) {
|
|
8095
|
-
const dynamicProcessDotEnvAppEnv = process.env.SCHEMAVAULTS_APP_ENVIRONMENT;
|
|
8096
|
-
const inlinedNextJsAppEnv = process.env.NEXT_PUBLIC_SCHEMAVAULTS_APP_ENVIRONMENT;
|
|
8097
|
-
if (typeof dynamicProcessDotEnvAppEnv === "string") {
|
|
8098
|
-
const parsed = schemaVaultsAppEnvironmentSchema.safeParse(stripQuotes(dynamicProcessDotEnvAppEnv));
|
|
8099
|
-
if (parsed.success) {
|
|
8100
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8101
|
-
console.log("[getAppEnvironment] Using SCHEMAVAULTS_APP_ENVIRONMENT environment variable: ", parsed.data);
|
|
8102
|
-
}
|
|
8103
|
-
return parsed.data;
|
|
8104
|
-
}
|
|
8105
|
-
throw new Error("Environment variable SCHEMAVAULTS_APP_ENVIRONMENT is defined but invalid!");
|
|
8106
|
-
} else {
|
|
8107
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8108
|
-
console.log("[getAppEnvironment] Environment variable SCHEMAVAULTS_APP_ENVIRONMENT is not defined");
|
|
8109
|
-
}
|
|
8110
|
-
}
|
|
8111
|
-
if (typeof inlinedNextJsAppEnv === "string") {
|
|
8112
|
-
const parsed = schemaVaultsAppEnvironmentSchema.safeParse(stripQuotes(inlinedNextJsAppEnv));
|
|
8113
|
-
if (parsed.success) {
|
|
8114
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8115
|
-
console.log("[getAppEnvironment] Using NEXT_PUBLIC_SCHEMAVAULTS_APP_ENVIRONMENT environment variable: ", parsed.data);
|
|
8116
|
-
}
|
|
8117
|
-
return parsed.data;
|
|
8118
|
-
}
|
|
8119
|
-
throw new Error("Environment variable NEXT_PUBLIC_SCHEMAVAULTS_APP_ENVIRONMENT is defined but invalid!");
|
|
8120
|
-
} else {
|
|
8121
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8122
|
-
console.log("[getAppEnvironment] Environment variable NEXT_PUBLIC_SCHEMAVAULTS_APP_ENVIRONMENT is not defined");
|
|
8123
|
-
}
|
|
8124
|
-
}
|
|
8125
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8126
|
-
console.warn("SCHEMAVAULTS_APP_ENVIRONMENT and NEXT_PUBLIC_SCHEMAVAULTS_APP_ENVIRONMENT are not defined! Falling back to examining NODE_ENV...");
|
|
8127
|
-
}
|
|
8128
|
-
const node_env = process.env.NODE_ENV;
|
|
8129
|
-
if (node_env !== "development" && node_env !== "test" && node_env !== "production") {
|
|
8130
|
-
throw new TypeError("Expected NODE_ENV to be one of: 'development', 'test', or 'production'");
|
|
8131
|
-
}
|
|
8132
|
-
if (node_env === "development") {
|
|
8133
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8134
|
-
console.log("[getAppEnvironment] Running in 'development' environment based on NODE_ENV");
|
|
8135
|
-
}
|
|
8136
|
-
return "development";
|
|
8137
|
-
}
|
|
8138
|
-
if (node_env === "test") {
|
|
8139
|
-
if (DEBUG_GET_APP_ENVIRONMENT) {
|
|
8140
|
-
console.log("[getAppEnvironment] Running in 'test' environment based on NODE_ENV");
|
|
8141
|
-
}
|
|
8142
|
-
return "test";
|
|
8143
|
-
}
|
|
8144
|
-
if (node_env !== "production") {
|
|
8145
|
-
throw new Error("Expected NODE_ENV to be 'production' if this point is reached!");
|
|
8146
|
-
}
|
|
8147
|
-
throw new Error("NODE_ENV is set to 'production', but SCHEMAVAULTS_APP_ENVIRONMENT environment variable is not defined!");
|
|
8148
|
-
}
|
|
8149
|
-
|
|
8150
|
-
// node_modules/@schemavaults/app-definitions/dist/get-app-environment/get-app-environment.js
|
|
8151
|
-
function getAppEnvironment(DEBUG_GET_APP_ENVIRONMENT = false) {
|
|
8152
|
-
const isBrowser2 = isBrowser();
|
|
8153
|
-
if (isBrowser2) {
|
|
8154
|
-
throw new Error("Invalid usage of getAppEnvironment() in a browser context!");
|
|
8155
|
-
}
|
|
8156
|
-
return parseAppEnvironmentFromProcessDotEnv(DEBUG_GET_APP_ENVIRONMENT);
|
|
8157
|
-
}
|
|
8158
|
-
|
|
8159
|
-
// node_modules/@schemavaults/app-definitions/dist/SCHEMAVAULTS_AUTH_APP_ID.js
|
|
8160
|
-
var SCHEMAVAULTS_AUTH_APP_ID = SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id;
|
|
8161
|
-
|
|
8162
|
-
// node_modules/@schemavaults/app-definitions/dist/hardcoded-app-to-api-permissions.js
|
|
8163
|
-
var HARDCODED_APP_TO_API_PERMISSIONS = {
|
|
8164
|
-
[SCHEMAVAULTS_WEB.app_id]: [
|
|
8165
|
-
SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
8166
|
-
SCHEMAVAULTS_MAIL_SERVER.api_server_id
|
|
8167
|
-
],
|
|
8168
|
-
[SCHEMAVAULTS_CLI.app_id]: [
|
|
8169
|
-
SCHEMAVAULTS_REGISTRY_SERVER.api_server_id,
|
|
8170
|
-
SCHEMAVAULTS_MAIL_SERVER.api_server_id
|
|
8171
|
-
],
|
|
8172
|
-
[SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id]: [
|
|
8173
|
-
SCHEMAVAULTS_MAIL_SERVER.api_server_id
|
|
8174
|
-
],
|
|
8175
|
-
[SCHEMAVAULTS_AUTH_APP_DEFINITION.app_id]: []
|
|
8176
|
-
};
|
|
8177
|
-
|
|
8178
|
-
// src/email-template-id-schema.ts
|
|
7544
|
+
// src/validators/email-template-id-schema.ts
|
|
8179
7545
|
var emailTemplateIdSchema = external_exports.string().min(1, "Email template ID must be non-empty!").max(64).regex(
|
|
8180
7546
|
/^[a-z][a-z0-9_-]+$/,
|
|
8181
7547
|
"Template ID must start with a letter, and may only contain lowercase alphanumeric characters, hyphens and underscores."
|
|
@@ -8239,7 +7605,7 @@ function createSendEmailRequestBodySchema(allow_mailing_list_ids_as_recipients =
|
|
|
8239
7605
|
}
|
|
8240
7606
|
var sendEmailRequestBodySchema = createSendEmailRequestBodySchema();
|
|
8241
7607
|
|
|
8242
|
-
// src/get-api-key.ts
|
|
7608
|
+
// src/env/get-api-key.ts
|
|
8243
7609
|
function getSchemaVaultsMailApiKey() {
|
|
8244
7610
|
if (!process.env.SCHEMAVAULTS_MAIL_API_KEY || typeof process.env.SCHEMAVAULTS_MAIL_API_KEY !== "string") {
|
|
8245
7611
|
throw new Error(
|
|
@@ -8250,22 +7616,56 @@ function getSchemaVaultsMailApiKey() {
|
|
|
8250
7616
|
}
|
|
8251
7617
|
var get_api_key_default = getSchemaVaultsMailApiKey;
|
|
8252
7618
|
|
|
7619
|
+
// src/validators/is-valid-url.ts
|
|
7620
|
+
function isValidUrl(val) {
|
|
7621
|
+
return typeof val === "string" && stringType().url().safeParse(val).success;
|
|
7622
|
+
}
|
|
7623
|
+
|
|
7624
|
+
// src/env/get-mail-server-url.ts
|
|
7625
|
+
function getMailServerUrl() {
|
|
7626
|
+
const SCHEMAVAULTS_MAIL_SERVER_URL = process.env.SCHEMAVAULTS_MAIL_SERVER_URL;
|
|
7627
|
+
if (typeof SCHEMAVAULTS_MAIL_SERVER_URL === "string" && SCHEMAVAULTS_MAIL_SERVER_URL.length > 0) {
|
|
7628
|
+
return SCHEMAVAULTS_MAIL_SERVER_URL;
|
|
7629
|
+
}
|
|
7630
|
+
throw new TypeError(
|
|
7631
|
+
`Failed to parse mail server URL from environment variable 'SCHEMAVAULTS_MAIL_SERVER_URL'`
|
|
7632
|
+
);
|
|
7633
|
+
}
|
|
7634
|
+
var get_mail_server_url_default = getMailServerUrl;
|
|
7635
|
+
|
|
7636
|
+
// src/parse-mail-server-url-with-env-fallback.ts
|
|
7637
|
+
function parseMailServerUrlWithEnvFallback(maybe_mail_server_url_input) {
|
|
7638
|
+
if (typeof maybe_mail_server_url_input !== "string" && typeof maybe_mail_server_url_input !== "undefined") {
|
|
7639
|
+
throw new TypeError(
|
|
7640
|
+
"Expected 'mailServerUrl' option to be a string or undefined!",
|
|
7641
|
+
{
|
|
7642
|
+
cause: `Received type '${typeof maybe_mail_server_url_input}'`
|
|
7643
|
+
}
|
|
7644
|
+
);
|
|
7645
|
+
}
|
|
7646
|
+
let mail_server_url = void 0;
|
|
7647
|
+
if (typeof maybe_mail_server_url_input === "string") {
|
|
7648
|
+
mail_server_url = maybe_mail_server_url_input;
|
|
7649
|
+
} else if (typeof maybe_mail_server_url_input === "undefined") {
|
|
7650
|
+
try {
|
|
7651
|
+
mail_server_url = get_mail_server_url_default();
|
|
7652
|
+
} catch {
|
|
7653
|
+
}
|
|
7654
|
+
}
|
|
7655
|
+
if (!isValidUrl(mail_server_url)) {
|
|
7656
|
+
throw new TypeError(
|
|
7657
|
+
"Failed to parse a valid mail server URL from sendEmail input options or environment variable 'SCHEMAVAULTS_MAIL_SERVER_URL'!"
|
|
7658
|
+
);
|
|
7659
|
+
}
|
|
7660
|
+
return mail_server_url;
|
|
7661
|
+
}
|
|
7662
|
+
|
|
8253
7663
|
// src/send-email.ts
|
|
8254
7664
|
var body_schema = createSendEmailRequestBodySchema(true);
|
|
8255
7665
|
async function sendEmail({
|
|
8256
7666
|
body,
|
|
8257
7667
|
...opts
|
|
8258
7668
|
}) {
|
|
8259
|
-
let environment;
|
|
8260
|
-
if (opts.environment) {
|
|
8261
|
-
environment = opts.environment;
|
|
8262
|
-
} else {
|
|
8263
|
-
try {
|
|
8264
|
-
environment = getAppEnvironment();
|
|
8265
|
-
} catch {
|
|
8266
|
-
environment = "production";
|
|
8267
|
-
}
|
|
8268
|
-
}
|
|
8269
7669
|
const effectiveBody = typeof opts.dryRun === "boolean" ? { ...body, dryRun: opts.dryRun } : body;
|
|
8270
7670
|
const parsed = await body_schema.safeParseAsync(effectiveBody);
|
|
8271
7671
|
if (!parsed.success) {
|
|
@@ -8278,20 +7678,10 @@ async function sendEmail({
|
|
|
8278
7678
|
} else {
|
|
8279
7679
|
bearerToken = get_api_key_default();
|
|
8280
7680
|
}
|
|
8281
|
-
|
|
8282
|
-
|
|
8283
|
-
|
|
8284
|
-
|
|
8285
|
-
mail_server_url = getHardcodedApiServerDomain(
|
|
8286
|
-
SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
8287
|
-
environment
|
|
8288
|
-
).domain;
|
|
8289
|
-
} else {
|
|
8290
|
-
throw new TypeError(
|
|
8291
|
-
"Expected 'mailServerUrl' to be a string or undefined!"
|
|
8292
|
-
);
|
|
8293
|
-
}
|
|
8294
|
-
const endpoint = `${mail_server_url}/api/send`;
|
|
7681
|
+
const mail_server_url = parseMailServerUrlWithEnvFallback(
|
|
7682
|
+
opts.mailServerUrl
|
|
7683
|
+
);
|
|
7684
|
+
const endpoint = new URL(`/api/send`, mail_server_url);
|
|
8295
7685
|
const response = await fetch(endpoint, {
|
|
8296
7686
|
method: "POST",
|
|
8297
7687
|
body: JSON.stringify(parsed.data),
|
|
@@ -8322,7 +7712,12 @@ async function sendEmail({
|
|
|
8322
7712
|
}
|
|
8323
7713
|
var send_email_default = sendEmail;
|
|
8324
7714
|
|
|
8325
|
-
// src/
|
|
7715
|
+
// src/validators/is-valid-uuid.ts
|
|
7716
|
+
function isValidUuid(val) {
|
|
7717
|
+
return typeof val === "string" && external_exports.string().safeParse(val).success;
|
|
7718
|
+
}
|
|
7719
|
+
|
|
7720
|
+
// src/env/get-mailing-list-id.ts
|
|
8326
7721
|
function getSchemaVaultsMailingListId() {
|
|
8327
7722
|
if (!process.env.SCHEMAVAULTS_MAILING_LIST_ID || typeof process.env.SCHEMAVAULTS_MAILING_LIST_ID !== "string") {
|
|
8328
7723
|
throw new Error(
|
|
@@ -8331,9 +7726,8 @@ function getSchemaVaultsMailingListId() {
|
|
|
8331
7726
|
}
|
|
8332
7727
|
return process.env.SCHEMAVAULTS_MAILING_LIST_ID;
|
|
8333
7728
|
}
|
|
8334
|
-
|
|
8335
|
-
|
|
8336
|
-
}
|
|
7729
|
+
|
|
7730
|
+
// src/send-email-to-mailing-list.ts
|
|
8337
7731
|
async function sendEmailToMailingList(opts) {
|
|
8338
7732
|
let to;
|
|
8339
7733
|
if (typeof opts.mailingListId === "string") {
|
|
@@ -8341,7 +7735,7 @@ async function sendEmailToMailingList(opts) {
|
|
|
8341
7735
|
} else {
|
|
8342
7736
|
to = getSchemaVaultsMailingListId();
|
|
8343
7737
|
}
|
|
8344
|
-
if (!
|
|
7738
|
+
if (!isValidUuid(to)) {
|
|
8345
7739
|
throw new TypeError(
|
|
8346
7740
|
"Failed to parse 'to' field as a mailing list ID (UUID)!"
|
|
8347
7741
|
);
|
|
@@ -8358,27 +7752,16 @@ var send_email_to_mailing_list_default = sendEmailToMailingList;
|
|
|
8358
7752
|
|
|
8359
7753
|
// src/list-email-templates.ts
|
|
8360
7754
|
async function listEmailTemplates(opts = {}) {
|
|
8361
|
-
|
|
8362
|
-
|
|
8363
|
-
|
|
8364
|
-
} else {
|
|
8365
|
-
try {
|
|
8366
|
-
environment = getAppEnvironment();
|
|
8367
|
-
} catch {
|
|
8368
|
-
environment = "production";
|
|
8369
|
-
}
|
|
8370
|
-
}
|
|
7755
|
+
const mail_server_url = parseMailServerUrlWithEnvFallback(
|
|
7756
|
+
opts.mailServerUrl
|
|
7757
|
+
);
|
|
8371
7758
|
let bearerToken;
|
|
8372
7759
|
if (opts.bearerToken && typeof opts.bearerToken === "string") {
|
|
8373
7760
|
bearerToken = opts.bearerToken;
|
|
8374
7761
|
} else {
|
|
8375
7762
|
bearerToken = get_api_key_default();
|
|
8376
7763
|
}
|
|
8377
|
-
const
|
|
8378
|
-
SCHEMAVAULTS_MAIL_APP_DEFINITION.app_id,
|
|
8379
|
-
environment
|
|
8380
|
-
).domain;
|
|
8381
|
-
const endpoint = `${mail_server_url}/api/templates`;
|
|
7764
|
+
const endpoint = new URL("/api/templates", mail_server_url);
|
|
8382
7765
|
const response = await fetch(endpoint, {
|
|
8383
7766
|
method: "GET",
|
|
8384
7767
|
headers: {
|
|
@@ -8461,7 +7844,10 @@ function attachBodyOptions(cmd) {
|
|
|
8461
7844
|
).option(
|
|
8462
7845
|
"--template-props <json>",
|
|
8463
7846
|
"JSON string of props to render the template with"
|
|
8464
|
-
).option("--text <text>", "Plain-text body (requires --html)").option("--html <html>", "HTML body (requires --text)").option(
|
|
7847
|
+
).option("--text <text>", "Plain-text body (requires --html)").option("--html <html>", "HTML body (requires --text)").option(
|
|
7848
|
+
"--text-file <path>",
|
|
7849
|
+
"Path to a file containing the plain-text body"
|
|
7850
|
+
).option("--html-file <path>", "Path to a file containing the HTML body").option(
|
|
8465
7851
|
"--body-file <path>",
|
|
8466
7852
|
"Path to a JSON file containing the full request body (overrides other body flags)"
|
|
8467
7853
|
);
|
|
@@ -8507,7 +7893,6 @@ attachBodyOptions(
|
|
|
8507
7893
|
await send_email_default({
|
|
8508
7894
|
body,
|
|
8509
7895
|
...global.apiKey ? { bearerToken: global.apiKey } : {},
|
|
8510
|
-
...global.environment ? { environment: global.environment } : {},
|
|
8511
7896
|
...global.dryRun ? { dryRun: true } : {}
|
|
8512
7897
|
});
|
|
8513
7898
|
console.log(
|
|
@@ -8547,7 +7932,6 @@ attachBodyOptions(
|
|
|
8547
7932
|
body,
|
|
8548
7933
|
...opts.mailingListId ? { mailingListId: opts.mailingListId } : {},
|
|
8549
7934
|
...global.apiKey ? { bearerToken: global.apiKey } : {},
|
|
8550
|
-
...global.environment ? { environment: global.environment } : {},
|
|
8551
7935
|
...global.dryRun ? { dryRun: true } : {}
|
|
8552
7936
|
});
|
|
8553
7937
|
console.log(
|
|
@@ -8561,8 +7945,7 @@ program2.command("list-templates").description("List available email templates")
|
|
|
8561
7945
|
await withErrorHandling(async () => {
|
|
8562
7946
|
const global = cmd.optsWithGlobals();
|
|
8563
7947
|
const templates = await list_email_templates_default({
|
|
8564
|
-
...global.apiKey ? { bearerToken: global.apiKey } : {}
|
|
8565
|
-
...global.environment ? { environment: global.environment } : {}
|
|
7948
|
+
...global.apiKey ? { bearerToken: global.apiKey } : {}
|
|
8566
7949
|
});
|
|
8567
7950
|
if (opts.format === "table") {
|
|
8568
7951
|
for (const t of templates) {
|