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 | SqsEventTrigger.supportedComputeTypes | supportedComputeTypes(): ComputeType[] {
return ([
ComputeType.CPU
]);
} | /**
* @returns the supported compute types by a given
* middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/triggers/sqs-event-trigger/src/index.ts#L212-L216 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Lambda.handler | async handler(event: SQSEvent, _: Context): Promise<SQSBatchResponse> {
return (await processPartialResponse(
event, this.sqsRecordHandler.bind(this), processor
));
} | // eslint-disable-next-line @typescript-eslint/no-unused-vars | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/triggers/sqs-event-trigger/src/lambdas/event-handler/index.ts#L62-L66 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessorBuilder.withIntent | public withIntent(intent: IntentExpression) {
this.providerProps.intent = intent;
return (this);
} | /**
* Sets the intent expression to use to execute the FFMPEG document
* processing.
* @param intent the intent expression to use.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L73-L76 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessorBuilder.withInfrastructure | public withInfrastructure(infrastructure: InfrastructureDefinition) {
this.providerProps.infrastructure = infrastructure;
return (this);
} | /**
* Sets the infrastructure to use to run FFMPEG.
* @param infrastructure the infrastructure to use.
* @returns the builder instance.
* @default c6a.xlarge
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L84-L87 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessorBuilder.withMaxInstances | public withMaxInstances(maxInstances: number) {
this.providerProps.maxInstances = maxInstances;
return (this);
} | /**
* The maximum amount of instances the
* cluster can have. Keep this number to
* a reasonable value to avoid over-provisioning
* the cluster.
* @param maxInstances the maximum amount of instances.
* @default 5
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L97-L100 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessorBuilder.build | public build(): FfmpegProcessor {
return (new FfmpegProcessor(
this.scope,
this.identifier, {
...this.providerProps as FfmpegProcessorProps,
...this.props
}
));
} | /**
* @returns a new instance of the `FfmpegProcessor`
* service constructed with the given parameters.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L106-L114 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.constructor | constructor(scope: Construct, id: string, private props: FfmpegProcessorProps) {
super(scope, id, description, {
...props,
queueVisibilityTimeout: cdk.Duration.minutes(30)
});
// Validate the properties.
this.props = this.parse(FfmpegProcessorPropsSchema, props);
//////////////////////... | /**
* Construct constructor.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L141-L237 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.serializeFn | private serializeFn(fn: IntentExpression, opts?: esbuild.TransformOptions): string {
const res = esbuild.transformSync(`const ${INTENT_SYMBOL} = ${serialize(fn)}\n`, {
minify: true,
...opts
});
return (res.code);
} | /**
* A helper used to serialize the user-provided intent into a string.
* This function also uses `esbuild` to validate the syntax of the
* provided function and minify it.
* @param fn the function to serialize.
* @param opts the esbuild transform options.
* @returns the serialized function.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L247-L253 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.grantReadProcessedDocuments | grantReadProcessedDocuments(grantee: iam.IGrantable): iam.Grant {
return (this.storage.grantRead(grantee));
} | /**
* Allows a grantee to read from the processed documents
* generated by this middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L259-L261 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.supportedInputTypes | supportedInputTypes(): string[] {
return ([
// Video.
'video/mpeg',
'video/mp4',
'video/x-m4v',
'video/quicktime',
'video/x-msvideo',
'video/x-matroska',
'video/MP2T',
'video/x-ms-wmv',
'video/x-flv',
// Audio.
'audio/mpeg',
'audio/mp4',
... | /**
* @returns an array of mime-types supported as input
* type by this middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L267-L297 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.supportedOutputTypes | supportedOutputTypes(): string[] {
return ([
// Video.
'video/mpeg',
'video/mp4',
'video/x-m4v',
'video/quicktime',
'video/x-msvideo',
'video/x-matroska',
'video/MP2T',
'video/x-ms-wmv',
'video/x-flv',
// Audio.
'audio/mpeg',
'audio/mp4',... | /**
* @returns an array of mime-types supported as output
* type by the data producer.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L303-L331 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.supportedComputeTypes | supportedComputeTypes(): ComputeType[] {
return ([
ComputeType.CPU,
ComputeType.GPU
]);
} | /**
* @returns the supported compute types by a given
* middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L337-L342 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | FfmpegProcessor.conditional | conditional() {
return (super
.conditional()
.and(when('type').equals('document-created'))
);
} | /**
* @returns the middleware conditional statement defining
* in which conditions this middleware should be executed.
* In this case, we want the middleware to only be invoked
* when the document mime-type is supported, and the event
* type is `document-created`.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/index.ts#L351-L356 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | getPlatform | const getPlatform = (instanceType: ec2.InstanceType) => {
if (instanceType.architecture === ec2.InstanceArchitecture.ARM_64) {
return assets.Platform.LINUX_ARM64;
} else {
return assets.Platform.LINUX_AMD64;
}
}; | /**
* A helper function returning the platform (AMD64 or ARM64)
* to use given an instance type.
* @param instanceType the instance type to evaluate.
* @returns the platform to use.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/ecs-configuration.ts#L28-L34 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinitionBuilder.withInstanceType | public withInstanceType(instanceType: ec2.InstanceType) {
this.props.instanceType = instanceType;
return (this);
} | /**
* Sets the instance type to use.
* @param instanceType the instance type to use.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L43-L46 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinitionBuilder.withMaxMemory | public withMaxMemory(maxMemory: number) {
this.props.maxMemory = maxMemory;
return (this);
} | /**
* Sets the maximum memory to use.
* @param maxMemory the maximum memory to use.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L53-L56 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinitionBuilder.withGpus | public withGpus(gpus: number) {
this.props.gpus = gpus;
return (this);
} | /**
* Sets the number of GPUs to use.
* @param gpus the number of GPUs to use.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L63-L66 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.constructor | constructor(public props: InfrastructureDefinitionProps) {} | /**
* Creates a new instance of the `InfrastructureDefinition` class.
* @param props the infrastructure definition properties.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L88-L88 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.instanceType | public instanceType() {
return (this.props.instanceType);
} | /**
* @returns the instance type to use.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L93-L95 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.maxMemory | public maxMemory() {
return (this.props.maxMemory);
} | /**
* @returns the maximum memory to use.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L100-L102 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.gpus | public gpus() {
return (this.props.gpus);
} | /**
* @returns the number of GPUs to use.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L107-L109 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.from | public static from(props: any) {
return (new InfrastructureDefinition(InfrastructureDefinitionPropsSchema.parse(props)));
} | /**
* Creates a new instance of the `InfrastructureDefinition` class.
* @param props the infrastructure definition properties.
* @returns a new instance of the `InfrastructureDefinition` class.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L116-L118 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | InfrastructureDefinition.toJSON | public toJSON() {
return (this.props);
} | /**
* @returns the JSON representation of the
* infrastructure definition.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/ffmpeg-processor/src/definitions/infrastructure.ts#L124-L126 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractorBuilder.build | public build(): VideoMetadataExtractor {
return (new VideoMetadataExtractor(
this.scope,
this.identifier, {
...this.props
}
));
} | /**
* @returns a new instance of the `VideoMetadataExtractor`
* service constructed with the given parameters.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L74-L81 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.constructor | constructor(scope: Construct, id: string, private props: MiddlewareProps) {
super(scope, id, description, {
...props,
queueVisibilityTimeout: cdk.Duration.seconds(
6 * PROCESSING_TIMEOUT.toSeconds()
)
});
///////////////////////////////////////////
/////// Processing Functi... | /**
* Provider constructor.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L103-L170 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.grantReadProcessedDocuments | grantReadProcessedDocuments(grantee: iam.IGrantable): iam.Grant {
// Since this middleware simply passes through the data
// from the previous middleware, we grant any subsequent
// middlewares in the pipeline read access to the
// data of all source middlewares.
for (const source of this.sources) {... | /**
* Allows a grantee to read from the processed documents
* generated by this middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L176-L185 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.supportedInputTypes | supportedInputTypes(): string[] {
return ([
'video/mpeg',
'video/mp4',
'video/x-m4v',
'video/quicktime',
'video/x-msvideo',
'video/x-matroska',
'video/MP2T',
'video/x-ms-wmv',
'video/x-flv'
]);
} | /**
* @returns an array of mime-types supported as input
* type by the data producer.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L191-L203 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.supportedOutputTypes | supportedOutputTypes(): string[] {
return (this.supportedInputTypes());
} | /**
* @returns an array of mime-types supported as output
* type by the data producer.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L209-L211 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.supportedComputeTypes | supportedComputeTypes(): ComputeType[] {
return ([
ComputeType.CPU
]);
} | /**
* @returns the supported compute types by a given
* middleware.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L217-L221 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | VideoMetadataExtractor.conditional | conditional() {
return (super
.conditional()
.and(when('type').equals('document-created'))
);
} | /**
* @returns the middleware conditional statement defining
* in which conditions this middleware should be executed.
* In this case, we want the middleware to only be invoked
* when the document mime-type is supported, and the event
* type is `document-created`.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/middlewares/video-processors/video-metadata-extractor/src/index.ts#L230-L235 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CacheStorage.constructor | constructor(props?: CacheProps) {
this.props = {
bucketName: props?.bucketName ?? LAKECHAIN_CACHE_STORAGE,
serviceName: props?.serviceName ?? SERVICE_NAME
};
if (!this.props.bucketName) {
throw new Error(`
A bucket name is required to initialize the cache storage.
Either p... | /**
* Cache storage constructor.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/cache/cache-storage.ts#L75-L97 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CacheStorage.hash | private hash(key: string, data: string) {
const hash = crypto.createHash('sha256');
return (hash.update(`${key}-${data}`).digest('hex'));
} | /**
* Hashes the key and data to create a unique
* and stable identifier for the element in the cache.
* @param key the key of the element to put
* in the cache.
* @param data the data to put in the cache.
* @returns
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/cache/cache-storage.ts#L107-L110 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CacheStorage.put | async put<T>(key: string, data: any): Promise<Pointer<T>> {
let serialized = data;
// If `data` is an object, we serialize it to JSON.
if (typeof data === 'object') {
serialized = JSON.stringify(data);
}
// The path where the serialized data will be stored.
const path = `${this.props.ser... | /**
* Inserts a new element in the cache.
* @param key the key of the element to put
* in the cache.
* @param data the data to put in the cache.
* @returns a pointer to the element in the cache.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/cache/cache-storage.ts#L119-L148 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptorBuilder.withBucket | public withBucket(bucket: string) {
this.props.bucket = bucket;
return (this);
} | /**
* @param bucket the S3 bucket name.
* @returns a new builder for the `S3DocumentDescriptor`
* service.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L37-L40 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptorBuilder.withKey | public withKey(key: string) {
if (key.slice(1).length === 0) {
throw new Error(`Invalid S3 object key: ${key}`);
}
this.props.key = key;
return (this);
} | /**
* @param key the S3 object key.
* @returns a new builder for the `S3DocumentDescriptor`
* service.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L47-L53 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptorBuilder.build | public build(): S3DocumentDescriptor {
if (!this.props.bucket || !this.props.key) {
throw new Error('Invalid S3 document descriptor: missing bucket or key');
}
return (new S3DocumentDescriptor({
bucket: this.props.bucket,
key: this.props.key
}));
} | /**
* @returns a new instance of the `S3DocumentDescriptor`
* service constructed with the given parameters.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L59-L67 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptor.constructor | constructor(private props: S3DocumentDescriptorProps) {
if (!props.bucket || !props.key) {
throw new Error('Invalid S3 document descriptor: missing bucket or key');
}
} | /**
* @param props the object attributes.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L83-L87 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptor.fromUri | static fromUri(uri: string | URL): S3DocumentDescriptor {
const url = uri instanceof URL ? uri : new URL(uri);
if (url.protocol !== 's3:') {
throw new Error(`Invalid S3 URI: ${uri}`);
}
return (new S3DocumentDescriptor.Builder()
.withBucket(decodeURIComponent(url.hostname))
.withKey(... | /**
* @returns an S3 object descriptor given an S3 URI.
* @param uri the S3 URI to parse.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L93-L104 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptor.asUri | public asUri(): URL {
// Each parts of the key must be URL-encoded before
// the keys can be added into the URL.
const key = this.props.key
.split('/')
.map((part) => encodeURIComponent(part))
.join('/');
return new URL(`s3://${encodeURIComponent(this.props.bucket)}/${key}`);
} | /**
* @returns a URI describing this S3 object.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L109-L117 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptor.bucket | public bucket(): string {
return (this.props.bucket);
} | /**
* @returns the bucket name.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L122-L124 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DocumentDescriptor.key | public key(): string {
return (this.props.key);
} | /**
* @returns the object key.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-object-descriptor.ts#L129-L131 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3Stream.constructor | constructor(opts = { region: process.env.AWS_REGION }) {
this.s3 = tracer.captureAWSv3Client(new S3Client({
region: opts.region,
maxAttempts: 5
}));
} | /**
* A helper class to read and write to S3 using
* streams.
* @param {*} region the AWS region to use.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-stream.ts#L58-L63 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3Stream.createS3ReadStream | async createS3ReadStream(input: ObjectInput): Promise<Readable> {
const result = await this.s3.send(new GetObjectCommand({
Bucket: input.bucket,
Key: input.key
}));
return (result.Body as Readable);
} | /**
* @param input represents a bucket, key, and content type tuple.
* @returns a read stream to the given S3 object.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-stream.ts#L69-L75 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3Stream.createS3WriteStream | createS3WriteStream(input: ObjectInput, opts?: Partial<PutObjectCommandInput>): {
writeStream: PassThrough,
promise: Promise<
AbortMultipartUploadCommandOutput
| CompleteMultipartUploadCommandOutput
>
} {
const stream = new PassThrough();
const promise = new Upload({
client: th... | /**
* Creates a write stream to the given S3 object.
* @param input represents a bucket, key, and content type tuple.
* @returns an object containing the write stream and a promise
* which resolves when the write stream has finished.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/helpers/s3-stream.ts#L83-L105 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withSpecVersion | public withSpecVersion(specversion: string) {
this.props.specversion = specversion;
return (this);
} | /**
* @param specversion the specification version of the
* cloud event.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L113-L116 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withId | public withId(id: string) {
this.props.id = id;
return (this);
} | /**
* @param id the id of the cloud event.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L122-L125 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withTime | public withTime(time: string) {
this.props.time = time;
return (this);
} | /**
* @param time the time the cloud event was created.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L131-L134 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withType | public withType(type: EventType) {
this.props.type = type;
return (this);
} | /**
* @param type the type associated with the event.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L140-L143 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withData | public withData(data: DataEnvelope) {
this.props.data = data;
return (this);
} | /**
* @param data the data envelope associated
* with the cloud event.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L150-L153 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.build | public build(): CloudEvent {
return (new CloudEvent(CloudEventSchema.parse((this.props))));
} | /**
* @returns a new cloud event instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L158-L160 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.from | static from(props: string | object): CloudEvent {
if (typeof props === 'string') {
props = JSON.parse(props);
}
return (new CloudEvent(CloudEventSchema.parse((props))));
} | /**
* @param props the properties of the cloud event.
* This can be either a JSON string or an object.
* @returns a new cloud event instance constructed
* from the given properties.
* @throws an error if the properties are invalid.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L190-L195 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.data | data(): DataEnvelope {
return (this.props.data);
} | /**
* @returns the data envelope object associated
* with the cloud event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L201-L203 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.specVersion | specVersion(): string {
return (this.props.specversion);
} | /**
* @returns the specification version of the
* cloud event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L209-L211 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.id | id(): string {
return (this.props.id);
} | /**
* @returns the event unique identifier.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L216-L218 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.type | type(): EventType {
return (this.props.type);
} | /**
* @returns the type of the cloud event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L223-L225 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.time | time(): string {
return (this.props.time);
} | /**
* @returns the time at which the cloud event
* was created.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L231-L233 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.clone | clone(): CloudEvent {
return (new CloudEvent.Builder()
.withSpecVersion(this.specVersion())
.withId(this.id())
.withType(this.type())
.withTime(this.time())
.withData(this.data().clone())
.build()
);
} | /**
* @returns a new instance consisting of a deep copy of
* values associated with the current cloud event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L239-L248 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.resolve | resolve(reference: IReference<any>): Promise<any> {
return (new ReferenceResolver(this).resolve(reference));
} | /**
* Allows to resolve a reference against the current
* cloud event.
* @param reference the reference to resolve.
* @returns the value associated with the given reference.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L256-L258 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.toJSON | toJSON() {
return ({
specversion: this.specVersion(),
id: this.id(),
type: this.type(),
time: this.time(),
data: this.data().toJSON()
});
} | /**
* Describes how the document should be serialized.
* @returns an object with the properties associated
* with the JSON representation of the event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L265-L273 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | CloudEvent.asGraph | asGraph(): Promise<DirectedGraph> {
return (new GraphResolver(this).resolve());
} | /**
* @returns a promise to a directed graph representation
* of the ontology extracted from the cloud event.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/cloud-event.ts#L279-L281 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withChainId | public withChainId(chainId: string) {
this.props.chainId = chainId;
return (this);
} | /**
* @param chainId the identifier of the chain.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L92-L95 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withSourceDocument | public withSourceDocument(source: Document) {
this.props.source = source;
return (this);
} | /**
* @param source the source document
* associated with the data envelope.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L102-L105 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withDocument | public withDocument(document: Document) {
this.props.document = document;
return (this);
} | /**
* @param document the document associated with
* the data envelope.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L112-L115 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withMetadata | public withMetadata(metadata: DocumentMetadata) {
this.props.metadata = metadata;
return (this);
} | /**
* @param metadata the metadata associated with
* the data envelope.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L122-L125 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withCallStack | public withCallStack(callStack: string[]) {
this.props.callStack = callStack;
return (this);
} | /**
* @param callStack the call stack associated with
* the data envelope.
* @returns the builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L132-L135 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.build | public build() {
return (new DataEnvelope(DataEnvelopeSchema.parse(this.props)));
} | /**
* @returns a new cloud event instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L140-L142 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.constructor | constructor(public props: DataEnvelopeProps) {} | /**
* @param chainId the identifier of the chain.
* @param source the document representing
* the data provider source.
* @param document the current document being processed.
* @param metadata the metadata associated with the
* source document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L168-L168 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.from | static from(data: string | object): DataEnvelope {
if (typeof data === 'string') {
data = JSON.parse(data);
}
return (new DataEnvelope(DataEnvelopeSchema.parse(data)));
} | /**
* @param data an object representing the data
* envelope. This can be a JSON string or an object.
* @returns a data envelope instance.
* @throws an error if the data envelope is invalid.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L176-L181 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.chainId | chainId(): string {
return (this.props.chainId);
} | /**
* @returns the unique identifier of the pipeline
* chain execution.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L187-L189 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.source | source(): Document {
return (this.props.source);
} | /**
* @returns the source document associated with
* the data envelope.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L195-L197 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.document | document(): Document {
return (this.props.document);
} | /**
* @returns the current document to be processed.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L202-L204 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.metadata | metadata(): DocumentMetadata {
return (this.props.metadata);
} | /**
* @returns the metadata associated with the
* source document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L210-L212 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.callStack | callStack(): string[] {
return (this.props.callStack);
} | /**
* @returns the call stack associated with the
* chain execution.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L218-L220 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.clone | clone(): DataEnvelope {
return (new DataEnvelope.Builder()
.withChainId(this.chainId())
.withMetadata(this.metadata())
.withSourceDocument(this.source().clone())
.withDocument(this.document().clone())
.withCallStack(this.callStack().slice())
.build()
);
} | /**
* @returns a new instance of the current data envelope
* consisting of a deep copy of values associated with it.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L226-L235 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | DataEnvelope.toJSON | toJSON() {
return ({
chainId: this.props.chainId,
source: this.props.source.toJSON(),
document: this.props.document.toJSON(),
metadata: this.props.metadata,
callStack: this.props.callStack
});
} | /**
* Describes how the document should be serialized.
* @returns an object with the properties associated
* with the JSON representation of the data envelope.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/cloud-event/data-envelope.ts#L242-L250 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withUrl | public withUrl(url: string | URL) {
this.props.url = typeof url === 'string' ? new URL(url) : url;
return (this);
} | /**
* @param url The URL pointing to the content
* of the document.
* @returns The builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L81-L84 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withType | public withType(type: string) {
this.props.type = type;
return (this);
} | /**
* @param type The mime type of the document.
* @returns The builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L90-L93 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withSize | public withSize(size: number) {
this.props.size = size;
return (this);
} | /**
* @param size The size of the document.
* @returns The builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L99-L102 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.withEtag | public withEtag(etag: string) {
this.props.etag = etag;
return (this);
} | /**
* @param etag The etag of the document.
* @returns The builder instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L108-L111 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Builder.build | public build(): Document {
return (new Document(DocumentSchema.parse(this.props)));
} | /**
* @returns A new document instance.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L116-L118 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.constructor | constructor(public props: DocumentSchemaProps) {
Object.defineProperty(this, 'dataSource', {
value: createDataSource(this.props.url),
enumerable: false
});
} | /**
* @param props The document properties.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L141-L146 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.from | static from(data: string | object): Document {
if (typeof data === 'string') {
data = JSON.parse(data);
}
return (new Document(DocumentSchema.parse(data)));
} | /**
* @param data An object representing the document.
* This can be a JSON string or an object.
* @returns A document instance.
* @throws An error if the document is invalid.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L154-L159 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.id | id(): string {
return (v5(this.url().toString(), v5.URL));
} | /**
* @returns A unique, opaque, identifier that can be
* considered unique for identifying the document.
* @note The underlying implementation can change,
* it should not be assumed the format of the identifier to
* remain stable.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L168-L170 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.url | url(): URL {
return (this.props.url);
} | /**
* @returns The url associated with the document
* as a URL object.
* @throws An error if the url is invalid.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L177-L179 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.filename | filename(): FileProperties {
const props = path.parse(decodeURIComponent(
this.url().pathname
));
// Example : /path/to/file.txt
return ({
// Example : .txt
extension: () => props.ext,
// Example : file.txt
basename: () => props.base,
// Example : /path/to
path:... | /**
* @returns The filename of the document.
* as a string.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L185-L200 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.mimeType | mimeType(): string {
return (this.props.type);
} | /**
* @returns The mime type of the document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L205-L207 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.size | size(): number | undefined {
return (this.props.size);
} | /**
* @returns The size of the document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L212-L214 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.etag | etag(): string | undefined {
return (this.props.etag);
} | /**
* @returns The etag of the document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L219-L221 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.data | data(): DataSource {
return (this.dataSource);
} | /**
* @returns The data source object associated
* with the document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L227-L229 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.clone | clone(): Document {
const size = this.size();
const etag = this.etag();
const builder = new Document.Builder()
.withUrl(new URL(this.url().toString()))
.withType(this.mimeType())
if (size) {
builder.withSize(size);
}
if (etag) {
builder.withEtag(etag);
}
... | /**
* @returns A new instance consisting of a deep copy of
* values associated with the current document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L235-L251 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.create | static async create(input: {
url: URL | string,
type: string,
data: Buffer | Readable
}): Promise<Document> {
let size = 0;
const dataSource = createDataSource(input.url);
const writable = dataSource.asWriteStream({ ContentType: input.type });
// Create a new document instance.
... | /**
* Creates a new document instance and stores the data associated with
* the new document in the storage associated with the given URL.
* @param input an object describing the attributes of the document.
* @returns a new instance of a document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L259-L299 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | Document.toJSON | toJSON() {
return ({
url: this.url().toString(),
type: this.mimeType(),
size: this.size(),
etag: this.etag()
});
} | /**
* Describes how the document should be serialized.
* @returns A JSON representation of the document.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/document.ts#L305-L312 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.constructor | constructor(private url: URL) {
this.url = url;
} | /**
* HTTPS data source constructor.
* @param url the URL of the data source.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/https/index.ts#L36-L38 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.asReadStream | async asReadStream(): Promise<Readable> {
const res = await fetch(this.url.toString());
if (!res.ok || !res.body) {
throw new Error(`Failed to get object from HTTPS: ${this.url}`);
}
return (new FetchReadable(res.body));
} | /**
* @returns a readable stream to the data source.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/https/index.ts#L43-L51 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.asWriteStream | asWriteStream(): Writable {
throw new Error('Writable streams are not supported for HTTPS data sources');
} | /**
* @returns a writable stream to the data source.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/https/index.ts#L56-L58 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.asArrayBuffer | async asArrayBuffer(): Promise<ArrayBufferLike> {
const res = await fetch(this.url.toString());
if (!res.ok || !res.body) {
throw new Error(`Failed to get object from HTTPS: ${this.url}`);
}
return (await res.arrayBuffer());
} | /**
* @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/https/index.ts#L65-L73 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.asBuffer | async asBuffer(): Promise<Buffer> {
return (Buffer.from(await this.asArrayBuffer()));
} | /**
* @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/https/index.ts#L81-L83 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | HttpsDataSource.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 (... | /**
* @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 the file to write to.
* @note the file path must be absolute.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/https/index.ts#L93-L113 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DataSource.constructor | constructor(private url: URL) {
this.descriptor = S3DocumentDescriptor.fromUri(url);
} | /**
* S3 data source constructor.
* @param url the URL of the data source.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L55-L57 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
project-lakechain | github_2023 | awslabs | typescript | S3DataSource.asReadStream | async asReadStream(): Promise<Readable> {
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 (res.Body as Readable);
} | /**
* @returns a readable stream to the data source.
*/ | https://github.com/awslabs/project-lakechain/blob/4285173e80584eedfc1a8424d3d1b6c1a7038088/packages/typescript-sdk/src/models/document/data-sources/s3/index.ts#L62-L73 | 4285173e80584eedfc1a8424d3d1b6c1a7038088 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.