Skip to content

Latest commit

 

History

History
1292 lines (477 loc) · 17.6 KB

README.md

File metadata and controls

1292 lines (477 loc) · 17.6 KB

KeyUtil

Index

Constructors

Properties

Methods


Constructors

new KeyUtil(datastore: Datastore, options?: Partial.<KeyUtilOptions>): KeyUtil

Defined in KeyUtil.ts:20

Parameters:

Param Type Description
datastore Datastore -
options Partial.<KeyUtilOptions> -

Returns: KeyUtil


Properties

KEY_SYMBOL

● KEY_SYMBOL: symbol = this.datastore.KEY

Defined in KeyUtil.ts:16


base64ParentUIDFor

● base64ParentUIDFor: function = base64ify(this.parentUidFor)

Defined in KeyUtil.ts:178

Type declaration

►(entity: E): string

Parameters:

Param Type Description
entity E -

Returns: string


base64UidFor

● base64UidFor: function = base64ify(this.uidFor)

Defined in KeyUtil.ts:176

Base64 UIDs for passing around in URLs

Type declaration

►(entity: E): string

Parameters:

Param Type Description
entity E -

Returns: string


keyToUid

● keyToUid: keyToUID = keyToUID

Defined in KeyUtil.ts:171


mapToBase64ParentUIDs

● mapToBase64ParentUIDs: function = pluralize(this.base64ParentUIDFor)

Defined in KeyUtil.ts:179

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToBase64UIDs

● mapToBase64UIDs: function = pluralize(this.base64UidFor)

Defined in KeyUtil.ts:177

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToIDs

● mapToIDs: function = pluralize(this.idOf)

Defined in KeyUtil.ts:133

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToIdentifiers

● mapToIdentifiers: function = pluralize(this.identifierOf)

Defined in KeyUtil.ts:154

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToKeys

● mapToKeys: function = pluralize(this.extractKey)

Defined in KeyUtil.ts:122

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToNames

● mapToNames: function = pluralize(this.nameOf)

Defined in KeyUtil.ts:143

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToParentIDs

● mapToParentIDs: function = pluralize(this.parentIdOf)

Defined in KeyUtil.ts:136

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToParentIdentifiers

● mapToParentIdentifiers: function = pluralize(this.identifierOf)

Defined in KeyUtil.ts:158

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToParentKeys

● mapToParentKeys: function = pluralize(this.extractParentKey)

Defined in KeyUtil.ts:126

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToParentNames

● mapToParentNames: function = pluralize(this.nameOf)

Defined in KeyUtil.ts:147

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToParentUIDs

● mapToParentUIDs: function = pluralize(this.parentUidFor)

Defined in KeyUtil.ts:168

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


mapToUIDs

● mapToUIDs: function = pluralize(this.uidFor)

Defined in KeyUtil.ts:165

Type declaration

►(es: E[]): U[]

Parameters:

Param Type Description
es E[] -

Returns: U[]


parentUidFor

● parentUidFor: function = uidify(this.extractParentKey)

Defined in KeyUtil.ts:167

Type declaration

►(entity: E): string

Parameters:

Param Type Description
entity E -

Returns: string


uidFor

● uidFor: function = uidify(this.extractKey)

Defined in KeyUtil.ts:164

UIDs for string representations of keys

Type declaration

►(entity: E): string

Parameters:

Param Type Description
entity E -

Returns: string


Methods

allocateKeys

allocateKeys(keyPath: Entity.DatastoreKeyPathDatastoreKeylike, count?: number): Promise.<Entity.DatastoreKeyEntity.DatastoreKey[]>

Defined in KeyUtil.ts:98

Parameters:

Param Type Default value Description
keyPath Entity.DatastoreKeyPathDatastoreKeylike - -
count number 1 -

Returns: Promise.<Entity.DatastoreKeyEntity.DatastoreKey[]>


base64UidToKey

base64UidToKey(base64UID: string): DatastoreKey

Defined in KeyUtil.ts:181

Parameters:

Param Type Description
base64UID string -

Returns: DatastoreKey


buildKey

buildKey(keyPath: Entity.DatastoreKeyPath): DatastoreKey

Defined in KeyUtil.ts:70

