@aglyn/shared-data-types 1.0.0-beta.221 → 1.0.0-beta.222

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aglyn/shared-data-types",
3
- "version": "1.0.0-beta.221",
3
+ "version": "1.0.0-beta.222",
4
4
  "license": "Apache-2.0",
5
5
  "homepage": "https://aglyn.com",
6
6
  "repository": {
package/src/lib/dod.js CHANGED
@@ -16,7 +16,7 @@
16
16
  */ /*
17
17
  * NOTE (AGL-177): this file is the 2023-era type-level design doc. The
18
18
  * RUNTIME source of truth for dataset models now lives in
19
- * `libs/aglyn/src/lib/app-utils/dataset-models.ts` — extend that module,
19
+ * `libs/plugins/data/src/lib/model/dataset-models.ts` — extend that module,
20
20
  * not this one.
21
21
  */ /**
22
22
  * (D)Document-(o)oriented (D)Database (DoD)
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../../libs/shared/data/types/src/lib/dod.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * NOTE (AGL-177): this file is the 2023-era type-level design doc. The\n * RUNTIME source of truth for dataset models now lives in\n * `libs/aglyn/src/lib/app-utils/dataset-models.ts` — extend that module,\n * not this one.\n */\n\n/**\n * (D)Document-(o)oriented (D)Database (DoD)\n *\n * A document-oriented database, or DoD, or document\n * store, is a data storage structure designed for\n * storing, retrieving and managing document-oriented\n * information, also known as semi-structured data.\n *\n * Each document contains a set of key-value pairs.\n * All documents must be stored in collections.\n *\n * Documents can contain literal fields such as\n * text/strings, numbers, or booleans, and secondly\n * nestable fields such as arrays or mapped objects.\n *\n * The special sauce here which deviates from a\n * traditional DoD is the overlaid design patterns\n * which provide the outlines for capabilities such\n * as relational- and model-driven\n *\n * @module dod\n */\n\n/** Primary key */\nexport type PKey = string\n/** Foreign key */\nexport type FKey = string\n/** Alternate key */\nexport type AKey = string\n\n/** Tuple with exactly two nodes */\nexport interface TupleLn2<T1, T2 = T1> extends Array<T1 | T2> {\n 0: T1\n 1: T2\n length: 2 // using the numeric literal type '2'\n}\n\n/** Tuple with a minimum of one nodes */\ninterface TupleMinLn1<T> extends Array<T> {\n 0: T\n}\n\n/** Tuple with a minimum of two nodes */\ninterface TupleMinLn2<T1, T2 = T1> extends TupleMinLn1<T1 | T2> {\n 0: T1\n 1: T2\n}\n\n/**\n * Nominal Type hack to declare a typeof type for\n * a unique symbol. This is because `unique symbol`\n * can only be typed from a const.\n *\n * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol\n */\ndeclare const NominalSymbol: unique symbol\nexport type UniqSym = typeof NominalSymbol\n\n/**\n * Describes relationship design patterns to\n * outline a RDBMS equivalent\n */\nexport namespace Relation {\n /**\n * A associative lookup for unnatural/extrinsic\n * Many-to-Many relationship.\n *\n * Note: intrinsic 2-way relations should live within\n * both documents and not use an extra query/join for\n * the lookup! However, a rare scenario that it is too\n * large, you may store the most recent (n) items in\n * the two documents and use the lookup for the rest.\n *\n * Consider the following 2-way relationship:\n * group1 = [user1, user3]\n * group2 = [user1, user2]\n * group3 = [user2, user3]\n * user1 = [group1, group2]\n * user2 = [group2, group3]\n * user3 = [group1, group3]\n *\n * That would be displayed in an associative as follows:\n * AK1 = [group1, user1]\n * AK2 = [group1, user3]\n * AK3 = [group2, user1]\n * AK4 = [group2, user2]\n * AK5 = [group3, user2]\n * AK6 = [group3, user3]\n */\n export type Associative = TupleLn2<FKey>\n\n /**\n * Similar to an associative relation but rather to\n * find many associations\n *\n * e.g. Invoice, Product, User lookups\n * AK1 = [invoiceId, productId, userId]\n */\n export type Lookup = TupleMinLn2<FKey>\n}\n\n/** Field Type */\nexport namespace FT {\n export type Bool = boolean\n export type Bytes = Uint8Array | string\n export type Timestamp = number\n export type Float = number\n export type Int32 = number\n export type Int64 = number\n export type Null = null\n export type Text = string\n export type Coordinates = Record<'longitude' | 'latitude', number>\n export type Map = Dictionary\n export type Sorted<T = any> = T extends any[] ? never : T[]\n\n export type Nestable = Map | Sorted<any>\n\n export type Any<T = any> =\n | Sorted<T>\n | Bool\n | Bytes\n | Timestamp\n | Float\n | Coordinates\n | Int32\n | Int64\n | Map\n | Null\n | Text\n\n export namespace Tag {\n export const bool = 'bool'\n export const bytes = 'bytes'\n export const timestamp = 'timestamp'\n export const float = 'float'\n export const int32 = 'int32'\n export const int64 = 'int64'\n export const nil = 'nil'\n export const text = 'text'\n export const coordinates = 'coordinates'\n export const map = 'map'\n export const sorted = 'sorted'\n\n export const all = [\n Tag.bool,\n Tag.bytes,\n Tag.timestamp,\n Tag.float,\n Tag.int32,\n Tag.int64,\n Tag.nil,\n Tag.text,\n Tag.coordinates,\n Tag.map,\n Tag.sorted,\n ]\n\n export type T =\n | typeof Tag.bool\n | typeof Tag.bytes\n | typeof Tag.timestamp\n | typeof Tag.float\n | typeof Tag.int32\n | typeof Tag.int64\n | typeof Tag.nil\n | typeof Tag.text\n | typeof Tag.coordinates\n | typeof Tag.map\n | typeof Tag.sorted\n }\n\n /** Match Type from Tag symbol */\n export type TypeFromTag<Kind extends Tag.T> = Kind extends typeof Tag.bool\n ? Bool\n : Kind extends typeof Tag.bytes\n ? Uint8Array\n : Kind extends typeof Tag.timestamp\n ? Timestamp\n : Kind extends typeof Tag.float\n ? Float\n : Kind extends typeof Tag.int32\n ? Int32\n : Kind extends typeof Tag.int64\n ? Int64\n : Kind extends typeof Tag.nil\n ? Null\n : Kind extends typeof Tag.text\n ? Text\n : Kind extends typeof Tag.coordinates\n ? Coordinates\n : Kind extends typeof Tag.map\n ? Map\n : Kind extends typeof Tag.sorted\n ? Sorted<any>\n : never\n}\n\n/** Field */\nexport type FieldValueType<T = any> = FT.Any<T>\n/** Document */\nexport type DocumentType<F extends FieldValueType = any> = {\n [fieldId: string]: F\n}\n/** Collection */\nexport type CollectionType = {[documentId: string]: DocumentType}\n/** Database */\nexport type DatabaseType = {[collectionId: string]: CollectionType}\n/** Cluster */\nexport type ClusterType = {[databaseId: string]: DatabaseType}\n\n/**\n * Outlines schemas for entity types (e.g., field, doc, collection)\n */\nexport namespace Schema {\n /**\n * Name fields\n */\n export type Name = {\n singular?: FT.Text\n plural?: FT.Text\n }\n\n /**\n * Interface properties for a timestamp lifecycle\n *\n * @export\n * @interface StampedLifecycle\n */\n export type StampedLifecycle = Partial<Record<StampedKeys, FT.Timestamp>>\n export type StampedKeys = 'created' | 'updated' | 'delete'\n\n /** Just a boxed name field */\n export interface NamedField {\n name: Name\n }\n\n /**\n * Describes the meta object for a field instance\n */\n export interface FieldDefinition extends NamedField {\n type: FT.Tag.T\n description?: FT.Text\n }\n\n /**\n * Outlines the fields to be designated for a new\n * document instance within the parent collection\n */\n export type ModelFields = {\n [fieldId: string]: FieldDefinition\n }\n\n /**\n * Describes a collection of documents, the fields\n * property describes the fields of any document an\n * instance of the collection.\n */\n export interface CollectionModel\n extends DocumentType,\n StampedLifecycle,\n NamedField {\n fields: ModelFields\n }\n\n /**\n * Describes a collection of documents, each document\n * only describes another collection e.g. the meta\n */\n export type CollectionModels = CollectionType & {\n [collectionIdAsDocumentId: string]: CollectionModel\n }\n\n /**\n * =======================================================\n */\n\n /**\n * The actual collection instance of a collection meta\n */\n export type CollectionInstance<T extends CollectionModel> = CollectionType & {\n [documentId: string]: DocumentType<\n FT.TypeFromTag<T['fields'][string]['type']>\n >\n }\n\n /**\n * Just simply a database of collections\n */\n export type DatabaseCollections<C extends CollectionModels> = DatabaseType & {\n [CID in keyof C]: CollectionInstance<C[CID]>\n }\n}\n\nexport namespace Ref {\n export interface Base<S = any> {\n id: PKey\n schema: S\n }\n\n /**\n * =======================================================\n */\n export type Field<S extends Schema.FieldDefinition> = FT.TypeFromTag<\n S['type']\n >\n\n /**\n * =======================================================\n */\n export type DocumentFields<S extends Schema.ModelFields> = {\n [K in keyof S]: Field<S[K]>\n }\n export type Document<S extends Schema.ModelFields> = DocumentFields<S>\n\n /**\n * =======================================================\n */\n export type CollectionDocuments<S extends Schema.CollectionModel> = {\n [documentId: string]: Document<S['fields']>\n }\n export type Collection<S extends Schema.CollectionModel> =\n CollectionDocuments<S>\n\n /**\n * =======================================================\n */\n // export type DatabaseCollections<S extends Schema.CollectionModels> = {\n // [K in keyof S]: Collection<S[K]>\n // }\n export interface Database {\n schemas: Schema.CollectionModels\n instances: Schema.DatabaseCollections<this['schemas']>\n }\n}\n\n/**\n * Evaluation kinds\n */\nexport enum Eval {\n Required = 'r6d',\n Regex = 'r3x',\n}\n\n/**\n * Property name index signatures\n */\nexport const Sig = {\n Field: 'field',\n Fields: 'fields',\n Document: 'document',\n Documents: 'documents',\n Collection: 'collection',\n Collections: 'collections',\n Subcollection: 'subcollection',\n Subcollections: 'subcollections',\n\n Model: 'model',\n Models: 'models',\n Blueprint: 'blueprint',\n Blueprints: 'blueprints',\n Entry: 'entry',\n Entries: 'entries',\n\n Id: 'id',\n Name: 'name',\n Kind: 'kind',\n Type: 'type',\n Value: 'value',\n\n Created: 'created',\n Updated: 'updated',\n Deleted: 'deleted',\n}\n\n/**\n * Friendly-text/display-names of local names or\n *\n * TODO: i18n\n */\nexport const lbl = {\n /** Field Data Types */\n [FT.Tag.bool]: 'True/False',\n [FT.Tag.bytes]: 'Bytes',\n [FT.Tag.timestamp]: 'Date/Time',\n [FT.Tag.float]: 'Decimal',\n [FT.Tag.int32]: 'Number',\n [FT.Tag.int64]: 'Large Number',\n [FT.Tag.nil]: 'Null',\n [FT.Tag.text]: 'Text',\n [FT.Tag.coordinates]: 'Coordinates (lat/lon)',\n [FT.Tag.map]: 'Map',\n [FT.Tag.sorted]: 'Sorted',\n\n /** Entity type fields */\n [Sig.Field]: 'Field',\n [Sig.Fields]: 'Fields',\n [Sig.Document]: 'Document',\n [Sig.Documents]: 'Documents',\n [Sig.Collection]: 'Collection',\n [Sig.Collections]: 'Collections',\n [Sig.Subcollection]: 'Subcollection',\n [Sig.Subcollections]: 'Subcollections',\n\n /** Instance fields */\n [Sig.Blueprint]: 'Blueprint',\n [Sig.Blueprints]: 'Blueprints',\n [Sig.Model]: 'Model',\n [Sig.Models]: 'Models',\n [Sig.Entry]: 'Entry',\n [Sig.Entries]: 'Entries',\n\n /** Meta fields */\n [Sig.Id]: 'Unique ID',\n [Sig.Name]: 'Display Name',\n [Sig.Kind]: 'Kind',\n [Sig.Type]: 'Type',\n [Sig.Value]: 'Value',\n\n /** Timestamp fields */\n [Sig.Created]: 'Created At',\n [Sig.Updated]: 'Updated At',\n [Sig.Deleted]: 'Deleted At',\n}\n\n/** Contextual persistence types */\nexport enum Persistance {\n NONE = 'NONE',\n SESSION = 'SESSION',\n LOCAL = 'LOCAL',\n}\n"],"names":["FT","Tag","bool","bytes","timestamp","float","int32","int64","nil","text","coordinates","map","sorted","all","Eval","Sig","Field","Fields","Document","Documents","Collection","Collections","Subcollection","Subcollections","Model","Models","Blueprint","Blueprints","Entry","Entries","Id","Name","Kind","Type","Value","Created","Updated","Deleted","lbl","Persistance"],"mappings":"AAAA;;;;;;;;;;;;;;;CAeC,GAED;;;;;CAKC,GAED;;;;;;;;;;;;;;;;;;;;;CAqBC,GAED,gBAAgB,aA+ECA;cA4BEC;YACFC,OAAO;YACPC,QAAQ;YACRC,YAAY;YACZC,QAAQ;YACRC,QAAQ;YACRC,QAAQ;YACRC,MAAM;YACNC,OAAO;YACPC,cAAc;YACdC,MAAM;YACNC,SAAS;YAETC,MAAM;YACjBZ,GAAAA,IAAIC,IAAI;YACRD,GAAAA,IAAIE,KAAK;YACTF,GAAAA,IAAIG,SAAS;YACbH,GAAAA,IAAII,KAAK;Y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B,GACvB,CAACG,IAAIC,KAAK,CAAC,EAAE;IACb,CAACD,IAAIE,MAAM,CAAC,EAAE;IACd,CAACF,IAAIG,QAAQ,CAAC,EAAE;IAChB,CAACH,IAAII,SAAS,CAAC,EAAE;IACjB,CAACJ,IAAIK,UAAU,CAAC,EAAE;IAClB,CAACL,IAAIM,WAAW,CAAC,EAAE;IACnB,CAACN,IAAIO,aAAa,CAAC,EAAE;IACrB,CAACP,IAAIQ,cAAc,CAAC,EAAE;IAEtB,oBAAoB,GACpB,CAACR,IAAIW,SAAS,CAAC,EAAE;IACjB,CAACX,IAAIY,UAAU,CAAC,EAAE;IAClB,CAACZ,IAAIS,KAAK,CAAC,EAAE;IACb,CAACT,IAAIU,MAAM,CAAC,EAAE;IACd,CAACV,IAAIa,KAAK,CAAC,EAAE;IACb,CAACb,IAAIc,OAAO,CAAC,EAAE;IAEf,gBAAgB,GAChB,CAACd,IAAIe,EAAE,CAAC,EAAE;IACV,CAACf,IAAIgB,IAAI,CAAC,EAAE;IACZ,CAAChB,IAAIiB,IAAI,CAAC,EAAE;IACZ,CAACjB,IAAIkB,IAAI,CAAC,EAAE;IACZ,CAAClB,IAAImB,KAAK,CAAC,EAAE;IAEb,qBAAqB,GACrB,CAACnB,IAAIoB,OAAO,CAAC,EAAE;IACf,CAACpB,IAAIqB,OAAO,CAAC,EAAE;IACf,CAACrB,IAAIsB,OAAO,CAAC,EAAE;AACjB,EAAC;AAED,iCAAiC,GACjC,OAAO,IAAA,AAAKE,qCAAAA;;;;WAAAA;MAIX"}
1
+ {"version":3,"sources":["../../../../../../../libs/shared/data/types/src/lib/dod.ts"],"sourcesContent":["/**\n * @license\n * Copyright 2023 Aglyn LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/*\n * NOTE (AGL-177): this file is the 2023-era type-level design doc. The\n * RUNTIME source of truth for dataset models now lives in\n * `libs/plugins/data/src/lib/model/dataset-models.ts` — extend that module,\n * not this one.\n */\n\n/**\n * (D)Document-(o)oriented (D)Database (DoD)\n *\n * A document-oriented database, or DoD, or document\n * store, is a data storage structure designed for\n * storing, retrieving and managing document-oriented\n * information, also known as semi-structured data.\n *\n * Each document contains a set of key-value pairs.\n * All documents must be stored in collections.\n *\n * Documents can contain literal fields such as\n * text/strings, numbers, or booleans, and secondly\n * nestable fields such as arrays or mapped objects.\n *\n * The special sauce here which deviates from a\n * traditional DoD is the overlaid design patterns\n * which provide the outlines for capabilities such\n * as relational- and model-driven\n *\n * @module dod\n */\n\n/** Primary key */\nexport type PKey = string\n/** Foreign key */\nexport type FKey = string\n/** Alternate key */\nexport type AKey = string\n\n/** Tuple with exactly two nodes */\nexport interface TupleLn2<T1, T2 = T1> extends Array<T1 | T2> {\n 0: T1\n 1: T2\n length: 2 // using the numeric literal type '2'\n}\n\n/** Tuple with a minimum of one nodes */\ninterface TupleMinLn1<T> extends Array<T> {\n 0: T\n}\n\n/** Tuple with a minimum of two nodes */\ninterface TupleMinLn2<T1, T2 = T1> extends TupleMinLn1<T1 | T2> {\n 0: T1\n 1: T2\n}\n\n/**\n * Nominal Type hack to declare a typeof type for\n * a unique symbol. This is because `unique symbol`\n * can only be typed from a const.\n *\n * @see https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-7.html#unique-symbol\n */\ndeclare const NominalSymbol: unique symbol\nexport type UniqSym = typeof NominalSymbol\n\n/**\n * Describes relationship design patterns to\n * outline a RDBMS equivalent\n */\nexport namespace Relation {\n /**\n * A associative lookup for unnatural/extrinsic\n * Many-to-Many relationship.\n *\n * Note: intrinsic 2-way relations should live within\n * both documents and not use an extra query/join for\n * the lookup! However, a rare scenario that it is too\n * large, you may store the most recent (n) items in\n * the two documents and use the lookup for the rest.\n *\n * Consider the following 2-way relationship:\n * group1 = [user1, user3]\n * group2 = [user1, user2]\n * group3 = [user2, user3]\n * user1 = [group1, group2]\n * user2 = [group2, group3]\n * user3 = [group1, group3]\n *\n * That would be displayed in an associative as follows:\n * AK1 = [group1, user1]\n * AK2 = [group1, user3]\n * AK3 = [group2, user1]\n * AK4 = [group2, user2]\n * AK5 = [group3, user2]\n * AK6 = [group3, user3]\n */\n export type Associative = TupleLn2<FKey>\n\n /**\n * Similar to an associative relation but rather to\n * find many associations\n *\n * e.g. Invoice, Product, User lookups\n * AK1 = [invoiceId, productId, userId]\n */\n export type Lookup = TupleMinLn2<FKey>\n}\n\n/** Field Type */\nexport namespace FT {\n export type Bool = boolean\n export type Bytes = Uint8Array | string\n export type Timestamp = number\n export type Float = number\n export type Int32 = number\n export type Int64 = number\n export type Null = null\n export type Text = string\n export type Coordinates = Record<'longitude' | 'latitude', number>\n export type Map = Dictionary\n export type Sorted<T = any> = T extends any[] ? never : T[]\n\n export type Nestable = Map | Sorted<any>\n\n export type Any<T = any> =\n | Sorted<T>\n | Bool\n | Bytes\n | Timestamp\n | Float\n | Coordinates\n | Int32\n | Int64\n | Map\n | Null\n | Text\n\n export namespace Tag {\n export const bool = 'bool'\n export const bytes = 'bytes'\n export const timestamp = 'timestamp'\n export const float = 'float'\n export const int32 = 'int32'\n export const int64 = 'int64'\n export const nil = 'nil'\n export const text = 'text'\n export const coordinates = 'coordinates'\n export const map = 'map'\n export const sorted = 'sorted'\n\n export const all = [\n Tag.bool,\n Tag.bytes,\n Tag.timestamp,\n Tag.float,\n Tag.int32,\n Tag.int64,\n Tag.nil,\n Tag.text,\n Tag.coordinates,\n Tag.map,\n Tag.sorted,\n ]\n\n export type T =\n | typeof Tag.bool\n | typeof Tag.bytes\n | typeof Tag.timestamp\n | typeof Tag.float\n | typeof Tag.int32\n | typeof Tag.int64\n | typeof Tag.nil\n | typeof Tag.text\n | typeof Tag.coordinates\n | typeof Tag.map\n | typeof Tag.sorted\n }\n\n /** Match Type from Tag symbol */\n export type TypeFromTag<Kind extends Tag.T> = Kind extends typeof Tag.bool\n ? Bool\n : Kind extends typeof Tag.bytes\n ? Uint8Array\n : Kind extends typeof Tag.timestamp\n ? Timestamp\n : Kind extends typeof Tag.float\n ? Float\n : Kind extends typeof Tag.int32\n ? Int32\n : Kind extends typeof Tag.int64\n ? Int64\n : Kind extends typeof Tag.nil\n ? Null\n : Kind extends typeof Tag.text\n ? Text\n : Kind extends typeof Tag.coordinates\n ? Coordinates\n : Kind extends typeof Tag.map\n ? Map\n : Kind extends typeof Tag.sorted\n ? Sorted<any>\n : never\n}\n\n/** Field */\nexport type FieldValueType<T = any> = FT.Any<T>\n/** Document */\nexport type DocumentType<F extends FieldValueType = any> = {\n [fieldId: string]: F\n}\n/** Collection */\nexport type CollectionType = {[documentId: string]: DocumentType}\n/** Database */\nexport type DatabaseType = {[collectionId: string]: CollectionType}\n/** Cluster */\nexport type ClusterType = {[databaseId: string]: DatabaseType}\n\n/**\n * Outlines schemas for entity types (e.g., field, doc, collection)\n */\nexport namespace Schema {\n /**\n * Name fields\n */\n export type Name = {\n singular?: FT.Text\n plural?: FT.Text\n }\n\n /**\n * Interface properties for a timestamp lifecycle\n *\n * @export\n * @interface StampedLifecycle\n */\n export type StampedLifecycle = Partial<Record<StampedKeys, FT.Timestamp>>\n export type StampedKeys = 'created' | 'updated' | 'delete'\n\n /** Just a boxed name field */\n export interface NamedField {\n name: Name\n }\n\n /**\n * Describes the meta object for a field instance\n */\n export interface FieldDefinition extends NamedField {\n type: FT.Tag.T\n description?: FT.Text\n }\n\n /**\n * Outlines the fields to be designated for a new\n * document instance within the parent collection\n */\n export type ModelFields = {\n [fieldId: string]: FieldDefinition\n }\n\n /**\n * Describes a collection of documents, the fields\n * property describes the fields of any document an\n * instance of the collection.\n */\n export interface CollectionModel\n extends DocumentType,\n StampedLifecycle,\n NamedField {\n fields: ModelFields\n }\n\n /**\n * Describes a collection of documents, each document\n * only describes another collection e.g. the meta\n */\n export type CollectionModels = CollectionType & {\n [collectionIdAsDocumentId: string]: CollectionModel\n }\n\n /**\n * =======================================================\n */\n\n /**\n * The actual collection instance of a collection meta\n */\n export type CollectionInstance<T extends CollectionModel> = CollectionType & {\n [documentId: string]: DocumentType<\n FT.TypeFromTag<T['fields'][string]['type']>\n >\n }\n\n /**\n * Just simply a database of collections\n */\n export type DatabaseCollections<C extends CollectionModels> = DatabaseType & {\n [CID in keyof C]: CollectionInstance<C[CID]>\n }\n}\n\nexport namespace Ref {\n export interface Base<S = any> {\n id: PKey\n schema: S\n }\n\n /**\n * =======================================================\n */\n export type Field<S extends Schema.FieldDefinition> = FT.TypeFromTag<\n S['type']\n >\n\n /**\n * =======================================================\n */\n export type DocumentFields<S extends Schema.ModelFields> = {\n [K in keyof S]: Field<S[K]>\n }\n export type Document<S extends Schema.ModelFields> = DocumentFields<S>\n\n /**\n * =======================================================\n */\n export type CollectionDocuments<S extends Schema.CollectionModel> = {\n [documentId: string]: Document<S['fields']>\n }\n export type Collection<S extends Schema.CollectionModel> =\n CollectionDocuments<S>\n\n /**\n * =======================================================\n */\n // export type DatabaseCollections<S extends Schema.CollectionModels> = {\n // [K in keyof S]: Collection<S[K]>\n // }\n export interface Database {\n schemas: Schema.CollectionModels\n instances: Schema.DatabaseCollections<this['schemas']>\n }\n}\n\n/**\n * Evaluation kinds\n */\nexport enum Eval {\n Required = 'r6d',\n Regex = 'r3x',\n}\n\n/**\n * Property name index signatures\n */\nexport const Sig = {\n Field: 'field',\n Fields: 'fields',\n Document: 'document',\n Documents: 'documents',\n Collection: 'collection',\n Collections: 'collections',\n Subcollection: 'subcollection',\n Subcollections: 'subcollections',\n\n Model: 'model',\n Models: 'models',\n Blueprint: 'blueprint',\n Blueprints: 'blueprints',\n Entry: 'entry',\n Entries: 'entries',\n\n Id: 'id',\n Name: 'name',\n Kind: 'kind',\n Type: 'type',\n Value: 'value',\n\n Created: 'created',\n Updated: 'updated',\n Deleted: 'deleted',\n}\n\n/**\n * Friendly-text/display-names of local names or\n *\n * TODO: i18n\n */\nexport const lbl = {\n /** Field Data Types */\n [FT.Tag.bool]: 'True/False',\n [FT.Tag.bytes]: 'Bytes',\n [FT.Tag.timestamp]: 'Date/Time',\n [FT.Tag.float]: 'Decimal',\n [FT.Tag.int32]: 'Number',\n [FT.Tag.int64]: 'Large Number',\n [FT.Tag.nil]: 'Null',\n [FT.Tag.text]: 'Text',\n [FT.Tag.coordinates]: 'Coordinates (lat/lon)',\n [FT.Tag.map]: 'Map',\n [FT.Tag.sorted]: 'Sorted',\n\n /** Entity type fields */\n [Sig.Field]: 'Field',\n [Sig.Fields]: 'Fields',\n [Sig.Document]: 'Document',\n [Sig.Documents]: 'Documents',\n [Sig.Collection]: 'Collection',\n [Sig.Collections]: 'Collections',\n [Sig.Subcollection]: 'Subcollection',\n [Sig.Subcollections]: 'Subcollections',\n\n /** Instance fields */\n [Sig.Blueprint]: 'Blueprint',\n [Sig.Blueprints]: 'Blueprints',\n [Sig.Model]: 'Model',\n [Sig.Models]: 'Models',\n [Sig.Entry]: 'Entry',\n [Sig.Entries]: 'Entries',\n\n /** Meta fields */\n [Sig.Id]: 'Unique ID',\n [Sig.Name]: 'Display Name',\n [Sig.Kind]: 'Kind',\n [Sig.Type]: 'Type',\n [Sig.Value]: 'Value',\n\n /** Timestamp fields */\n [Sig.Created]: 'Created At',\n [Sig.Updated]: 'Updated At',\n [Sig.Deleted]: 'Deleted At',\n}\n\n/** Contextual persistence types */\nexport enum Persistance {\n NONE = 'NONE',\n SESSION = 'SESSION',\n LOCAL = 'LOCAL',\n}\n"],"names":["FT","Tag","bool","bytes","timestamp","float","int32","int64","nil","text","coordinates","map","sorted","all","Eval","Sig","Field","Fields","Document","Documents","Collection","Collections","Subcollection","Subcollections","Model","Models","Blueprint","Blueprints","Entry","Entries","Id","Name","Kind","Type","Value","Created","Updated","Deleted","lbl","Persistance"],"mappings":"AAAA;;;;;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