repo_name
string
dataset
string
owner
string
lang
string
func_name
string
code
string
docstring
string
url
string
sha
string
project-lakechain
github_2023
awslabs
typescript
S3DataSource.asWriteStream
asWriteStream(obj: any = {}): Writable { const { writeStream, promise } = new S3Stream().createS3WriteStream({ bucket: this.descriptor.bucket(), key: this.descriptor.key() }, obj); promise.then((res) => { writeStream.emit('uploaded', res); writeStream.destroy(); }); return (writeStream); }
/** * @returns a writable stream to the data source. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L78-L90
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
S3DataSource.asArrayBuffer
async asArrayBuffer(): Promise<ArrayBufferLike> { const res = await s3.send(new GetObjectCommand({ Bucket: this.descriptor.bucket(), Key: this.descriptor.key() })); if (!res.Body) { throw new Error(`Failed to get object from S3: ${this.url}`); } return ((await res.Body.transformToByteArray()).buffer); }
/** * @returns an array like buffer of the data source. * @note this method will buffer the entire content of * the data in memory. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L97-L108
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
S3DataSource.asBuffer
async asBuffer(): Promise<Buffer> { const buf = []; const stream = await this.asReadStream(); // Buffer the stream in memory. for await (const data of stream) { buf.push(data); } return (Buffer.concat(buf)); }
/** * @returns the content of the data pointed by the data * source as a buffer. * @note this method will buffer the entire content of * the data in memory. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L116-L125
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
S3DataSource.asFile
async asFile(filePath?: string): Promise<string> { const stream = await this.asReadStream(); const pipeline = promisify(pipe); // If no file path is specified, we create a temporary file. if (!filePath) { filePath = tmp.fileSync().name; } // Check if the file name is absolute. if (!path.isAbsolute(filePath)) { throw new Error(`The file name must be absolute: ${filePath}`); } // Pipe the stream to the output file. await pipeline( stream, fs.createWriteStream(filePath) ); return (filePath); }
/** * @returns a promise resolved when the content of * the data source has been written to the specified * file. The promise resolves the path of the * output file. * @param filePath the path to write the file to. * @note the file path must be absolute. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L135-L155
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.constructor
constructor(public props: FaceProps) {}
/** * Face constructor. * @param props the properties of the Face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L77-L77
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.from
public static from(data: any) { return (new Face(FaceSchema.parse(data))); }
/** * @returns a new Face object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L82-L84
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.boundingBox
boundingBox() { return (this.props.boundingBox); }
/** * @returns the bounding box of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L89-L91
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.attributes
attributes() { return (this.props.attributes); }
/** * @returns the attributes of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L96-L98
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.landmarks
landmarks() { return (this.props.landmarks); }
/** * @returns the landmarks of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L103-L105
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.pose
pose() { return (this.props.pose); }
/** * @returns the pose of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L110-L112
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.eyeDirection
eyeDirection() { return (this.props.eyeDirection); }
/** * @returns the eye direction of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L117-L119
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.confidence
confidence() { return (this.props.confidence); }
/** * @returns the confidence score associated with the * face detection. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L125-L127
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Face.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the face. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/face.ts#L132-L134
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.constructor
constructor(public props: LabelProps) {}
/** * Label constructor. * @param props the properties of the label. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L42-L42
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.from
public static from(data: any) { return (new Label(LabelSchema.parse(data))); }
/** * @returns a new Label object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L47-L49
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.name
name() { return (this.props.name); }
/** * @returns the name of the label. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L54-L56
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.confidence
confidence() { return (this.props.confidence); }
/** * @returns the confidence score associated with the * label detection. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L62-L64
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.type
type() { return (this.props.type); }
/** * @returns the type of the label. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L69-L71
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Label.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the label. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/label.ts#L76-L78
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VectorEmbedding.constructor
constructor(public props: VectorEmbeddingProps) {}
/** * Vector embedding constructor. * @param props the properties of the vector embedding. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/vector-embedding.ts#L62-L62
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VectorEmbedding.from
public static from(data: any) { return (new VectorEmbedding(VectorEmbeddingSchema.parse(data))); }
/** * @returns a new vector embedding object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/vector-embedding.ts#L67-L69
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VectorEmbedding.embeddings
embeddings(): Promise<Array<number>> { return (this.props.vectors.resolve()); }
/** * @returns a promise that resolves the embeddings * associated with the document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/vector-embedding.ts#L75-L77
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VectorEmbedding.model
model() { return (this.props.model); }
/** * @returns the identifier of the model used to generate * the embeddings. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/vector-embedding.ts#L83-L85
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
VectorEmbedding.dimensions
dimensions() { return (this.props.dimensions); }
/** * @returns the number of dimensions of the embeddings. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/attributes/vector-embedding.ts#L90-L92
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.constructor
constructor(public props: DetectedObjectProps) {}
/** * Detected object constructor. * @param props the properties of the detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L41-L41
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.from
public static from(data: any) { return (new DetectedObject(DetectedObjectSchema.parse(data))); }
/** * @returns a new detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L46-L48
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.name
name() { return (this.props.name); }
/** * @returns the name of the detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L53-L55
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.boundingBox
boundingBox() { return (this.props.boundingBox); }
/** * @returns the bounding box of the detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L60-L62
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.confidence
confidence() { return (this.props.confidence); }
/** * @returns the confidence score associated with the * detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L68-L70
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedObject.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-object.ts#L75-L77
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.constructor
constructor(public props: DetectedTextProps) {}
/** * Detected text constructor. * @param props the properties of the detected text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L38-L38
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.from
public static from(data: any) { return (new DetectedText(DetectedTextSchema.parse(data))); }
/** * @returns a new detected text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L43-L45
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.text
text() { return (this.props.text); }
/** * @returns the text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L50-L52
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.boundingBox
boundingBox() { return (this.props.boundingBox); }
/** * @returns the bounding box of the detected text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L57-L59
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.confidence
confidence() { return (this.props.confidence); }
/** * @returns the confidence score associated with the * detected text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L65-L67
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
DetectedText.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the detected text. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/detected-text.ts#L72-L74
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.constructor
constructor(public props: PersonProps) {}
/** * Person constructor. * @param props the properties of the detected person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L65-L65
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.from
public static from(data: any) { return (new Person(PersonSchema.parse(data))); }
/** * @returns a new detected person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L70-L72
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.wearsRequiredEquipment
wearsRequiredEquipment() { return (this.props.wearsRequiredEquipment); }
/** * @returns whether the person is wearing the required * personal protective equipment. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L78-L80
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.bodyParts
bodyParts() { return (this.props.bodyParts); }
/** * @returns the body parts of the person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L85-L87
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.boundingBox
boundingBox() { return (this.props.boundingBox); }
/** * @returns the bounding box of the detected person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L92-L94
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.confidence
confidence() { return (this.props.confidence); }
/** * @returns the confidence score associated with the * detection of the person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L100-L102
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Person.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the person. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/image/attributes/person.ts#L107-L109
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.constructor
constructor(public props: EntityProps) {}
/** * Pos constructor. * @param props the properties of the part of speech. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L46-L46
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.from
public static from(data: any) { return (new Entity(EntitySchema.parse(data))); }
/** * @returns the part of speech tag. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L51-L53
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.type
type() { return (this.props.type); }
/** * @returns the type of the entity. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L58-L60
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.text
text() { return (this.props.text); }
/** * @returns the text associated with the * entity. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L66-L68
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.score
score() { return (this.props.score); }
/** * @returns the confidence score associated with the * entity detection. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L74-L76
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.startOffset
startOffset() { return (this.props.startOffset); }
/** * @returns the start offset of the entity. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L81-L83
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.endOffset
endOffset() { return (this.props.endOffset); }
/** * @returns the end offset of the entity. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L88-L90
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Entity.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the entity. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/entities.ts#L95-L97
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.constructor
constructor(public props: PiiProps) {}
/** * PII constructor. * @param props the properties of the PII. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L48-L48
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.from
public static from(data: any) { return (new Pii(PiiSchema.parse(data))); }
/** * @returns a new PII object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L53-L55
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.type
type() { return (this.props.type); }
/** * @returns the PII type. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L60-L62
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.text
text() { return (this.props.text); }
/** * @returns the text associated with the * PII. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L68-L70
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.score
score() { return (this.props.score); }
/** * @returns the confidence score associated with the * PII detection. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L76-L78
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.startOffset
startOffset() { return (this.props.startOffset); }
/** * @returns the start offset of the PII in the text document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L83-L85
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.endOffset
endOffset() { return (this.props.endOffset); }
/** * @returns the end offset of the PII in the text document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L90-L92
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pii.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the PII. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pii.ts#L97-L99
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.constructor
constructor(public props: PosProps) {}
/** * Pos constructor. * @param props the properties of the part of speech. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L46-L46
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.from
public static from(data: any) { return (new PartOfSpeech(PosSchema.parse(data))); }
/** * @returns the part of speech tag. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L51-L53
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.tag
tag() { return (this.props.tag); }
/** * @returns the part of speech tag. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L58-L60
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.text
text() { return (this.props.text); }
/** * @returns the text associated with the * part of speech. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L66-L68
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.score
score() { return (this.props.score); }
/** * @returns the confidence score associated with the * part of speech. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L74-L76
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.startOffset
startOffset() { return (this.props.startOffset); }
/** * @returns the start offset of the part of speech. * The start offset is the index of the first character * of the part of speech in the text document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L83-L85
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.endOffset
endOffset() { return (this.props.endOffset); }
/** * @returns the end offset of the part of speech. * The end offset is the index of the last character * of the part of speech in the text document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L92-L94
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PartOfSpeech.toJSON
toJSON() { return (this.props); }
/** * @returns the JSON representation of the part of speech. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/text/attributes/pos.ts#L99-L101
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.constructor
constructor(public props: SceneSchemaProps) {}
/** * Scene constructor. * @param props the properties of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L110-L110
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.from
public static from(data: any) { return (new Scene(SceneSchema.parse(data))); }
/** * @returns a new scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L115-L117
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.index
index() { return (this.props.index); }
/** * @returns the index of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L122-L124
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.type
type() { return (this.props.type); }
/** * @returns the type of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L129-L131
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.startTime
startTime() { return (this.props.startTime); }
/** * @returns the start time of the scene in milliseconds. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L136-L138
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.endTime
endTime() { return (this.props.endTime); }
/** * @returns the end time of the scene in milliseconds. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L143-L145
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.duration
duration() { return (this.props.duration); }
/** * @returns the duration of the scene in milliseconds. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L150-L152
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.startTimecode
startTimecode() { return (this.props.startTimecode); }
/** * @returns the start timecode of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L157-L159
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.endTimecode
endTimecode() { return (this.props.endTimecode); }
/** * @returns the end timecode of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L164-L166
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.durationTimecode
durationTimecode() { return (this.props.durationTimecode); }
/** * @returns the duration timecode of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L171-L173
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.startFrame
startFrame() { return (this.props.startFrame); }
/** * @returns the index of the first frame of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L178-L180
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.endFrame
endFrame() { return (this.props.endFrame); }
/** * @returns the index of the last frame of the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L185-L187
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.durationFrames
durationFrames() { return (this.props.durationFrames); }
/** * @returns the number of frames in the scene. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L192-L194
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Scene.toJSON
toJSON() { return (this.props); }
/** * @returns a JSON representation of the detected object. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/metadata/video/attributes/scene.ts#L199-L201
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.constructor
constructor(private event: CloudEvent) {}
/** * Graph resolver constructor. * @param event the cloud event to resolve. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L30-L30
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.getName
private getName(document: Document, metadata: DocumentMetadata) { // If a title is defined, we use that. if (metadata.title) { return (metadata.title); } // Otherwise, we use the filename. return (document.filename().basename()); }
/** * A helper function that returns the name of the document. * @param document the document instance. * @param metadata the metadata of the document. * @returns the name of the document. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L38-L45
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addDocument
private addDocument(graph: DirectedGraph) { const document = this.event.data().document(); // eslint-disable-next-line @typescript-eslint/no-unused-vars const { properties: _1, custom: _2, type, ...rest } = this.event.data().metadata(); // Add the current document to the graph. graph.mergeNode(document.id(), { type: 'Document', attrs: { ...document.toJSON(), ...JSON.parse(JSON.stringify(rest)), name: this.getName(document, rest) } }); return (this); }
/** * Adds the current document to the graph with * its attributes. * @param graph the graph instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L53-L69
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addSource
private addSource(graph: DirectedGraph) { const source = this.event.data().source(); const document = this.event.data().document(); const metadata = this.event.data().metadata(); // If the current document is different from // the source document, we create a connection // between them. if (source.id() !== document.id()) { graph.mergeNode(source.id(), { type: 'Document', attrs: { ...source.toJSON(), name: this.getName(source, metadata) } }); graph.mergeEdge(document.id(), source.id(), { type: 'HAS_SOURCE', attrs: { description: 'The document has a source document.' } }); } return (this); }
/** * Adds the source document to the graph. * @param graph the graph instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L76-L102
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addLanguage
private addLanguage(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.language) { graph.mergeNode(metadata.language, { type: 'Language', attrs: { name: metadata.language } }); // Connect the document to the language. graph.mergeEdge(document.id(), metadata.language, { type: 'IS_IN_LANGUAGE', attrs: { description: 'The document is in the given language.' } }); } return (this); }
/** * Adds the language of the document to the graph * as a separate node. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L111-L132
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addTopics
private addTopics(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.topics) { metadata.topics.forEach(topic => { graph.mergeNode(topic, { type: 'Topic', attrs: { name: topic } }); // Connect the document to the topic. graph.mergeEdge(document.id(), topic, { type: 'IS_LINKED_TO', attrs: { description: 'The document is linked to the given topic.' } }); }); } return (this); }
/** * Adds the topics of the document to the graph * as separate nodes. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L141-L164
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addPublisher
private addPublisher(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.publisher?.name) { graph.mergeNode(metadata.publisher.name, { type: 'Publisher', attrs: { ...metadata.publisher } }); // Connect the document to the publisher. graph.mergeEdge(document.id(), metadata.publisher, { type: 'PUBLISHED_BY', attrs: { description: 'The document is published by the given publisher.' } }); } return (this); }
/** * Adds the publisher of the document to the graph * as a separate node. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L173-L194
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addAuthors
private addAuthors(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.authors) { metadata.authors.forEach(author => { graph.mergeNode(author, { type: 'Author', attrs: { name: author } }); // Connect the document to the author. graph.mergeEdge(document.id(), author, { type: 'AUTHORED_BY', attrs: { description: 'The document is authored by the given author.' } }); }); } return (this); }
/** * Adds the authors of the document to the graph * as separate nodes. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L203-L226
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addClass
private addClass(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.type) { graph.mergeNode(metadata.type, { type: 'Class', attrs: { name: metadata.type } }); // Connect the document to the type. graph.mergeEdge(document.id(), metadata.type, { type: 'IS_OF_CLASS', attrs: { description: 'The document is of the given class.' } }); } return (this); }
/** * Adds the class of the document to the graph * as a separate node. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L235-L256
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addKind
private addKind(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); if (metadata.properties?.kind) { graph.mergeNode(metadata.properties.kind, { type: 'Kind', attrs: { name: metadata.properties.kind } }); // Connect the document to the kind. graph.mergeEdge(document.id(), metadata.properties.kind, { type: 'IS_OF_KIND', attrs: { description: 'The document is of the given kind.' } }); } return (this); }
/** * Adds the kind of the document to the graph * as a separate node. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L265-L286
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.addCustomOntology
private async addCustomOntology(graph: DirectedGraph, document: Document) { const metadata = this.event.data().metadata(); const pointer = metadata.ontology; if (pointer) { const ontology = await pointer.resolve(); // Merge the ontology nodes with the graph. ontology.nodes().forEach(node => { const attrs = ontology.getNodeAttributes(node); // Merge the node into the graph. graph.mergeNode(node, attrs); // If the node is a head, it means it is connected // to the document. if (attrs.attrs?.isHead) { graph.mergeEdge(document.id(), node, { type: 'HAS_ONTOLOGY', attrs: { description: 'The document is connected to the custom ontology.' } }); } }); // Merge the ontology edges with the graph. ontology.edges().forEach(edge => { const source = ontology.source(edge); const target = ontology.target(edge); const attrs = ontology.getEdgeAttributes(edge); if (source && target) { // Merge the edge into the graph. graph.mergeEdge(source, target, attrs); } }); } return (this); }
/** * Adds the custom ontology to the graph. * @param graph the graph instance. * @param document the document instance. * @returns a reference to the graph resolver. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L294-L334
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
GraphResolver.resolve
async resolve(): Promise<DirectedGraph> { const graph = new DirectedGraph(); const document = this.event.data().document(); this.addDocument(graph); this.addSource(graph); this.addLanguage(graph, document); this.addTopics(graph, document); this.addPublisher(graph, document); this.addAuthors(graph, document); this.addClass(graph, document); this.addKind(graph, document); await this.addCustomOntology(graph, document); return (graph); }
/** * Resolve the cloud event into a graph representation. * @returns a graph representation of the cloud event. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/ontology/graph-resolver.ts#L340-L355
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PointerBuilder.withUri
public withUri(uri: string | URL) { this.uri = typeof uri === 'string' ? new URL(uri) : uri; return (this); }
/** * @param uri the URI pointing to the external data source. * @returns the builder instance. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L32-L35
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PointerBuilder.withClassType
public withClassType(classType: any) { this.classType = classType; return (this); }
/** * @param classType the class type of the data model * that is associated with the pointer. * @returns the builder instance. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L42-L45
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
PointerBuilder.build
public build(): Pointer<T> { if (!this.uri) { throw new Error('A URI is required to build a pointer'); } if (!this.classType) { throw new Error('A class type is required to build a pointer'); } return new Pointer<T>(this.uri, this.classType); }
/** * @returns a new pointer instance. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L50-L59
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pointer.constructor
constructor(uri: URL, classType: any) { this.uri = uri; this.dataSource = createDataSource(uri); this.classType = classType; this.value = null; }
/** * Creates a new pointer instance. * @param uri the URI pointing to the external * data source. * @param classType the class reference to the * data model that is associated with the pointer. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L108-L113
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pointer.resolve
async resolve(): Promise<T> { if (this.value) { return (this.value); } const data = await this.dataSource.asBuffer(); const json = JSON.parse(data.toString()); const type = this.classType as any; // If the object is constructible via a static // `from` method, we use this method to construct // the object. if (typeof type.from === 'function') { if (Array.isArray(json)) { this.value = json.map((item: object) => type.from(item)) as T; return (this.value); } return (this.value = type.from(json)); } // Otherwise we cast the object using the class // transformer library. return (this.value = plainToInstance(type, json) as T); }
/** * Resolves the pointer by loading the data associated * with the pointer URI in memory, and de-serializes * the data into the data model that is associated * with the pointer. * @returns the data model instance. * @throws an error if the pointer could not be resolved. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L123-L145
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pointer.getUri
getUri(): URL { return (this.uri); }
/** * @returns the URI pointing to the external data source. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L150-L152
4285173e80584eedfc1a8424d3d1b6c1a7038088
project-lakechain
github_2023
awslabs
typescript
Pointer.isResolved
isResolved(): boolean { return (this.value !== null); }
/** * @returns whether the pointer has been resolved. */
https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/pointer/index.ts#L157-L159
4285173e80584eedfc1a8424d3d1b6c1a7038088