stadata-js 0.1.2 → 0.3.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,11 +365,11 @@ 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: string;
371
370
  derivedVariableId?: number;
372
- derivedPeriodId?: number;
371
+ verticalVariableId?: number;
372
+ derivedPeriodId?: string;
373
373
  }
374
374
  interface StatisticClassificationListParams extends BaseListParams {
375
375
  type?: ClassificationType;
@@ -750,7 +750,8 @@ declare class Subject extends BaseEntity {
750
750
  readonly id: number;
751
751
  readonly name: string;
752
752
  readonly categoryId: number;
753
- constructor(id: number, name: string, categoryId: number);
753
+ readonly category: string;
754
+ constructor(id: number, name: string, categoryId: number, category: string);
754
755
  toJson(): Record<string, unknown>;
755
756
  static fromJson(json: Record<string, unknown>): Subject;
756
757
  }
@@ -1109,32 +1110,98 @@ declare class GetCensusById implements UseCase<ViewParams, CensusEvent> {
1109
1110
  execute(params: ViewParams): Promise<Result<CensusEvent, ApiFailure>>;
1110
1111
  }
1111
1112
 
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;
1113
+ declare class VariableInfo extends BaseEntity {
1114
+ readonly value: number;
1115
+ readonly label: string;
1118
1116
  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);
1117
+ readonly subject: string;
1118
+ readonly definition: string;
1119
+ readonly notes: string;
1120
+ readonly decimal?: number | undefined;
1121
+ constructor(value: number, label: string, unit: string, subject: string, definition: string, notes: string, decimal?: number | undefined);
1122
+ toJson(): Record<string, unknown>;
1123
+ static fromJson(json: Record<string, unknown>): VariableInfo;
1124
+ }
1125
+ declare class VerticalVariableInfo extends BaseEntity {
1126
+ readonly value: number | string;
1127
+ readonly label: string;
1128
+ constructor(value: number | string, label: string);
1129
+ toJson(): Record<string, unknown>;
1130
+ static fromJson(json: Record<string, unknown>): VerticalVariableInfo;
1131
+ }
1132
+ declare class PeriodInfo extends VerticalVariableInfo {
1133
+ static fromJson(json: Record<string, unknown>): PeriodInfo;
1134
+ }
1135
+ declare class SubjectInfo extends BaseEntity {
1136
+ readonly value: number;
1137
+ readonly label: string;
1138
+ constructor(value: number, label: string);
1139
+ toJson(): Record<string, unknown>;
1140
+ static fromJson(json: Record<string, unknown>): SubjectInfo;
1141
+ }
1142
+ declare class RelatedTable extends BaseEntity {
1143
+ readonly id: string;
1144
+ readonly title: string;
1145
+ readonly tableSource: number;
1146
+ readonly lastUpdate: string | null;
1147
+ readonly link: string;
1148
+ constructor(id: string, title: string, tableSource: number, lastUpdate: string | null, link: string);
1149
+ toJson(): Record<string, unknown>;
1150
+ static fromJson(json: Record<string, unknown>): RelatedTable;
1151
+ }
1152
+
1153
+ declare class DynamicTable extends BaseEntity {
1154
+ readonly subjects: SubjectInfo[];
1155
+ readonly variables: VariableInfo[];
1156
+ readonly verticalVariables: VerticalVariableInfo[];
1157
+ readonly verticalVariableLabel: string;
1158
+ readonly periods: PeriodInfo[];
1159
+ readonly derivedVariables: VerticalVariableInfo[];
1160
+ readonly derivedPeriods: VerticalVariableInfo[];
1161
+ readonly dataContent: Record<string, unknown>;
1162
+ readonly related: RelatedTable[];
1163
+ readonly lastUpdate?: string | null | undefined;
1164
+ 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
1165
  toJson(): Record<string, unknown>;
1127
1166
  static fromJson(json: Record<string, unknown>): DynamicTable;
1167
+ getDataValue(vervarValue: number | string, varValue: number | string, turvarValue: number | string, tahunValue: number | string, turtahunValue: number | string): unknown;
1168
+ toStructuredData(): {
1169
+ subject_id: number;
1170
+ subject_label: string;
1171
+ variable_id: number;
1172
+ variable_label: string;
1173
+ variable_unit: string;
1174
+ vertical_variable_label: string;
1175
+ last_update: string | null | undefined;
1176
+ data: Array<{
1177
+ id: number | string;
1178
+ label: string;
1179
+ data: Array<{
1180
+ id: number | string;
1181
+ label: string;
1182
+ data: Array<{
1183
+ id: number | string;
1184
+ label: string;
1185
+ value?: unknown;
1186
+ data?: Array<{
1187
+ id: number | string;
1188
+ label: string;
1189
+ value: unknown;
1190
+ }>;
1191
+ }>;
1192
+ }>;
1193
+ }>;
1194
+ };
1128
1195
  }
