stadata-js 0.1.2 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -365,10 +365,10 @@ interface DerivedVariableListParams extends BaseListParams {
365
365
  variableId?: number;
366
366
  }
367
367
  interface DynamicTableParams extends BaseListParams {
368
- tableId: string;
369
368
  variableId: number;
370
- periodId?: number;
369
+ periodId: number | string;
371
370
  derivedVariableId?: number;
371
+ verticalVariableId?: number;
372
372
  derivedPeriodId?: number;
373
373
  }
374
374
  interface StatisticClassificationListParams extends BaseListParams {
@@ -1109,32 +1109,71 @@ declare class GetCensusById implements UseCase<ViewParams, CensusEvent> {
1109
1109
  execute(params: ViewParams): Promise<Result<CensusEvent, ApiFailure>>;
1110
1110
  }
1111
1111
 
1112
- declare class DynamicTable extends BaseEntity {
1113
- readonly variableId: number;
1114
- readonly title: string;
1115
- readonly subjectId: number;
1116
- readonly subjectName: string;
1117
- readonly notes: string;
1112
+ declare class VariableInfo extends BaseEntity {
1113
+ readonly value: number;
1114
+ readonly label: string;
1118
1115
  readonly unit: string;
1119
- readonly verticalVariableId: number;
1120
- readonly domain: string;
1121
- readonly csaSubjectId?: number | undefined;
1122
- readonly csaSubjectName?: string | undefined;
1123
- readonly graphId?: number | undefined;
1124
- readonly graphName?: string | undefined;
1125
- constructor(variableId: number, title: string, subjectId: number, subjectName: string, notes: string, unit: string, verticalVariableId: number, domain: string, csaSubjectId?: number | undefined, csaSubjectName?: string | undefined, graphId?: number | undefined, graphName?: string | undefined);
1116
+ readonly subject: string;
1117
+ readonly definition: string;
1118
+ readonly notes: string;
1119
+ readonly decimal?: number | undefined;
1120
+ constructor(value: number, label: string, unit: string, subject: string, definition: string, notes: string, decimal?: number | undefined);
1121
+ toJson(): Record<string, unknown>;
1122
+ static fromJson(json: Record<string, unknown>): VariableInfo;
1123
+ }
1124
+ declare class VerticalVariableInfo extends BaseEntity {
1125
+ readonly value: number | string;
1126
+ readonly label: string;
1127
+ constructor(value: number | string, label: string);
1128
+ toJson(): Record<string, unknown>;
1129
+ static fromJson(json: Record<string, unknown>): VerticalVariableInfo;
1130
+ }
1131
+ declare class PeriodInfo extends VerticalVariableInfo {
1132
+ static fromJson(json: Record<string, unknown>): PeriodInfo;
1133
+ }
1134
+ declare class SubjectInfo extends BaseEntity {
1135
+ readonly value: number;
1136
+ readonly label: string;
1137
+ constructor(value: number, label: string);
1138
+ toJson(): Record<string, unknown>;
1139
+ static fromJson(json: Record<string, unknown>): SubjectInfo;
1140
+ }
1141
+ declare class RelatedTable extends BaseEntity {
1142
+ readonly id: string;
1143
+ readonly title: string;
1144
+ readonly tableSource: number;
1145
+ readonly lastUpdate: string | null;
1146
+ readonly link: string;
1147
+ constructor(id: string, title: string, tableSource: number, lastUpdate: string | null, link: string);
1148
+ toJson(): Record<string, unknown>;
1149
+ static fromJson(json: Record<string, unknown>): RelatedTable;
1150
+ }
1151
+
1152
+ declare class DynamicTable extends BaseEntity {
1153
+ readonly subjects: SubjectInfo[];
1154
+ readonly variables: VariableInfo[];
1155
+ readonly verticalVariables: VerticalVariableInfo[];
1156
+ readonly verticalVariableLabel: string;
1157
+ readonly periods: PeriodInfo[];
1158
+ readonly derivedVariables: VerticalVariableInfo[];
1159
+ readonly derivedPeriods: VerticalVariableInfo[];
1160
+ readonly dataContent: Record<string, unknown>;
1161
+ readonly related: RelatedTable[];
1162
+ readonly lastUpdate?: string | null | undefined;
1163
+ constructor(subjects: SubjectInfo[], variables: VariableInfo[], verticalVariables: VerticalVariableInfo[], verticalVariableLabel: string, periods: PeriodInfo[], derivedVariables: VerticalVariableInfo[], derivedPeriods: VerticalVariableInfo[], dataContent: Record<string, unknown>, related: RelatedTable[], lastUpdate?: string | null | undefined);
1126
1164
  toJson(): Record<string, unknown>;
1127
1165
  static fromJson(json: Record<string, unknown>): DynamicTable;
1166
+ getDataValue(vervarValue: number | string, varValue: number | string, turvarValue: number | string, tahunValue: number | string, turtahunValue: number | string): unknown;
1128
1167
  }
1129
1168
 
1130
1169
  interface DynamicTableRepository {
1131
- getAll(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1170
+ getAll(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1132
1171
  }
1133
1172
 
1134
- declare class GetAllDynamicTables implements UseCase<DynamicTableParams, ListResult<DynamicTable>> {
1173
+ declare class GetAllDynamicTables implements UseCase<DynamicTableParams, DynamicTable> {
1135
1174
  private repository;
1136
1175
  constructor(repository: DynamicTableRepository);
1137
- execute(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1176
+ execute(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1138
1177
  }
1139
1178
 
1140
1179
  interface StadataList {
@@ -1171,7 +1210,7 @@ interface StadataList {
1171
1210
  censusAreaId: string;
1172
1211
  datasetId: string;
1173
1212
  }): Promise<Result<ListResult<CensusData>, ApiFailure>>;
1174
- dynamicTables(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1213
+ dynamicTables(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1175
1214
  }
1176
1215
 
1177
1216
  interface StadataView {
package/dist/index.d.ts CHANGED
@@ -365,10 +365,10 @@ interface DerivedVariableListParams extends BaseListParams {
365
365
  variableId?: number;
366
366
  }
367
367
  interface DynamicTableParams extends BaseListParams {
368
- tableId: string;
369
368
  variableId: number;
370
- periodId?: number;
369
+ periodId: number | string;
371
370
  derivedVariableId?: number;
371
+ verticalVariableId?: number;
372
372
  derivedPeriodId?: number;
373
373
  }
374
374
  interface StatisticClassificationListParams extends BaseListParams {
@@ -1109,32 +1109,71 @@ declare class GetCensusById implements UseCase<ViewParams, CensusEvent> {
1109
1109
  execute(params: ViewParams): Promise<Result<CensusEvent, ApiFailure>>;
1110
1110
  }
1111
1111
 
1112
- declare class DynamicTable extends BaseEntity {
1113
- readonly variableId: number;
1114
- readonly title: string;
1115
- readonly subjectId: number;
1116
- readonly subjectName: string;
1117
- readonly notes: string;
1112
+ declare class VariableInfo extends BaseEntity {
1113
+ readonly value: number;
1114
+ readonly label: string;
1118
1115
  readonly unit: string;
1119
- readonly verticalVariableId: number;
1120
- readonly domain: string;
1121
- readonly csaSubjectId?: number | undefined;
1122
- readonly csaSubjectName?: string | undefined;
1123
- readonly graphId?: number | undefined;
1124
- readonly graphName?: string | undefined;
1125
- constructor(variableId: number, title: string, subjectId: number, subjectName: string, notes: string, unit: string, verticalVariableId: number, domain: string, csaSubjectId?: number | undefined, csaSubjectName?: string | undefined, graphId?: number | undefined, graphName?: string | undefined);
1116
+ readonly subject: string;
1117
+ readonly definition: string;
1118
+ readonly notes: string;
1119
+ readonly decimal?: number | undefined;
1120
+ constructor(value: number, label: string, unit: string, subject: string, definition: string, notes: string, decimal?: number | undefined);
1121
+ toJson(): Record<string, unknown>;
1122
+ static fromJson(json: Record<string, unknown>): VariableInfo;
1123
+ }
1124
+ declare class VerticalVariableInfo extends BaseEntity {
1125
+ readonly value: number | string;
1126
+ readonly label: string;
1127
+ constructor(value: number | string, label: string);
1128
+ toJson(): Record<string, unknown>;
1129
+ static fromJson(json: Record<string, unknown>): VerticalVariableInfo;
1130
+ }
1131
+ declare class PeriodInfo extends VerticalVariableInfo {
1132
+ static fromJson(json: Record<string, unknown>): PeriodInfo;
1133
+ }
1134
+ declare class SubjectInfo extends BaseEntity {
1135
+ readonly value: number;
1136
+ readonly label: string;
1137
+ constructor(value: number, label: string);
1138
+ toJson(): Record<string, unknown>;
1139
+ static fromJson(json: Record<string, unknown>): SubjectInfo;
1140
+ }
1141
+ declare class RelatedTable extends BaseEntity {
1142
+ readonly id: string;
1143
+ readonly title: string;
1144
+ readonly tableSource: number;
1145
+ readonly lastUpdate: string | null;
1146
+ readonly link: string;
1147
+ constructor(id: string, title: string, tableSource: number, lastUpdate: string | null, link: string);
1148
+ toJson(): Record<string, unknown>;
1149
+ static fromJson(json: Record<string, unknown>): RelatedTable;
1150
+ }
1151
+
1152
+ declare class DynamicTable extends BaseEntity {
1153
+ readonly subjects: SubjectInfo[];
1154
+ readonly variables: VariableInfo[];
1155
+ readonly verticalVariables: VerticalVariableInfo[];
1156
+ readonly verticalVariableLabel: string;
1157
+ readonly periods: PeriodInfo[];
1158
+ readonly derivedVariables: VerticalVariableInfo[];
1159
+ readonly derivedPeriods: VerticalVariableInfo[];
1160
+ readonly dataContent: Record<string, unknown>;
1161
+ readonly related: RelatedTable[];
1162
+ readonly lastUpdate?: string | null | undefined;
1163
+ constructor(subjects: SubjectInfo[], variables: VariableInfo[], verticalVariables: VerticalVariableInfo[], verticalVariableLabel: string, periods: PeriodInfo[], derivedVariables: VerticalVariableInfo[], derivedPeriods: VerticalVariableInfo[], dataContent: Record<string, unknown>, related: RelatedTable[], lastUpdate?: string | null | undefined);
1126
1164
  toJson(): Record<string, unknown>;
1127
1165
  static fromJson(json: Record<string, unknown>): DynamicTable;
1166
+ getDataValue(vervarValue: number | string, varValue: number | string, turvarValue: number | string, tahunValue: number | string, turtahunValue: number | string): unknown;
1128
1167
  }
1129
1168
 
1130
1169
  interface DynamicTableRepository {
1131
- getAll(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1170
+ getAll(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1132
1171
  }
1133
1172
 
1134
- declare class GetAllDynamicTables implements UseCase<DynamicTableParams, ListResult<DynamicTable>> {
1173
+ declare class GetAllDynamicTables implements UseCase<DynamicTableParams, DynamicTable> {
1135
1174
  private repository;
1136
1175
  constructor(repository: DynamicTableRepository);
1137
- execute(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1176
+ execute(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1138
1177
  }
1139
1178
 
1140
1179
  interface StadataList {
@@ -1171,7 +1210,7 @@ interface StadataList {
1171
1210
  censusAreaId: string;
1172
1211
  datasetId: string;
1173
1212
  }): Promise<Result<ListResult<CensusData>, ApiFailure>>;
1174
- dynamicTables(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1213
+ dynamicTables(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1175
1214
  }
1176
1215
 
1177
1216
  interface StadataView {