use crate::models::text::RichText; use crate::models::users::User; use super::{DateTime, Number, Utc}; use crate::ids::{DatabaseId, PageId, PropertyId}; use chrono::NaiveDate; use serde::{Deserialize, Serialize}; pub mod formulas; #[cfg(test)] mod tests; /// How the number is displayed in Notion. #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Copy, Clone, Hash)] #[serde(rename_all = "snake_case")] pub enum NumberFormat { Number, NumberWithCommas, Percent, Dollar, Euro, Pound, Yen, Ruble, Rupee, Won, Yuan, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Hash, Clone)] pub struct NumberDetails { pub format: NumberFormat, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Clone)] #[serde(transparent)] pub struct SelectOptionId(String); #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Copy, Clone)] #[serde(rename_all = "lowercase")] pub enum Color { Default, Gray, Brown, Orange, Yellow, Green, Blue, Purple, Pink, Red, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct SelectOption { pub name: String, pub id: SelectOptionId, pub color: Color, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct Select { /// Sorted list of options available for this property. pub options: Vec, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct Formula { /// Formula to evaluate for this property pub expression: String, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct Relation { /// The database this relation refers to. /// New linked pages must belong to this database in order to be valid. pub database_id: DatabaseId, /// By default, relations are formed as two synced properties across databases: /// if you make a change to one property, it updates the synced property at the same time. /// `synced_property_name` refers to the name of the property in the related database. pub synced_property_name: Option, /// By default, relations are formed as two synced properties across databases: /// if you make a change to one property, it updates the synced property at the same time. /// `synced_property_id` refers to the id of the property in the related database. /// This is usually a short string of random letters and symbols. pub synced_property_id: Option, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Copy, Clone)] #[serde(rename_all = "snake_case")] pub enum RollupFunction { CountAll, CountValues, CountUniqueValues, CountEmpty, CountNotEmpty, PercentEmpty, PercentNotEmpty, Sum, Average, Median, Min, Max, Range, ShowOriginal, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct Rollup { /// The name of the relation property this property is responsible for rolling up. pub relation_property_name: String, /// The id of the relation property this property is responsible for rolling up. pub relation_property_id: PropertyId, /// The name of the property of the pages in the related database /// that is used as an input to `function`. pub rollup_property_name: String, /// The id of the property of the pages in the related database /// that is used as an input to `function`. pub rollup_property_id: String, /// The function that is evaluated for every page in the relation of the rollup. pub function: RollupFunction, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] pub enum PropertyConfiguration { /// Represents the special Title property required on every database. /// See Title { id: PropertyId }, /// Represents a Text property /// #[serde(rename = "rich_text")] Text { id: PropertyId }, /// Represents a Number Property /// See Number { id: PropertyId, /// How the number is displayed in Notion. number: NumberDetails, }, /// Represents a Select Property /// See Select { id: PropertyId, select: Select }, /// Represents a Multi-select Property /// See MultiSelect { id: PropertyId, multi_select: Select, }, /// Represents a Date Property /// See Date { id: PropertyId }, /// Represents a People Property /// See People { id: PropertyId }, /// Represents a File Property /// See // Todo: File a bug with notion // Documentation issue: docs claim type name is `file` but it is in fact `files` Files { id: PropertyId }, /// Represents a Checkbox Property /// See Checkbox { id: PropertyId }, /// Represents a URL Property /// See Url { id: PropertyId }, /// Represents a Email Property /// See Email { id: PropertyId }, /// Represents a Phone number Property /// See PhoneNumber { id: PropertyId }, /// See Formula { id: PropertyId, formula: Formula }, /// See Relation { id: PropertyId, relation: Relation }, /// See Rollup { id: PropertyId, rollup: Rollup }, /// See CreatedTime { id: PropertyId }, /// See CreatedBy { id: PropertyId }, /// See LastEditedTime { id: PropertyId }, /// See LastEditBy { id: PropertyId }, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct SelectedValue { pub id: SelectOptionId, pub name: String, pub color: Color, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(untagged)] pub enum DateOrDateTime { Date(NaiveDate), DateTime(DateTime), } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct DateValue { pub start: DateOrDateTime, pub end: Option, pub time_zone: Option } /// Formula property value objects represent the result of evaluating a formula /// described in the database's properties. #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] pub enum FormulaResultValue { String { string: Option }, Number { number: Option }, Boolean { boolean: Option }, Date { date: Option }, } /// Relation property value objects contain an array of page references within the relation property. /// A page reference is an object with an id property, /// with a string value (UUIDv4) corresponding to a page ID in another database. #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct RelationValue { pub id: PageId, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type", rename_all = "snake_case")] pub enum RollupValue { Number { number: Option }, Date { date: Option> }, Array { array: Vec }, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] pub struct FileReference { pub name: String, pub url: String, pub mime_type: String, } #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] pub enum PropertyValue { // Title { id: PropertyId, title: Vec, }, /// #[serde(rename = "rich_text")] Text { id: PropertyId, rich_text: Vec, }, /// Number { id: PropertyId, number: Option, }, /// Select { id: PropertyId, select: Option, }, MultiSelect { id: PropertyId, multi_select: Option>, }, Date { id: PropertyId, date: Option, }, /// Formula { id: PropertyId, formula: FormulaResultValue, }, /// /// It is actually an array of relations Relation { id: PropertyId, relation: Option>, }, /// Rollup { id: PropertyId, rollup: Option, }, People { id: PropertyId, people: Vec, }, Files { id: PropertyId, files: Option>, }, Checkbox { id: PropertyId, checkbox: bool, }, Url { id: PropertyId, url: Option, }, Email { id: PropertyId, email: Option, }, PhoneNumber { id: PropertyId, phone_number: String, }, CreatedTime { id: PropertyId, created_time: DateTime, }, CreatedBy { id: PropertyId, created_by: User, }, LastEditedTime { id: PropertyId, last_edited_time: DateTime, }, LastEditedBy { id: PropertyId, last_edited_by: User, }, } /// #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] #[serde(tag = "type")] #[serde(rename_all = "snake_case")] pub enum RollupPropertyValue { /// #[serde(rename = "rich_text")] Text { rich_text: Vec, }, /// Number { number: Option, }, /// Select { select: Option, }, MultiSelect { multi_select: Option>, }, Date { date: Option, }, /// Formula { formula: FormulaResultValue, }, /// /// It is actually an array of relations Relation { relation: Option>, }, /// Rollup { rollup: Option, }, People { people: Vec, }, Files { files: Option>, }, Checkbox { checkbox: bool, }, Url { url: Option, }, Email { email: Option, }, PhoneNumber { phone_number: String, }, CreatedTime { created_time: DateTime, }, CreatedBy { created_by: User, }, LastEditedTime { last_edited_time: DateTime, }, LastEditedBy { last_edited_by: User, }, } oM/types/expose-Bun-Env'>xHyroM/types/expose-Bun-Env Unnamed repository; edit this file 'description' to name the repository.
aboutsummaryrefslogtreecommitdiff
AgeCommit message (Expand)AuthorFilesLines
2021-12-16Update Makefilebun-v0.0.54Gravatar Jarred Sumner 1-0/+1
2021-12-16Bump again I guessGravatar Jarred Sumner 1-1/+1
2021-12-16:camera:bun-v0.0.53Gravatar Jarred Sumner 27-125/+132
2021-12-16Print errors below warningsGravatar Jarred Sumner 1-4/+31
2021-12-16[bun bun] Fix a race condition introduced in #55ff681976f7bae5a428c409061991c...Gravatar Jarred Sumner 2-4/+9
2021-12-16Update js_printer.zigGravatar Jarred Sumner 1-1/+8
2021-12-16[http] Fix bug with `Link` headerGravatar Jarred Sumner 1-1/+5
2021-12-16Update js_printer.zigGravatar Jarred Sumner 1-1/+1
2021-12-16:camera:Gravatar Jarred Sumner 30-129/+226
2021-12-16bump build idGravatar Jarred Sumner 1-1/+1
2021-12-16[macros] Do not automatically load node_modules.bun in macrosGravatar Jarred Sumner 1-11/+11
2021-12-16[macros] Slightly improve error message if macros fail to loadGravatar Jarred Sumner 1-2/+7
2021-12-16[bundler][JS transpiler] Improve reliability of ESM <> CommonJS interopGravatar Jarred Sumner 6-242/+165
2021-12-16[http] Ensure errors from macros can see source codeGravatar Jarred Sumner 1-1/+19
2021-12-16[internal] disable debug workaroundGravatar Jarred Sumner 1-1/+1
2021-12-16[bundler] Fix edgecase where certain modules would load unbundled versionsGravatar Jarred Sumner 2-2/+17
2021-12-16[resolver] Change extension order based on import kindGravatar Jarred Sumner 1-1/+6
2021-12-16[resolver] When importing from an ES Module, prefer `.{m,c}{t,j}s`Gravatar Jarred Sumner 1-2/+28
2021-12-15wip fix live bindingsGravatar Jarred Sumner 6-418/+359
2021-12-15[JS transpiler] Simplify CommonJS interop callbackGravatar Jarred Sumner 2-67/+65
2021-12-15[JS transpiler] Ensure reserved words don't end up in nonUniqueIdentifier()Gravatar Jarred Sumner 2-0/+18
2021-12-15[JS Parser] Add regression testGravatar Jarred Sumner 1-0/+14
2021-12-15[JS Parser] Fix bug with template literals that create new scopes in the tag ...Gravatar Jarred Sumner 1-4/+4
2021-12-11Add a resource hint for preloading node_modules.bun and route asset in the fa...Gravatar Jarred Sumner 1-1/+43
2021-12-04[resolver] Do not throw on require()/import errors when they're caught (and i...Gravatar Jarred Sumner 2-53/+62
2021-11-26Bumpbun-v0.0.52Gravatar Jarred Sumner 1-1/+1
2021-11-25Fix occasional segfault when parsing JSON in http serverGravatar Jarred Sumner 1-2/+2
2021-11-25Revert "Merge pull request #70 from Jarred-Sumner/lithdew/picohttp-mimalloc"Gravatar Jarred Sumner 2-153/+132
2021-11-24mimalloc: patch malloc/freelithdew/picohttp-mimallocGravatar Kenta Iwasaki 2-7/+35
2021-11-24deps: add missing mimalloc dep to jsc bindings header generatorGravatar Kenta Iwasaki 2-2/+3
2021-11-24deps: build picohttp and mimalloc using zigGravatar Kenta Iwasaki 2-131/+123
2021-11-23update Next version on globalGravatar Jack Hanford 1-1/+1
2021-11-23Update build-idGravatar Jarred Sumner 1-1/+1
2021-11-23fix shallow routingGravatar Jack Hanford 1-4/+6
2021-11-23remove commentGravatar Jack Hanford 1-1/+0
2021-11-23add react-dom as devDepGravatar Jack Hanford 1-0/+1
2021-11-23stop installing textencoderGravatar Jack Hanford 3-2/+308
2021-11-23begin addressing more feedbackGravatar Jack Hanford 1-3/+3
2021-11-22remove .thenGravatar Jack Hanford 1-12/+3
2021-11-22another tryGravatar Jack Hanford 2-5/+1
2021-11-22add type fnsGravatar Jack Hanford 1-1/+4