Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing Metrics types #490

Merged
merged 2 commits into from
Aug 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions src/Metrics.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
export class Metrics {
constructor(table: any, params?: {}, prior?: {});
table: any;
log: any;
metrics: {
chan: string;
dimensions: string[];
enable: boolean;
env: boolean;
hot: boolean;
max: number;
namespace: string;
period: number;
properties: {};
queries: boolean;
source: string;
tenant: any;
};
add(model: any, op: any, result: any, params: any, mark: any): void;
addMetricGroup(values: any, dimensionValues: any, properties: any): void;
addMetric(key: any, values: any, dimensions: any, dimensionValues: any, properties: any): void;
flushMetrics(timestamp?: number): void;
emitMetrics(timestamp: any, rec: any): void;
}
1 change: 1 addition & 0 deletions src/Model.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ export type OneParams = {
type?: string
tunnel?: object
where?: string
profile?: string
}

/*
Expand Down
4 changes: 3 additions & 1 deletion src/Table.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
Paged,
Entity,
} from './Model'
import { Metrics } from './Metrics'
import {DynamoDBRecord} from 'aws-lambda'

export type EntityGroup = {
Expand Down Expand Up @@ -78,6 +79,7 @@ type ExtractModel<M> = M extends Entity<infer X> ? X : never

export class Table<Schema extends OneSchema = any> {
name: string
metrics: Metrics
constructor(params: TableConstructorParams<Schema>)

addContext(context?: {}): Table<Schema>
Expand All @@ -97,7 +99,7 @@ export class Table<Schema extends OneSchema = any> {
getKeys(): Promise<OneIndex>
getModel<T>(
name: T extends ModelNames<Schema> ? T : ModelNames<Schema>,
options?: {nothrow: boolean}
options?: {nothrow?: boolean}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this was also covered in #488

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh yeah looks like it was. Either works. The 488 PR doesn't make nothrow optional but i can too if needed

): T extends string ? Model<Entity<Schema['models'][T]>> : Model<Entity<ExtractModel<T>>>
getCurrentSchema(): {}
groupByType(items: AnyEntity[], params?: OneParams): EntityGroup
Expand Down
Loading