@kwiz/node 1.0.21 → 1.0.22

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.
@@ -3,7 +3,7 @@ import { IOdataFilterStatement } from "./odata";
3
3
  export declare function ConfigureTableStorage(config: {
4
4
  connectionString: string;
5
5
  }): void;
6
- type operationResult<T = never> = {
6
+ export type TableOperationResult<T = never> = {
7
7
  success: true;
8
8
  result?: T;
9
9
  errorCode?: string;
@@ -26,19 +26,19 @@ type TableEntityBase = {
26
26
  export type TableEntityType<DataType extends TableEntityBase> = {
27
27
  [P in keyof DataType]: string | boolean | Date | number;
28
28
  };
29
- export declare function findTable(tableName: string): Promise<operationResult>;
29
+ export declare function findTable(tableName: string): Promise<TableOperationResult>;
30
30
  export declare function listTables(): Promise<string[]>;
31
- export declare function ensureTable(tableName: string): Promise<operationResult>;
32
- export declare function deleteTable(tableName: string): Promise<operationResult>;
31
+ export declare function ensureTable(tableName: string): Promise<TableOperationResult>;
32
+ export declare function deleteTable(tableName: string): Promise<TableOperationResult>;
33
33
  export declare function getItems<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, options?: {
34
34
  filterStatment?: IOdataFilterStatement<DataType>;
35
35
  postFilter?: (item: DataType) => boolean;
36
- }): Promise<operationResult<DataType[]>>;
37
- export declare function addItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType): Promise<operationResult>;
38
- export declare function deleteItem(tableName: string, partitionKey: string, rowKey: string): Promise<operationResult>;
36
+ }): Promise<TableOperationResult<DataType[]>>;
37
+ export declare function addItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType): Promise<TableOperationResult>;
38
+ export declare function deleteItem(tableName: string, partitionKey: string, rowKey: string): Promise<TableOperationResult>;
39
39
  export declare function upsertItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType, options?: {
40
40
  mode?: UpdateMode;
41
- }): Promise<operationResult>;
41
+ }): Promise<TableOperationResult>;
42
42
  export declare class Table<KeysType extends TableEntityBase, GetKeysParam, SavedRow extends KeysType & TableEntityType<SavedRow>, ParsedRow = SavedRow> {
43
43
  private tableName;
44
44
  private transform;
@@ -51,8 +51,8 @@ export declare class Table<KeysType extends TableEntityBase, GetKeysParam, Saved
51
51
  load: (saved: SavedRow, table: Table<KeysType, GetKeysParam, SavedRow, ParsedRow>) => ParsedRow;
52
52
  };
53
53
  });
54
- delete(): Promise<operationResult<never>>;
55
- ensure(): Promise<operationResult<never>>;
54
+ delete(): Promise<TableOperationResult<never>>;
55
+ ensure(): Promise<TableOperationResult<never>>;
56
56
  getItems(options?: {
57
57
  filterStatment?: IOdataFilterStatement<SavedRow>;
58
58
  postFilter?: (item: SavedRow) => boolean;
@@ -65,11 +65,11 @@ export declare class Table<KeysType extends TableEntityBase, GetKeysParam, Saved
65
65
  success: false;
66
66
  errorCode: string;
67
67
  }>;
68
- addItem(item: ParsedRow): Promise<operationResult<never>>;
68
+ addItem(item: ParsedRow): Promise<TableOperationResult<never>>;
69
69
  upsertItem(item: ParsedRow, options?: {
70
70
  mode?: UpdateMode;
71
- }): Promise<operationResult<never>>;
72
- deleteItemByKey(param: GetKeysParam): Promise<operationResult<never>>;
73
- deleteItem(item: KeysType): Promise<operationResult<never>>;
71
+ }): Promise<TableOperationResult<never>>;
72
+ deleteItemByKey(param: GetKeysParam): Promise<TableOperationResult<never>>;
73
+ deleteItem(item: KeysType): Promise<TableOperationResult<never>>;
74
74
  }