Builds NUMERIC keys (keys with IDs, not names). Named keys should be created with buildNamedKey.

Parameters:

Param Type Description
keyPath Entity.DatastoreKeyPath Has form [ Kind, ID, Kind, ID, ... ]

Returns: DatastoreKey


buildMixedKey

buildMixedKey(keyPath: Entity.DatastoreKeyPath): DatastoreKey

Defined in KeyUtil.ts:56

Builds MIXED keys (keys with IDs OR names).

Parameters:

Param Type Description
keyPath Entity.DatastoreKeyPath Has form [ Kind, Identifier, Kind, Identifier, ... ]

Returns: DatastoreKey


buildNamedKey

buildNamedKey(keyPath: Entity.DatastoreKeyPath): DatastoreKey

Defined in KeyUtil.ts:83

Builds NAMED keys (keys with names, not IDs). Numeric keys should be created with buildKey

Parameters:

Param Type Description
keyPath Entity.DatastoreKeyPath Has form [ Kind, Name, Kind, Name, ... ]

Returns: DatastoreKey


coerceKeylikeToKey

coerceKeylikeToKey(keylike: DatastoreKeylike): DatastoreKey

Defined in KeyUtil.ts:95

Coerces any object (e.g. deserialized from Key JSON) to actual instance of {@link DatastoreKey}. REQUIRES that the object have a valid 'path' property.

Parameters:

Param Type Description
keylike DatastoreKeylike -

Returns: DatastoreKey


extractKey

extractKey(entity: DatastoreKeyExtractable): DatastoreKey

Defined in KeyUtil.ts:121

On GCDS entities, the key is hidden away as a symbol property. The symbol itself is non-global, and only available on the datastore object.

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: DatastoreKey


extractParentKey

extractParentKey(entity: DatastoreKeyExtractable): DatastoreKey

Defined in KeyUtil.ts:125

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: DatastoreKey


hasId

hasId(entity: DatastoreKeyExtractable, id: string): boolean

Defined in KeyUtil.ts:191

Parameters:

Param Type Description
entity DatastoreKeyExtractable -
id string -

Returns: boolean


hasName

hasName(entity: DatastoreKeyExtractable, name: string): boolean

Defined in KeyUtil.ts:192

Parameters:

Param Type Description
entity DatastoreKeyExtractable -
name string -

Returns: boolean


haveSameKey

haveSameKey(entity: DatastoreKeyExtractable, other: DatastoreKeyExtractable): boolean

Defined in KeyUtil.ts:186

Key predicates

Parameters:

Param Type Description
entity DatastoreKeyExtractable -
other DatastoreKeyExtractable -

Returns: boolean


idOf

idOf(entity: DatastoreKeyExtractable): string

Defined in KeyUtil.ts:129

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: string


identifierOf

identifierOf(entity: DatastoreKeyExtractable): undefinedstring

Defined in KeyUtil.ts:150

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: undefinedstring


indexById

indexByIdE(entity: EE[]): [string,E]⎮Array.<[string,E]>

Defined in KeyUtil.ts:195

Type parameters:

E : DatastoreKeyExtractable

Parameters:

Param Type Description
entity EE[] -

Returns: [string,E]⎮Array.<[string,E]>


nameOf

nameOf(entity: DatastoreKeyExtractable): string

Defined in KeyUtil.ts:139

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: string


parentIdOf

parentIdOf(entity: DatastoreKeyExtractable): string

Defined in KeyUtil.ts:135

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: string


parentIdentifierOf

parentIdentifierOf(entity: DatastoreKeyExtractable): undefinedstring

Defined in KeyUtil.ts:157

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: undefinedstring


parentNameOf

parentNameOf(entity: DatastoreKeyExtractable): string

Defined in KeyUtil.ts:146

Parameters:

Param Type Description
entity DatastoreKeyExtractable -

Returns: string


setKey

setKeyT(entity: T, key: Entity.DatastoreKey): T

Defined in KeyUtil.ts:38

Type parameters:

T

Parameters:

Param Type Description
entity T -
key Entity.DatastoreKey -

Returns: T


uidToKey

uidToKey(uid: string): DatastoreKey

Defined in KeyUtil.ts:170

Parameters:

Param Type Description
uid string -

Returns: DatastoreKey