@speckle/shared
Version:
Shared code between various Speckle JS packages
318 lines • 10.8 kB
TypeScript
import { z } from 'zod';
import * as Knex from 'knex';
import { Logger } from 'pino';
declare const regionConfigSchema: z.ZodObject<{
postgres: z.ZodObject<{
connectionUri: z.ZodString;
databaseName: z.ZodOptional<z.ZodString>;
privateConnectionUri: z.ZodOptional<z.ZodString>;
publicTlsCertificate: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}>;
blobStorage: z.ZodObject<{
endpoint: z.ZodString;
accessKey: z.ZodString;
secretKey: z.ZodString;
bucket: z.ZodString;
createBucketIfNotExists: z.ZodBoolean;
s3Region: z.ZodString;
}, "strip", z.ZodTypeAny, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}>;
}, "strip", z.ZodTypeAny, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}>;
declare const multiRegionConfigSchema: z.ZodObject<{
main: z.ZodObject<{
postgres: z.ZodObject<{
connectionUri: z.ZodString;
databaseName: z.ZodOptional<z.ZodString>;
privateConnectionUri: z.ZodOptional<z.ZodString>;
publicTlsCertificate: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}>;
blobStorage: z.ZodObject<{
endpoint: z.ZodString;
accessKey: z.ZodString;
secretKey: z.ZodString;
bucket: z.ZodString;
createBucketIfNotExists: z.ZodBoolean;
s3Region: z.ZodString;
}, "strip", z.ZodTypeAny, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}>;
}, "strip", z.ZodTypeAny, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}>;
regions: z.ZodRecord<z.ZodString, z.ZodObject<{
postgres: z.ZodObject<{
connectionUri: z.ZodString;
databaseName: z.ZodOptional<z.ZodString>;
privateConnectionUri: z.ZodOptional<z.ZodString>;
publicTlsCertificate: z.ZodOptional<z.ZodString>;
}, "strip", z.ZodTypeAny, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}, {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
}>;
blobStorage: z.ZodObject<{
endpoint: z.ZodString;
accessKey: z.ZodString;
secretKey: z.ZodString;
bucket: z.ZodString;
createBucketIfNotExists: z.ZodBoolean;
s3Region: z.ZodString;
}, "strip", z.ZodTypeAny, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}, {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
}>;
}, "strip", z.ZodTypeAny, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}>>;
defaultProjectRegionKey: z.ZodOptional<z.ZodNullable<z.ZodString>>;
}, "strip", z.ZodTypeAny, {
main: {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
};
regions: Record<string, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}>;
defaultProjectRegionKey?: string | null | undefined;
}, {
main: {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
};
regions: Record<string, {
postgres: {
connectionUri: string;
databaseName?: string | undefined;
privateConnectionUri?: string | undefined;
publicTlsCertificate?: string | undefined;
};
blobStorage: {
endpoint: string;
accessKey: string;
secretKey: string;
bucket: string;
createBucketIfNotExists: boolean;
s3Region: string;
};
}>;
defaultProjectRegionKey?: string | null | undefined;
}>;
export type MultiRegionConfig = z.infer<typeof multiRegionConfigSchema>;
export type MainRegionConfig = MultiRegionConfig['main'];
export type DataRegionsConfig = MultiRegionConfig['regions'];
export type RegionServerConfig = z.infer<typeof regionConfigSchema>;
export type BlobStorageConfig = RegionServerConfig['blobStorage'];
export declare const loadMultiRegionsConfig: ({ path }: {
path: string;
}) => Promise<MultiRegionConfig>;
export type KnexConfigArgs = {
migrationDirs: string[];
isTestEnv: boolean;
isDevOrTestEnv: boolean;
logger: Logger;
maxConnections: number;
applicationName: string;
connectionAcquireTimeoutMillis: number;
connectionCreateTimeoutMillis: number;
/**
* If set to any value - true or false - will explicitly enable or disable async stack traces
* that show where queries are launched from. If not set, will default to true in dev
* and test environments
*/
asyncStackTraces?: boolean;
};
export declare const createKnexConfig: ({ connectionString, migrationDirs, isTestEnv, isDevOrTestEnv, logger, maxConnections, caCertificate, connectionAcquireTimeoutMillis, connectionCreateTimeoutMillis, asyncStackTraces }: {
connectionString?: string | undefined;
caCertificate?: string | undefined;
} & KnexConfigArgs) => Knex.Knex.Config;
export declare const configureKnexClient: (config: Pick<RegionServerConfig, "postgres">, configArgs: KnexConfigArgs) => {
public: Knex.Knex;
private?: Knex.Knex;
};
export {};
//# sourceMappingURL=multiRegionConfig.d.ts.map