75
75
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kwiz/node",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "KWIZ utilities and helpers for node applications",
5
5
  "module": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -31,7 +31,7 @@ interface IODataError {
31
31
  }
32
32
  }
33
33
  }
34
- type operationResult<T = never> = { success: true; result?: T; errorCode?: string; } | { success: false; result?: T; errorCode: string; };
34
+ export type TableOperationResult<T = never> = { success: true; result?: T; errorCode?: string; } | { success: false; result?: T; errorCode: string; };
35
35
 
36
36
  type TableEntityBase = {
37
37
  /**
@@ -49,7 +49,7 @@ export type TableEntityType<DataType extends TableEntityBase> = {
49
49
  [P in keyof DataType]: string | boolean | Date | number;
50
50
  };
51
51
 
52
- export async function findTable(tableName: string): Promise<operationResult> {
52
+ export async function findTable(tableName: string): Promise<TableOperationResult> {
53
53
  const tableService = getTableService();
54
54
 
55
55
  let success = false;
@@ -105,7 +105,7 @@ export async function listTables() {
105
105
  // return success;
106
106
  // }
107
107
 
108
- export async function ensureTable(tableName: string): Promise<operationResult> {
108
+ export async function ensureTable(tableName: string): Promise<TableOperationResult> {
109
109
  const table = getTableClient(tableName);
110
110
  let success = false;
111
111
  let errorCode: string;
@@ -127,7 +127,7 @@ export async function ensureTable(tableName: string): Promise<operationResult> {
127
127
  return { success, errorCode };
128
128
  }
129
129
 
130
- export async function deleteTable(tableName: string): Promise<operationResult> {
130
+ export async function deleteTable(tableName: string): Promise<TableOperationResult> {
131
131
  const table = getTableClient(tableName);
132
132
  let success = false;
133
133
  let errorCode: string;
@@ -153,7 +153,7 @@ export async function deleteTable(tableName: string): Promise<operationResult> {
153
153
  export async function getItems<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, options?: {
154
154
  filterStatment?: IOdataFilterStatement<DataType>;
155
155
  postFilter?: (item: DataType) => boolean;
156
- }): Promise<operationResult<DataType[]>> {
156
+ }): Promise<TableOperationResult<DataType[]>> {
157
157
  const table = getTableClient(tableName);
158
158
  let success = true;
159
159
  let errorCode: string;
@@ -185,7 +185,7 @@ export async function getItems<DataType extends TableEntityBase & TableEntityTyp
185
185
  return { success, errorCode, result };
186
186
  }
187
187
 
188
- export async function addItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType): Promise<operationResult> {
188
+ export async function addItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType): Promise<TableOperationResult> {
189
189
  const table = getTableClient(tableName);
190
190
  let success = false;
191
191
  let errorCode: string;
@@ -206,7 +206,7 @@ export async function addItem<DataType extends TableEntityBase & TableEntityType
206
206
  return { success, errorCode };
207
207
  }
208
208
 
209
- export async function deleteItem(tableName: string, partitionKey: string, rowKey: string): Promise<operationResult> {
209
+ export async function deleteItem(tableName: string, partitionKey: string, rowKey: string): Promise<TableOperationResult> {
210
210
  const table = getTableClient(tableName);
211
211
  let success = false;
212
212
  let errorCode: string;
@@ -233,7 +233,7 @@ export async function deleteItem(tableName: string, partitionKey: string, rowKey
233
233
 
234
234
  export async function upsertItem<DataType extends TableEntityBase & TableEntityType<DataType>>(tableName: string, item: DataType, options?: {
235
235
  mode?: UpdateMode
236
- }): Promise<operationResult> {
236
+ }): Promise<TableOperationResult> {
237
237
  const table = getTableClient(tableName);
238
238
  let success = false;
239
239
  let errorCode: string;