1129
1196
 
1130
1197
  interface DynamicTableRepository {
1131
- getAll(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1198
+ getAll(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1132
1199
  }
1133
1200
 
1134
- declare class GetAllDynamicTables implements UseCase<DynamicTableParams, ListResult<DynamicTable>> {
1201
+ declare class GetAllDynamicTables implements UseCase<DynamicTableParams, DynamicTable> {
1135
1202
  private repository;
1136
1203
  constructor(repository: DynamicTableRepository);
1137
- execute(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1204
+ execute(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1138
1205
  }
1139
1206
 
1140
1207
  interface StadataList {
@@ -1171,7 +1238,7 @@ interface StadataList {
1171
1238
  censusAreaId: string;
1172
1239
  datasetId: string;
1173
1240
  }): Promise<Result<ListResult<CensusData>, ApiFailure>>;
1174
- dynamicTables(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1241
+ dynamicTables(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1175
1242
  }
1176
1243
 
1177
1244
  interface StadataView {
package/dist/index.d.ts CHANGED
@@ -365,11 +365,11 @@ 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: string;
371
370
  derivedVariableId?: number;
372
- derivedPeriodId?: number;
371
+ verticalVariableId?: number;
372
+ derivedPeriodId?: string;
373
373
  }
374
374
  interface StatisticClassificationListParams extends BaseListParams {
375
375
  type?: ClassificationType;
@@ -750,7 +750,8 @@ declare class Subject extends BaseEntity {
750
750
  readonly id: number;
751
751
  readonly name: string;
752
752
  readonly categoryId: number;
753
- constructor(id: number, name: string, categoryId: number);
753
+ readonly category: string;
754
+ constructor(id: number, name: string, categoryId: number, category: string);
754
755
  toJson(): Record<string, unknown>;
755
756
  static fromJson(json: Record<string, unknown>): Subject;
756
757
  }
@@ -1109,32 +1110,98 @@ declare class GetCensusById implements UseCase<ViewParams, CensusEvent> {
1109
1110
  execute(params: ViewParams): Promise<Result<CensusEvent, ApiFailure>>;
1110
1111
  }
1111
1112
 
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;
1113
+ declare class VariableInfo extends BaseEntity {
1114
+ readonly value: number;
1115
+ readonly label: string;
1118
1116
  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);
1117
+ readonly subject: string;
1118
+ readonly definition: string;
1119
+ readonly notes: string;
1120
+ readonly decimal?: number | undefined;
1121
+ constructor(value: number, label: string, unit: string, subject: string, definition: string, notes: string, decimal?: number | undefined);
1122
+ toJson(): Record<string, unknown>;
1123
+ static fromJson(json: Record<string, unknown>): VariableInfo;
1124
+ }
1125
+ declare class VerticalVariableInfo extends BaseEntity {
1126
+ readonly value: number | string;
1127
+ readonly label: string;
1128
+ constructor(value: number | string, label: string);
1129
+ toJson(): Record<string, unknown>;
1130
+ static fromJson(json: Record<string, unknown>): VerticalVariableInfo;
1131
+ }
1132
+ declare class PeriodInfo extends VerticalVariableInfo {
1133
+ static fromJson(json: Record<string, unknown>): PeriodInfo;
1134
+ }
1135
+ declare class SubjectInfo extends BaseEntity {
1136
+ readonly value: number;
1137
+ readonly label: string;
1138
+ constructor(value: number, label: string);
1139
+ toJson(): Record<string, unknown>;
1140
+ static fromJson(json: Record<string, unknown>): SubjectInfo;
1141
+ }
1142
+ declare class RelatedTable extends BaseEntity {
1143
+ readonly id: string;
1144
+ readonly title: string;
1145
+ readonly tableSource: number;
1146
+ readonly lastUpdate: string | null;
1147
+ readonly link: string;
1148
+ constructor(id: string, title: string, tableSource: number, lastUpdate: string | null, link: string);
1149
+ toJson(): Record<string, unknown>;
1150
+ static fromJson(json: Record<string, unknown>): RelatedTable;
1151
+ }
1152
+
1153
+ declare class DynamicTable extends BaseEntity {
1154
+ readonly subjects: SubjectInfo[];
1155
+ readonly variables: VariableInfo[];
1156
+ readonly verticalVariables: VerticalVariableInfo[];
1157
+ readonly verticalVariableLabel: string;
1158
+ readonly periods: PeriodInfo[];
1159
+ readonly derivedVariables: VerticalVariableInfo[];
1160
+ readonly derivedPeriods: VerticalVariableInfo[];
1161
+ readonly dataContent: Record<string, unknown>;
1162
+ readonly related: RelatedTable[];
1163
+ readonly lastUpdate?: string | null | undefined;
1164
+ 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
1165
  toJson(): Record<string, unknown>;
1127
1166
  static fromJson(json: Record<string, unknown>): DynamicTable;
1167
+ getDataValue(vervarValue: number | string, varValue: number | string, turvarValue: number | string, tahunValue: number | string, turtahunValue: number | string): unknown;
1168
+ toStructuredData(): {
1169
+ subject_id: number;
1170
+ subject_label: string;
1171
+ variable_id: number;
1172
+ variable_label: string;
1173
+ variable_unit: string;
1174
+ vertical_variable_label: string;
1175
+ last_update: string | null | undefined;
1176
+ data: Array<{
1177
+ id: number | string;
1178
+ label: string;
1179
+ data: Array<{
1180
+ id: number | string;
1181
+ label: string;
1182
+ data: Array<{
1183
+ id: number | string;
1184
+ label: string;
1185
+ value?: unknown;
1186
+ data?: Array<{
1187
+ id: number | string;
1188
+ label: string;
1189
+ value: unknown;
1190
+ }>;
1191
+ }>;
1192
+ }>;
1193
+ }>;
1194
+ };
1128
1195
  }
1129
1196
 
1130
1197
  interface DynamicTableRepository {
1131
- getAll(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1198
+ getAll(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1132
1199
  }
1133
1200
 
1134
- declare class GetAllDynamicTables implements UseCase<DynamicTableParams, ListResult<DynamicTable>> {
1201
+ declare class GetAllDynamicTables implements UseCase<DynamicTableParams, DynamicTable> {
1135
1202
  private repository;
1136
1203
  constructor(repository: DynamicTableRepository);
1137
- execute(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1204
+ execute(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1138
1205
  }
1139
1206
 
1140
1207
  interface StadataList {
@@ -1171,7 +1238,7 @@ interface StadataList {
1171
1238
  censusAreaId: string;
1172
1239
  datasetId: string;
1173
1240
  }): Promise<Result<ListResult<CensusData>, ApiFailure>>;
1174
- dynamicTables(params: DynamicTableParams): Promise<Result<ListResult<DynamicTable>, ApiFailure>>;
1241
+ dynamicTables(params: DynamicTableParams): Promise<Result<DynamicTable, ApiFailure>>;
1175
1242
  }
1176
1243
 
1177
1244
  interface StadataView {