diff --git a/.gitignore b/.gitignore index 8e9f893..80e94d4 100644 --- a/.gitignore +++ b/.gitignore @@ -50,3 +50,5 @@ next-env.d.ts /data/movie_ids_*.json /data/*.tsv backup + +dbschema/edgeql-js diff --git a/dbschema/default.esdl b/dbschema/default.esdl new file mode 100644 index 0000000..8547650 --- /dev/null +++ b/dbschema/default.esdl @@ -0,0 +1,122 @@ +module default { + abstract type HasTimestamps { + property createdAt -> datetime { + readonly := true; + rewrite insert using (datetime_of_statement()); + }; + + property updatedAt -> datetime { + readonly := true; + rewrite insert, update using (datetime_of_statement()); + }; + }; + + type Movie extending HasTimestamps { + # main external ids + required property tmdbId -> int32 { constraint exclusive; }; + required property imdbId -> str { constraint exclusive; }; + + # other external ids + property wikidataId -> str; + property facebookId -> str; + property instagramId -> str; + property twitterId -> str; + property netflixId -> str; + property huluId -> str; + property amazonId -> str; + property appleTVId -> str; + property twitterUsername -> str; + property googleKGId -> str; + property traktTVId -> str; + property redditTopicId -> str; + property letterboxdId -> str; + property metacriticId -> str; + property allMovieId -> str; + property disneyPlusId -> str; + property hboMaxId -> str; + + # general metadata + required property title -> str; + property originalTitle -> str; + property language -> str; + property releaseYear -> int32; + property releaseDate -> datetime; + property genres -> array { default := >[]; }; + property plot -> str; + property runtime -> int32; + required property adult -> bool { default := false; }; + property budget -> str; + property revenue -> str; + property homepage -> str; + property status -> str; + property mpaaRating -> str; + required property keywords -> array { default := >[]; }; + required property countriesOfOrigin -> array { default := >[]; }; + required property languages -> array { default := >[]; }; + required property cast -> array { default := >[]; }; + property director -> str; + property production -> str; + property awardsSummary -> str; + + # images + property posterUrl -> str; + property posterPlaceholderUrl -> str; + property posterWidth -> int32; + property posterHeight -> int32; + property backdropUrl -> str; + property backdropPlaceholderUrl -> str; + property backdropWidth -> int32; + property backdropHeight -> int32; + + # videos + property trailerUrl -> str; + property trailerYouTubeId -> str; + + # imdb + property imdbRating -> float32; + property imdbVotes -> int32; + property imdbType -> str; + + # tmdb + property tmdbPopularity -> float32; # https://developer.themoviedb.org/docs/popularity-and-trending + property tmdbRating -> float32; + property tmdbVotes -> int32; + + # metacritic + property metacriticRating -> float32; + property metacriticVotes -> int32; + + # rotten tomatoes + property rtCriticRating -> int32; + property rtCriticVotes -> int32; + property rtAudienceRating -> int32; + property rtAudienceVotes -> int32; + property rtCriticConsensur -> str; + property rtId -> str; + property emsId -> str; + property rtUrl -> str; + + # letterboxd + property letterboxdScore -> int32; + property letterboxdVotes -> int32; + + # flickmetrix + property flickMetrixScore -> int32; + property flickMetrixVotes -> int32; + + # custom / application-specific) + property foreign -> bool { default := false; }; + property relevancyScore -> float32 { default := 0; }; + property imdbCustomPopularity -> float32; + property searchL -> str; + + index on ((.imdbRating, .releaseYear, .foreign, .genres, .searchL, .relevancyScore)); + index on (.imdbVotes); + index on (.tmdbPopularity); + index on (.rtCriticRating); + index on (.rtAudienceRating); + index on (.releaseDate); + index on (.tmdbId); + index on (.imdbId); + }; +} diff --git a/dbschema/interfaces.ts b/dbschema/interfaces.ts new file mode 100644 index 0000000..7793f14 --- /dev/null +++ b/dbschema/interfaces.ts @@ -0,0 +1,500 @@ +// GENERATED by @edgedb/generate v0.3.4 +import type * as edgedb from 'edgedb' + +export namespace std { + export interface BaseObject { + id: string + } + export interface $Object extends BaseObject {} + export interface FreeObject extends BaseObject {} + export type JsonEmpty = + | 'ReturnEmpty' + | 'ReturnTarget' + | 'Error' + | 'UseNull' + | 'DeleteKey' +} +export namespace cfg { + export interface ConfigObject extends std.BaseObject {} + export interface AbstractConfig extends ConfigObject { + session_idle_timeout: edgedb.Duration + session_idle_transaction_timeout: edgedb.Duration + query_execution_timeout: edgedb.Duration + listen_port: number + listen_addresses: string[] + allow_dml_in_functions?: boolean | null + allow_bare_ddl?: AllowBareDDL | null + apply_access_policies?: boolean | null + allow_user_specified_id?: boolean | null + shared_buffers?: edgedb.ConfigMemory | null + query_work_mem?: edgedb.ConfigMemory | null + maintenance_work_mem?: edgedb.ConfigMemory | null + effective_cache_size?: edgedb.ConfigMemory | null + effective_io_concurrency?: number | null + default_statistics_target?: number | null + force_database_error?: string | null + _pg_prepared_statement_cache_size: number + auth: Auth[] + } + export type AllowBareDDL = 'AlwaysAllow' | 'NeverAllow' + export interface Auth extends ConfigObject { + priority: number + user: string[] + comment?: string | null + method?: AuthMethod | null + } + export interface AuthMethod extends ConfigObject { + transports: ConnectionTransport[] + } + export interface Config extends AbstractConfig {} + export type ConnectionTransport = 'TCP' | 'TCP_PG' | 'HTTP' + export interface DatabaseConfig extends AbstractConfig {} + export interface InstanceConfig extends AbstractConfig {} + export interface JWT extends AuthMethod { + transports: ConnectionTransport[] + } + export interface SCRAM extends AuthMethod { + transports: ConnectionTransport[] + } + export interface Trust extends AuthMethod {} +} +export interface HasTimestamps extends std.$Object { + createdAt?: Date | null + updatedAt?: Date | null +} +export interface Movie extends HasTimestamps { + appleTVId?: string | null + status?: string | null + title: string + tmdbId: number + awardsSummary?: string | null + rtUrl?: string | null + runtime?: number | null + searchL?: string | null + amazonId?: string | null + adult: boolean + allMovieId?: string | null + backdropHeight?: number | null + backdropPlaceholderUrl?: string | null + backdropUrl?: string | null + backdropWidth?: number | null + budget?: string | null + cast: string[] + countriesOfOrigin: string[] + director?: string | null + disneyPlusId?: string | null + emsId?: string | null + facebookId?: string | null + flickMetrixScore?: number | null + flickMetrixVotes?: number | null + foreign?: boolean | null + genres?: string[] | null + googleKGId?: string | null + hboMaxId?: string | null + homepage?: string | null + huluId?: string | null + imdbCustomPopularity?: number | null + imdbId: string + imdbRating?: number | null + imdbType?: string | null + imdbVotes?: number | null + instagramId?: string | null + keywords: string[] + language?: string | null + languages: string[] + letterboxdId?: string | null + letterboxdScore?: number | null + letterboxdVotes?: number | null + metacriticId?: string | null + metacriticRating?: number | null + metacriticVotes?: number | null + mpaaRating?: string | null + netflixId?: string | null + originalTitle?: string | null + plot?: string | null + posterHeight?: number | null + posterPlaceholderUrl?: string | null + posterUrl?: string | null + posterWidth?: number | null + production?: string | null + redditTopicId?: string | null + releaseDate?: Date | null + releaseYear?: number | null + relevancyScore?: number | null + revenue?: string | null + rtAudienceRating?: number | null + rtAudienceVotes?: number | null + rtCriticConsensur?: string | null + rtCriticRating?: number | null + rtCriticVotes?: number | null + rtId?: string | null + tmdbPopularity?: number | null + tmdbRating?: number | null + tmdbVotes?: number | null + trailerUrl?: string | null + trailerYouTubeId?: string | null + traktTVId?: string | null + twitterId?: string | null + twitterUsername?: string | null + wikidataId?: string | null +} +export namespace schema { + export type AccessKind = + | 'Select' + | 'UpdateRead' + | 'UpdateWrite' + | 'Delete' + | 'Insert' + export interface $Object extends std.BaseObject { + name: string + internal: boolean + builtin: boolean + computed_fields?: string[] | null + } + export interface SubclassableObject extends $Object { + abstract?: boolean | null + is_abstract?: boolean | null + final: boolean + is_final: boolean + } + export interface InheritingObject extends SubclassableObject { + inherited_fields?: string[] | null + bases: InheritingObject[] + ancestors: InheritingObject[] + } + export interface AnnotationSubject extends $Object { + annotations: Annotation[] + } + export interface AccessPolicy extends InheritingObject, AnnotationSubject { + access_kinds: AccessKind[] + condition?: string | null + action: AccessPolicyAction + expr?: string | null + errmessage?: string | null + subject: ObjectType + } + export type AccessPolicyAction = 'Allow' | 'Deny' + export interface Alias extends AnnotationSubject { + expr: string + type?: Type | null + } + export interface Annotation extends InheritingObject, AnnotationSubject { + inheritable?: boolean | null + } + export interface Type extends SubclassableObject, AnnotationSubject { + expr?: string | null + from_alias?: boolean | null + is_from_alias?: boolean | null + } + export interface PrimitiveType extends Type {} + export interface CollectionType extends PrimitiveType {} + export interface Array extends CollectionType { + dimensions?: number[] | null + element_type: Type + } + export interface ArrayExprAlias extends Array {} + export interface CallableObject extends AnnotationSubject { + return_typemod?: TypeModifier | null + params: Parameter[] + return_type?: Type | null + } + export type Cardinality = 'One' | 'Many' + export interface VolatilitySubject extends $Object { + volatility?: Volatility | null + } + export interface Cast extends AnnotationSubject, VolatilitySubject { + allow_implicit?: boolean | null + allow_assignment?: boolean | null + from_type?: Type | null + to_type?: Type | null + } + export interface ConsistencySubject + extends InheritingObject, + AnnotationSubject { + constraints: Constraint[] + } + export interface Constraint extends CallableObject, InheritingObject { + expr?: string | null + subjectexpr?: string | null + finalexpr?: string | null + errmessage?: string | null + delegated?: boolean | null + except_expr?: string | null + subject?: ConsistencySubject | null + params: Parameter[] + } + export interface Delta extends $Object { + parents: Delta[] + } + export interface Extension extends AnnotationSubject, $Object { + package: sys.ExtensionPackage + } + export interface Function extends CallableObject, VolatilitySubject { + body?: string | null + language: string + preserves_optionality?: boolean | null + used_globals: Global[] + } + export interface FutureBehavior extends $Object {} + export interface Global extends AnnotationSubject { + required?: boolean | null + cardinality?: Cardinality | null + expr?: string | null + default?: string | null + target?: Type | null + } + export interface Index extends InheritingObject, AnnotationSubject { + except_expr?: string | null + expr?: string | null + kwargs?: { name: string; expr: string }[] | null + params: Parameter[] + } + export interface Pointer extends ConsistencySubject, AnnotationSubject { + cardinality?: Cardinality | null + required?: boolean | null + readonly?: boolean | null + default?: string | null + expr?: string | null + source?: Source | null + target?: Type | null + rewrites: Rewrite[] + } + export interface Source extends $Object { + pointers: Pointer[] + indexes: Index[] + } + export interface Link extends Pointer, Source { + on_target_delete?: TargetDeleteAction | null + on_source_delete?: SourceDeleteAction | null + target?: ObjectType | null + properties: Property[] + } + export interface Migration extends AnnotationSubject, $Object { + script: string + message?: string | null + generated_by?: MigrationGeneratedBy | null + parents: Migration[] + } + export type MigrationGeneratedBy = 'DevMode' | 'DDLStatement' + export interface Module extends AnnotationSubject, $Object {} + export interface ObjectType + extends Source, + ConsistencySubject, + InheritingObject, + Type, + AnnotationSubject { + compound_type: boolean + is_compound_type: boolean + union_of: ObjectType[] + intersection_of: ObjectType[] + properties: Property[] + links: Link[] + access_policies: AccessPolicy[] + triggers: Trigger[] + } + export interface Operator extends CallableObject, VolatilitySubject { + operator_kind?: OperatorKind | null + is_abstract?: boolean | null + abstract?: boolean | null + } + export type OperatorKind = 'Infix' | 'Postfix' | 'Prefix' | 'Ternary' + export interface Parameter extends $Object { + typemod: TypeModifier + kind: ParameterKind + num: number + default?: string | null + type: Type + } + export type ParameterKind = + | 'VariadicParam' + | 'NamedOnlyParam' + | 'PositionalParam' + export interface Property extends Pointer {} + export interface PseudoType extends InheritingObject, Type {} + export interface Range extends CollectionType { + element_type: Type + } + export interface RangeExprAlias extends Range {} + export interface Rewrite extends InheritingObject, AnnotationSubject { + kind: TriggerKind + expr: string + subject: Pointer + } + export type RewriteKind = 'Update' | 'Insert' + export interface ScalarType + extends PrimitiveType, + ConsistencySubject, + AnnotationSubject { + default?: string | null + enum_values?: string[] | null + arg_values?: string[] | null + } + export type SourceDeleteAction = + | 'DeleteTarget' + | 'Allow' + | 'DeleteTargetIfOrphan' + export type TargetDeleteAction = + | 'Restrict' + | 'DeleteSource' + | 'Allow' + | 'DeferredRestrict' + export interface Trigger extends InheritingObject, AnnotationSubject { + timing: TriggerTiming + kinds: TriggerKind[] + scope: TriggerScope + expr?: string | null + subject: ObjectType + } + export type TriggerKind = 'Update' | 'Delete' | 'Insert' + export type TriggerScope = 'All' | 'Each' + export type TriggerTiming = 'After' | 'AfterCommitOf' + export interface Tuple extends CollectionType { + named: boolean + element_types: TupleElement[] + } + export interface TupleElement extends std.BaseObject { + name?: string | null + type: Type + } + export interface TupleExprAlias extends Tuple {} + export type TypeModifier = 'SetOfType' | 'OptionalType' | 'SingletonType' + export type Volatility = 'Immutable' | 'Stable' | 'Volatile' +} +export namespace sys { + export interface SystemObject extends schema.$Object {} + export interface ExternalObject extends SystemObject {} + export interface Database extends ExternalObject, schema.AnnotationSubject { + name: string + } + export interface ExtensionPackage + extends SystemObject, + schema.AnnotationSubject { + script: string + version: { + major: number + minor: number + stage: VersionStage + stage_no: number + local: string[] + } + } + export interface Role + extends SystemObject, + schema.InheritingObject, + schema.AnnotationSubject { + name: string + superuser: boolean + is_superuser: boolean + password?: string | null + member_of: Role[] + } + export type TransactionIsolation = 'RepeatableRead' | 'Serializable' + export type VersionStage = 'dev' | 'alpha' | 'beta' | 'rc' | 'final' +} +export interface types { + std: { + BaseObject: std.BaseObject + Object: std.$Object + FreeObject: std.FreeObject + JsonEmpty: std.JsonEmpty + } + cfg: { + ConfigObject: cfg.ConfigObject + AbstractConfig: cfg.AbstractConfig + AllowBareDDL: cfg.AllowBareDDL + Auth: cfg.Auth + AuthMethod: cfg.AuthMethod + Config: cfg.Config + ConnectionTransport: cfg.ConnectionTransport + DatabaseConfig: cfg.DatabaseConfig + InstanceConfig: cfg.InstanceConfig + JWT: cfg.JWT + SCRAM: cfg.SCRAM + Trust: cfg.Trust + } + default: { + HasTimestamps: HasTimestamps + Movie: Movie + } + schema: { + AccessKind: schema.AccessKind + Object: schema.$Object + SubclassableObject: schema.SubclassableObject + InheritingObject: schema.InheritingObject + AnnotationSubject: schema.AnnotationSubject + AccessPolicy: schema.AccessPolicy + AccessPolicyAction: schema.AccessPolicyAction + Alias: schema.Alias + Annotation: schema.Annotation + Type: schema.Type + PrimitiveType: schema.PrimitiveType + CollectionType: schema.CollectionType + Array: schema.Array + ArrayExprAlias: schema.ArrayExprAlias + CallableObject: schema.CallableObject + Cardinality: schema.Cardinality + VolatilitySubject: schema.VolatilitySubject + Cast: schema.Cast + ConsistencySubject: schema.ConsistencySubject + Constraint: schema.Constraint + Delta: schema.Delta + Extension: schema.Extension + Function: schema.Function + FutureBehavior: schema.FutureBehavior + Global: schema.Global + Index: schema.Index + Pointer: schema.Pointer + Source: schema.Source + Link: schema.Link + Migration: schema.Migration + MigrationGeneratedBy: schema.MigrationGeneratedBy + Module: schema.Module + ObjectType: schema.ObjectType + Operator: schema.Operator + OperatorKind: schema.OperatorKind + Parameter: schema.Parameter + ParameterKind: schema.ParameterKind + Property: schema.Property + PseudoType: schema.PseudoType + Range: schema.Range + RangeExprAlias: schema.RangeExprAlias + Rewrite: schema.Rewrite + RewriteKind: schema.RewriteKind + ScalarType: schema.ScalarType + SourceDeleteAction: schema.SourceDeleteAction + TargetDeleteAction: schema.TargetDeleteAction + Trigger: schema.Trigger + TriggerKind: schema.TriggerKind + TriggerScope: schema.TriggerScope + TriggerTiming: schema.TriggerTiming + Tuple: schema.Tuple + TupleElement: schema.TupleElement + TupleExprAlias: schema.TupleExprAlias + TypeModifier: schema.TypeModifier + Volatility: schema.Volatility + } + sys: { + SystemObject: sys.SystemObject + ExternalObject: sys.ExternalObject + Database: sys.Database + ExtensionPackage: sys.ExtensionPackage + Role: sys.Role + TransactionIsolation: sys.TransactionIsolation + VersionStage: sys.VersionStage + } +} + +export namespace helper { + type LinkType = std.BaseObject | std.BaseObject[] + + export type propertyKeys = { + [k in keyof T]: NonNullable extends LinkType ? never : k + }[keyof T] + + export type linkKeys = { + [k in keyof T]: NonNullable extends LinkType ? k : never + }[keyof T] + + export type Props = Pick> + export type Links = Pick> +} diff --git a/dbschema/migrations/00001.edgeql b/dbschema/migrations/00001.edgeql new file mode 100644 index 0000000..02b159c --- /dev/null +++ b/dbschema/migrations/00001.edgeql @@ -0,0 +1,117 @@ +CREATE MIGRATION m1droyjbi5m65eavuiuuwzxumd2zf26vnggq3s4wyf5ngxfl7lkuia + ONTO initial +{ + CREATE ABSTRACT TYPE default::HasTimestamps { + CREATE PROPERTY createdAt: std::datetime { + SET readonly := true; + CREATE REWRITE + INSERT + USING (std::datetime_of_statement()); + }; + CREATE PROPERTY updatedAt: std::datetime { + SET readonly := true; + CREATE REWRITE + INSERT + USING (std::datetime_of_statement()); + CREATE REWRITE + UPDATE + USING (std::datetime_of_statement()); + }; + }; + CREATE TYPE default::Movie EXTENDING default::HasTimestamps { + CREATE REQUIRED PROPERTY adult: std::bool { + SET default := false; + }; + CREATE PROPERTY allMovieId: std::str; + CREATE PROPERTY amazonId: std::str; + CREATE PROPERTY appleTVId: std::str; + CREATE PROPERTY awardsSummary: std::str; + CREATE PROPERTY backdropHeight: std::int32; + CREATE PROPERTY backdropPlaceholderUrl: std::str; + CREATE PROPERTY backdropUrl: std::str; + CREATE PROPERTY backdropWidth: std::int32; + CREATE PROPERTY budget: std::str; + CREATE REQUIRED PROPERTY cast: array { + SET default := (>[]); + }; + CREATE REQUIRED PROPERTY countriesOfOrigin: array { + SET default := (>[]); + }; + CREATE PROPERTY director: std::str; + CREATE PROPERTY disneyPlusId: std::str; + CREATE PROPERTY emsId: std::str; + CREATE PROPERTY facebookId: std::str; + CREATE PROPERTY flickMetrixScore: std::int32; + CREATE PROPERTY flickMetrixVotes: std::int32; + CREATE PROPERTY foreign: std::bool { + SET default := false; + }; + CREATE PROPERTY genres: array { + SET default := (>[]); + }; + CREATE PROPERTY googleKGId: std::str; + CREATE PROPERTY hboMaxId: std::str; + CREATE PROPERTY homepage: std::str; + CREATE PROPERTY huluId: std::str; + CREATE PROPERTY imdbCustomPopularity: std::float32; + CREATE REQUIRED PROPERTY imdbId: std::str { + CREATE CONSTRAINT std::exclusive; + }; + CREATE PROPERTY imdbRating: std::float32; + CREATE PROPERTY imdbType: std::str; + CREATE PROPERTY imdbVotes: std::int32; + CREATE PROPERTY instagramId: std::str; + CREATE REQUIRED PROPERTY keywords: array { + SET default := (>[]); + }; + CREATE PROPERTY language: std::str; + CREATE REQUIRED PROPERTY languages: array { + SET default := (>[]); + }; + CREATE PROPERTY letterboxdId: std::str; + CREATE PROPERTY letterboxdScore: std::int32; + CREATE PROPERTY letterboxdVotes: std::int32; + CREATE PROPERTY metacriticId: std::str; + CREATE PROPERTY metacriticRating: std::float32; + CREATE PROPERTY metacriticVotes: std::int32; + CREATE PROPERTY mpaaRating: std::str; + CREATE PROPERTY netflixId: std::str; + CREATE PROPERTY originalTitle: std::str; + CREATE PROPERTY plot: std::str; + CREATE PROPERTY posterHeight: std::int32; + CREATE PROPERTY posterPlaceholderUrl: std::str; + CREATE PROPERTY posterUrl: std::str; + CREATE PROPERTY posterWidth: std::int32; + CREATE PROPERTY production: std::str; + CREATE PROPERTY redditTopicId: std::str; + CREATE PROPERTY releaseDate: std::datetime; + CREATE PROPERTY releaseYear: std::int32; + CREATE PROPERTY relevancyScore: std::float32 { + SET default := 0; + }; + CREATE PROPERTY revenue: std::str; + CREATE PROPERTY rtAudienceRating: std::int32; + CREATE PROPERTY rtAudienceVotes: std::int32; + CREATE PROPERTY rtCriticConsensur: std::str; + CREATE PROPERTY rtCriticRating: std::int32; + CREATE PROPERTY rtCriticVotes: std::int32; + CREATE PROPERTY rtId: std::str; + CREATE PROPERTY rtUrl: std::str; + CREATE PROPERTY runtime: std::int32; + CREATE PROPERTY searchL: std::str; + CREATE PROPERTY status: std::str; + CREATE REQUIRED PROPERTY title: std::str; + CREATE REQUIRED PROPERTY tmdbId: std::int32 { + CREATE CONSTRAINT std::exclusive; + }; + CREATE PROPERTY tmdbPopularity: std::float32; + CREATE PROPERTY tmdbRating: std::float32; + CREATE PROPERTY tmdbVotes: std::int32; + CREATE PROPERTY trailerUrl: std::str; + CREATE PROPERTY trailerYouTubeId: std::str; + CREATE PROPERTY traktTVId: std::str; + CREATE PROPERTY twitterId: std::str; + CREATE PROPERTY twitterUsername: std::str; + CREATE PROPERTY wikidataId: std::str; + }; +}; diff --git a/dbschema/migrations/00002.edgeql b/dbschema/migrations/00002.edgeql new file mode 100644 index 0000000..a27c706 --- /dev/null +++ b/dbschema/migrations/00002.edgeql @@ -0,0 +1,14 @@ +CREATE MIGRATION m1h2uy3grrskukidjamywfvqignduorhogqrhhb4ev3tljo5laemcq + ONTO m1droyjbi5m65eavuiuuwzxumd2zf26vnggq3s4wyf5ngxfl7lkuia +{ + ALTER TYPE default::Movie { + CREATE INDEX ON (.tmdbPopularity); + CREATE INDEX ON (.imdbId); + CREATE INDEX ON ((.imdbRating, .releaseYear, .foreign, .genres, .searchL, .relevancyScore)); + CREATE INDEX ON (.rtAudienceRating); + CREATE INDEX ON (.imdbVotes); + CREATE INDEX ON (.tmdbId); + CREATE INDEX ON (.rtCriticRating); + CREATE INDEX ON (.releaseDate); + }; +}; diff --git a/edgedb.toml b/edgedb.toml new file mode 100644 index 0000000..7b79d3e --- /dev/null +++ b/edgedb.toml @@ -0,0 +1,2 @@ +[edgedb] +server-version = "3.4" diff --git a/package.json b/package.json index 589f66e..974888b 100644 --- a/package.json +++ b/package.json @@ -28,6 +28,7 @@ "delay": "^6.0.0", "dequal": "^2.0.3", "dotenv-safe": "^8.2.0", + "edgedb": "^1.3.7", "global-agent": "^3.0.0", "got": "^12.6.1", "isobject": "^4.0.0", @@ -46,6 +47,7 @@ "wikibase-sdk": "^9.2.3" }, "devDependencies": { + "@edgedb/generate": "^0.3.4", "@trivago/prettier-plugin-sort-imports": "^4.2.0", "@types/lodash.omit": "^4.5.8", "@types/node": "^20.8.7", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a12a1ac..4ab144b 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -26,6 +26,9 @@ dependencies: dotenv-safe: specifier: ^8.2.0 version: 8.2.0 + edgedb: + specifier: ^1.3.7 + version: 1.3.7 global-agent: specifier: ^3.0.0 version: 3.0.0 @@ -76,6 +79,9 @@ dependencies: version: 9.2.3 devDependencies: + '@edgedb/generate': + specifier: ^0.3.4 + version: 0.3.4(edgedb@1.3.7) '@trivago/prettier-plugin-sort-imports': specifier: ^4.2.0 version: 4.2.0(prettier@2.8.8) @@ -227,6 +233,16 @@ packages: to-fast-properties: 2.0.0 dev: true + /@edgedb/generate@0.3.4(edgedb@1.3.7): + resolution: {integrity: sha512-XxoBRFfTdbxC5wN8Ug7WW7SnmtyO8eVBeufzQaF+OtQgK1amVTW6AzCYsSpiRKBLjQxOdboMW+QNgsgrkb16XQ==} + engines: {node: '>= 12.0.0'} + hasBin: true + peerDependencies: + edgedb: ^1.3.2 + dependencies: + edgedb: 1.3.7 + dev: true + /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -1177,6 +1193,11 @@ packages: resolution: {integrity: sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==} dev: true + /edgedb@1.3.7: + resolution: {integrity: sha512-YMJL80ggSBQIz1M9b/uHkvjk23ppTY4BC+nUslqd5eSHKqCaJBvqip8VJEoWS8etcrug81PLAbdUKHAAS8cALQ==} + engines: {node: '>= 12.0.0'} + hasBin: true + /emoji-regex@9.2.2: resolution: {integrity: sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==} dev: true diff --git a/src/lib/edgedb.ts b/src/lib/edgedb.ts new file mode 100644 index 0000000..4efc636 --- /dev/null +++ b/src/lib/edgedb.ts @@ -0,0 +1,9 @@ +import * as edgedb from 'edgedb' + +import schema from '../../dbschema/edgeql-js' + +const client = edgedb.createClient() + +export { client, schema } + +// await client.ensureConnected() diff --git a/src/types/index.ts b/src/types/index.ts index 28cf9ef..ed8ca67 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -13,11 +13,11 @@ export type { flickMetrix } export type { wikidata } export interface Movie { - // ids + // main external ids tmdbId: number imdbId: string - // external ids + // other external ids wikidataId?: string facebookId?: string instagramId?: string