@keboola/api-fixtures 0.1.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/README.md +43 -0
- package/dist/index.cjs +111 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +292 -0
- package/dist/index.d.ts +292 -0
- package/dist/index.js +106 -0
- package/dist/index.js.map +1 -0
- package/package.json +79 -0
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# @keboola/api-fixtures
|
|
2
|
+
|
|
3
|
+
Typed test fixtures keyed by Keboola API endpoint. Use them in stories, unit
|
|
4
|
+
tests, and MSW handlers instead of hand-writing response shapes — the fixtures
|
|
5
|
+
are typed by `@keboola/api-client`, so they stay in sync with the SDK.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install --save-dev @keboola/api-fixtures
|
|
11
|
+
# or
|
|
12
|
+
yarn add --dev @keboola/api-fixtures
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`@keboola/api-client` is a peer dependency (the fixtures re-export its endpoint
|
|
16
|
+
types). Install it alongside if you haven't already.
|
|
17
|
+
|
|
18
|
+
## Usage
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { fixtures } from '@keboola/api-fixtures';
|
|
22
|
+
|
|
23
|
+
const table = fixtures.storage.tables.getTable();
|
|
24
|
+
const tables = fixtures.storage.tables.listTables();
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Per-endpoint helpers and types are also exported directly:
|
|
28
|
+
|
|
29
|
+
```ts
|
|
30
|
+
import { getTable, listTables, tableFixtures } from '@keboola/api-fixtures';
|
|
31
|
+
import type { Table, TableDetail } from '@keboola/api-fixtures';
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### With MSW
|
|
35
|
+
|
|
36
|
+
```ts
|
|
37
|
+
import { http, HttpResponse } from 'msw';
|
|
38
|
+
import { fixtures } from '@keboola/api-fixtures';
|
|
39
|
+
|
|
40
|
+
export const handlers = [
|
|
41
|
+
http.get('*/v2/storage/tables/:id', () => HttpResponse.json(fixtures.storage.tables.getTable())),
|
|
42
|
+
];
|
|
43
|
+
```
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
// src/clients/storage/tables.ts
|
|
4
|
+
var bucket = {
|
|
5
|
+
id: "in.c-main",
|
|
6
|
+
name: "c-main",
|
|
7
|
+
displayName: "Main",
|
|
8
|
+
stage: "in",
|
|
9
|
+
description: "Main input bucket",
|
|
10
|
+
created: "2024-01-15T10:00:00+0100",
|
|
11
|
+
lastChangeDate: "2024-03-10T08:30:00+0100",
|
|
12
|
+
isMaintenance: false,
|
|
13
|
+
isReadOnly: false,
|
|
14
|
+
isSnowflakeSharedDatabase: false,
|
|
15
|
+
hasExternalSchema: false,
|
|
16
|
+
rowsCount: 15e4,
|
|
17
|
+
dataSizeBytes: 52428800,
|
|
18
|
+
uri: "https://connection.keboola.com/v2/storage/buckets/in.c-main",
|
|
19
|
+
backend: "snowflake",
|
|
20
|
+
backendPath: [],
|
|
21
|
+
databaseName: null,
|
|
22
|
+
color: null,
|
|
23
|
+
idBranch: 0,
|
|
24
|
+
owner: null,
|
|
25
|
+
sharing: null,
|
|
26
|
+
path: "in.c-main",
|
|
27
|
+
tables: "https://connection.keboola.com/v2/storage/buckets/in.c-main/tables",
|
|
28
|
+
updated: "2024-03-10T08:30:00+0100"
|
|
29
|
+
};
|
|
30
|
+
var freshTable = {
|
|
31
|
+
id: "in.c-main.users",
|
|
32
|
+
name: "users",
|
|
33
|
+
displayName: "Users",
|
|
34
|
+
primaryKey: ["id"],
|
|
35
|
+
metadata: [],
|
|
36
|
+
columns: ["id", "email", "name", "created_at"],
|
|
37
|
+
columnMetadata: {},
|
|
38
|
+
attributes: [],
|
|
39
|
+
bucket,
|
|
40
|
+
isTyped: false,
|
|
41
|
+
isAlias: false
|
|
42
|
+
};
|
|
43
|
+
var recentlyUpdatedTable = {
|
|
44
|
+
id: "in.c-main.orders",
|
|
45
|
+
name: "orders",
|
|
46
|
+
displayName: "Orders",
|
|
47
|
+
primaryKey: ["order_id"],
|
|
48
|
+
metadata: [
|
|
49
|
+
{
|
|
50
|
+
id: "mt1",
|
|
51
|
+
key: "KBC.createdBy.component.id",
|
|
52
|
+
value: "keboola.python-transformation",
|
|
53
|
+
provider: "keboola",
|
|
54
|
+
timestamp: "2024-06-01T09:00:00+0200"
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
columns: ["order_id", "user_id", "total", "status", "created_at", "updated_at"],
|
|
58
|
+
columnMetadata: {
|
|
59
|
+
order_id: [
|
|
60
|
+
{
|
|
61
|
+
id: "m1",
|
|
62
|
+
key: "KBC.datatype.type",
|
|
63
|
+
value: "INTEGER",
|
|
64
|
+
provider: "keboola",
|
|
65
|
+
timestamp: "2024-06-01T09:00:00+0200"
|
|
66
|
+
}
|
|
67
|
+
]
|
|
68
|
+
},
|
|
69
|
+
attributes: [],
|
|
70
|
+
bucket,
|
|
71
|
+
isTyped: false,
|
|
72
|
+
isAlias: false
|
|
73
|
+
};
|
|
74
|
+
var largeTable = {
|
|
75
|
+
id: "in.c-main.events",
|
|
76
|
+
name: "events",
|
|
77
|
+
displayName: "Events",
|
|
78
|
+
primaryKey: [],
|
|
79
|
+
metadata: [],
|
|
80
|
+
columns: ["event_id", "user_id", "event_type", "properties", "occurred_at"],
|
|
81
|
+
columnMetadata: {},
|
|
82
|
+
attributes: [],
|
|
83
|
+
bucket,
|
|
84
|
+
isTyped: false,
|
|
85
|
+
isAlias: false
|
|
86
|
+
};
|
|
87
|
+
var getTable = () => freshTable;
|
|
88
|
+
var listTables = () => [freshTable, recentlyUpdatedTable, largeTable];
|
|
89
|
+
var tableFixtures = {
|
|
90
|
+
fresh: freshTable,
|
|
91
|
+
recentlyUpdated: recentlyUpdatedTable,
|
|
92
|
+
large: largeTable
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// src/fixtures.ts
|
|
96
|
+
var fixtures = {
|
|
97
|
+
storage: {
|
|
98
|
+
tables: {
|
|
99
|
+
getTable,
|
|
100
|
+
listTables,
|
|
101
|
+
fixtures: tableFixtures
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
exports.fixtures = fixtures;
|
|
107
|
+
exports.getTable = getTable;
|
|
108
|
+
exports.listTables = listTables;
|
|
109
|
+
exports.tableFixtures = tableFixtures;
|
|
110
|
+
//# sourceMappingURL=index.cjs.map
|
|
111
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/clients/storage/tables.ts","../src/fixtures.ts"],"names":[],"mappings":"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","file":"index.cjs","sourcesContent":["import type { Table, TableDetail } from '@keboola/api-client/storage/types';\n\nconst bucket = {\n id: 'in.c-main',\n name: 'c-main',\n displayName: 'Main',\n stage: 'in' as const,\n description: 'Main input bucket',\n created: '2024-01-15T10:00:00+0100',\n lastChangeDate: '2024-03-10T08:30:00+0100',\n isMaintenance: false,\n isReadOnly: false,\n isSnowflakeSharedDatabase: false,\n hasExternalSchema: false,\n rowsCount: 150000,\n dataSizeBytes: 52428800,\n uri: 'https://connection.keboola.com/v2/storage/buckets/in.c-main',\n backend: 'snowflake' as const,\n backendPath: [],\n databaseName: null,\n color: null,\n idBranch: 0,\n owner: null,\n sharing: null,\n path: 'in.c-main',\n tables: 'https://connection.keboola.com/v2/storage/buckets/in.c-main/tables',\n updated: '2024-03-10T08:30:00+0100',\n};\n\n// A freshly created table with no imports yet (non-typed, non-alias variant).\nconst freshTable = {\n id: 'in.c-main.users',\n name: 'users',\n displayName: 'Users',\n primaryKey: ['id'],\n metadata: [],\n columns: ['id', 'email', 'name', 'created_at'],\n columnMetadata: {},\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n// A recently updated table with a moderate size (non-typed, non-alias variant).\nconst recentlyUpdatedTable = {\n id: 'in.c-main.orders',\n name: 'orders',\n displayName: 'Orders',\n primaryKey: ['order_id'],\n metadata: [\n {\n id: 'mt1',\n key: 'KBC.createdBy.component.id',\n value: 'keboola.python-transformation',\n provider: 'keboola',\n timestamp: '2024-06-01T09:00:00+0200',\n },\n ],\n columns: ['order_id', 'user_id', 'total', 'status', 'created_at', 'updated_at'],\n columnMetadata: {\n order_id: [\n {\n id: 'm1',\n key: 'KBC.datatype.type',\n value: 'INTEGER',\n provider: 'keboola',\n timestamp: '2024-06-01T09:00:00+0200',\n },\n ],\n },\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n// A large table with many rows representing high-volume data (non-typed, non-alias variant).\nconst largeTable = {\n id: 'in.c-main.events',\n name: 'events',\n displayName: 'Events',\n primaryKey: [],\n metadata: [],\n columns: ['event_id', 'user_id', 'event_type', 'properties', 'occurred_at'],\n columnMetadata: {},\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n/**\n * Returns a single realistic typed TableDetail (fresh, no imports yet).\n *\n * The explicit return type ensures any divergence from the OpenAPI-derived\n * `TableDetail` in `@keboola/api-client` surfaces as a TypeScript error.\n */\nexport const getTable = (): TableDetail => freshTable;\n\n/**\n * Returns three TableDetail objects representing different lifecycle states:\n * 1. Fresh — just created, no data imported.\n * 2. Recently updated — moderate size, recent import.\n * 3. Large — high row count, large byte size.\n */\nexport const listTables = (): TableDetail[] => [freshTable, recentlyUpdatedTable, largeTable];\n\n/**\n * Named fixtures for targeted access in tests.\n */\nexport const tableFixtures = {\n fresh: freshTable,\n recentlyUpdated: recentlyUpdatedTable,\n large: largeTable,\n} satisfies Record<'fresh' | 'recentlyUpdated' | 'large', TableDetail>;\n\nexport type { Table, TableDetail };\n","import { getTable, listTables, tableFixtures } from './clients/storage/tables';\n\nexport const fixtures = {\n storage: {\n tables: {\n getTable,\n listTables,\n fixtures: tableFixtures,\n },\n },\n};\n"]}
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import * as _keboola_api_client_storage_types from '@keboola/api-client/storage/types';
|
|
2
|
+
import { TableDetail } from '@keboola/api-client/storage/types';
|
|
3
|
+
export { Table, TableDetail } from '@keboola/api-client/storage/types';
|
|
4
|
+
|
|
5
|
+
declare const fixtures: {
|
|
6
|
+
storage: {
|
|
7
|
+
tables: {
|
|
8
|
+
getTable: () => _keboola_api_client_storage_types.TableDetail;
|
|
9
|
+
listTables: () => _keboola_api_client_storage_types.TableDetail[];
|
|
10
|
+
fixtures: {
|
|
11
|
+
fresh: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
primaryKey: string[];
|
|
16
|
+
metadata: never[];
|
|
17
|
+
columns: string[];
|
|
18
|
+
columnMetadata: {};
|
|
19
|
+
attributes: never[];
|
|
20
|
+
bucket: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
stage: "in";
|
|
25
|
+
description: string;
|
|
26
|
+
created: string;
|
|
27
|
+
lastChangeDate: string;
|
|
28
|
+
isMaintenance: boolean;
|
|
29
|
+
isReadOnly: boolean;
|
|
30
|
+
isSnowflakeSharedDatabase: boolean;
|
|
31
|
+
hasExternalSchema: boolean;
|
|
32
|
+
rowsCount: number;
|
|
33
|
+
dataSizeBytes: number;
|
|
34
|
+
uri: string;
|
|
35
|
+
backend: "snowflake";
|
|
36
|
+
backendPath: never[];
|
|
37
|
+
databaseName: null;
|
|
38
|
+
color: null;
|
|
39
|
+
idBranch: number;
|
|
40
|
+
owner: null;
|
|
41
|
+
sharing: null;
|
|
42
|
+
path: string;
|
|
43
|
+
tables: string;
|
|
44
|
+
updated: string;
|
|
45
|
+
};
|
|
46
|
+
isTyped: false;
|
|
47
|
+
isAlias: false;
|
|
48
|
+
};
|
|
49
|
+
recentlyUpdated: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
primaryKey: string[];
|
|
54
|
+
metadata: {
|
|
55
|
+
id: string;
|
|
56
|
+
key: string;
|
|
57
|
+
value: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
}[];
|
|
61
|
+
columns: string[];
|
|
62
|
+
columnMetadata: {
|
|
63
|
+
order_id: {
|
|
64
|
+
id: string;
|
|
65
|
+
key: string;
|
|
66
|
+
value: string;
|
|
67
|
+
provider: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
attributes: never[];
|
|
72
|
+
bucket: {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
displayName: string;
|
|
76
|
+
stage: "in";
|
|
77
|
+
description: string;
|
|
78
|
+
created: string;
|
|
79
|
+
lastChangeDate: string;
|
|
80
|
+
isMaintenance: boolean;
|
|
81
|
+
isReadOnly: boolean;
|
|
82
|
+
isSnowflakeSharedDatabase: boolean;
|
|
83
|
+
hasExternalSchema: boolean;
|
|
84
|
+
rowsCount: number;
|
|
85
|
+
dataSizeBytes: number;
|
|
86
|
+
uri: string;
|
|
87
|
+
backend: "snowflake";
|
|
88
|
+
backendPath: never[];
|
|
89
|
+
databaseName: null;
|
|
90
|
+
color: null;
|
|
91
|
+
idBranch: number;
|
|
92
|
+
owner: null;
|
|
93
|
+
sharing: null;
|
|
94
|
+
path: string;
|
|
95
|
+
tables: string;
|
|
96
|
+
updated: string;
|
|
97
|
+
};
|
|
98
|
+
isTyped: false;
|
|
99
|
+
isAlias: false;
|
|
100
|
+
};
|
|
101
|
+
large: {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
displayName: string;
|
|
105
|
+
primaryKey: never[];
|
|
106
|
+
metadata: never[];
|
|
107
|
+
columns: string[];
|
|
108
|
+
columnMetadata: {};
|
|
109
|
+
attributes: never[];
|
|
110
|
+
bucket: {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
displayName: string;
|
|
114
|
+
stage: "in";
|
|
115
|
+
description: string;
|
|
116
|
+
created: string;
|
|
117
|
+
lastChangeDate: string;
|
|
118
|
+
isMaintenance: boolean;
|
|
119
|
+
isReadOnly: boolean;
|
|
120
|
+
isSnowflakeSharedDatabase: boolean;
|
|
121
|
+
hasExternalSchema: boolean;
|
|
122
|
+
rowsCount: number;
|
|
123
|
+
dataSizeBytes: number;
|
|
124
|
+
uri: string;
|
|
125
|
+
backend: "snowflake";
|
|
126
|
+
backendPath: never[];
|
|
127
|
+
databaseName: null;
|
|
128
|
+
color: null;
|
|
129
|
+
idBranch: number;
|
|
130
|
+
owner: null;
|
|
131
|
+
sharing: null;
|
|
132
|
+
path: string;
|
|
133
|
+
tables: string;
|
|
134
|
+
updated: string;
|
|
135
|
+
};
|
|
136
|
+
isTyped: false;
|
|
137
|
+
isAlias: false;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Returns a single realistic typed TableDetail (fresh, no imports yet).
|
|
146
|
+
*
|
|
147
|
+
* The explicit return type ensures any divergence from the OpenAPI-derived
|
|
148
|
+
* `TableDetail` in `@keboola/api-client` surfaces as a TypeScript error.
|
|
149
|
+
*/
|
|
150
|
+
declare const getTable: () => TableDetail;
|
|
151
|
+
/**
|
|
152
|
+
* Returns three TableDetail objects representing different lifecycle states:
|
|
153
|
+
* 1. Fresh — just created, no data imported.
|
|
154
|
+
* 2. Recently updated — moderate size, recent import.
|
|
155
|
+
* 3. Large — high row count, large byte size.
|
|
156
|
+
*/
|
|
157
|
+
declare const listTables: () => TableDetail[];
|
|
158
|
+
/**
|
|
159
|
+
* Named fixtures for targeted access in tests.
|
|
160
|
+
*/
|
|
161
|
+
declare const tableFixtures: {
|
|
162
|
+
fresh: {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
displayName: string;
|
|
166
|
+
primaryKey: string[];
|
|
167
|
+
metadata: never[];
|
|
168
|
+
columns: string[];
|
|
169
|
+
columnMetadata: {};
|
|
170
|
+
attributes: never[];
|
|
171
|
+
bucket: {
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
displayName: string;
|
|
175
|
+
stage: "in";
|
|
176
|
+
description: string;
|
|
177
|
+
created: string;
|
|
178
|
+
lastChangeDate: string;
|
|
179
|
+
isMaintenance: boolean;
|
|
180
|
+
isReadOnly: boolean;
|
|
181
|
+
isSnowflakeSharedDatabase: boolean;
|
|
182
|
+
hasExternalSchema: boolean;
|
|
183
|
+
rowsCount: number;
|
|
184
|
+
dataSizeBytes: number;
|
|
185
|
+
uri: string;
|
|
186
|
+
backend: "snowflake";
|
|
187
|
+
backendPath: never[];
|
|
188
|
+
databaseName: null;
|
|
189
|
+
color: null;
|
|
190
|
+
idBranch: number;
|
|
191
|
+
owner: null;
|
|
192
|
+
sharing: null;
|
|
193
|
+
path: string;
|
|
194
|
+
tables: string;
|
|
195
|
+
updated: string;
|
|
196
|
+
};
|
|
197
|
+
isTyped: false;
|
|
198
|
+
isAlias: false;
|
|
199
|
+
};
|
|
200
|
+
recentlyUpdated: {
|
|
201
|
+
id: string;
|
|
202
|
+
name: string;
|
|
203
|
+
displayName: string;
|
|
204
|
+
primaryKey: string[];
|
|
205
|
+
metadata: {
|
|
206
|
+
id: string;
|
|
207
|
+
key: string;
|
|
208
|
+
value: string;
|
|
209
|
+
provider: string;
|
|
210
|
+
timestamp: string;
|
|
211
|
+
}[];
|
|
212
|
+
columns: string[];
|
|
213
|
+
columnMetadata: {
|
|
214
|
+
order_id: {
|
|
215
|
+
id: string;
|
|
216
|
+
key: string;
|
|
217
|
+
value: string;
|
|
218
|
+
provider: string;
|
|
219
|
+
timestamp: string;
|
|
220
|
+
}[];
|
|
221
|
+
};
|
|
222
|
+
attributes: never[];
|
|
223
|
+
bucket: {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
displayName: string;
|
|
227
|
+
stage: "in";
|
|
228
|
+
description: string;
|
|
229
|
+
created: string;
|
|
230
|
+
lastChangeDate: string;
|
|
231
|
+
isMaintenance: boolean;
|
|
232
|
+
isReadOnly: boolean;
|
|
233
|
+
isSnowflakeSharedDatabase: boolean;
|
|
234
|
+
hasExternalSchema: boolean;
|
|
235
|
+
rowsCount: number;
|
|
236
|
+
dataSizeBytes: number;
|
|
237
|
+
uri: string;
|
|
238
|
+
backend: "snowflake";
|
|
239
|
+
backendPath: never[];
|
|
240
|
+
databaseName: null;
|
|
241
|
+
color: null;
|
|
242
|
+
idBranch: number;
|
|
243
|
+
owner: null;
|
|
244
|
+
sharing: null;
|
|
245
|
+
path: string;
|
|
246
|
+
tables: string;
|
|
247
|
+
updated: string;
|
|
248
|
+
};
|
|
249
|
+
isTyped: false;
|
|
250
|
+
isAlias: false;
|
|
251
|
+
};
|
|
252
|
+
large: {
|
|
253
|
+
id: string;
|
|
254
|
+
name: string;
|
|
255
|
+
displayName: string;
|
|
256
|
+
primaryKey: never[];
|
|
257
|
+
metadata: never[];
|
|
258
|
+
columns: string[];
|
|
259
|
+
columnMetadata: {};
|
|
260
|
+
attributes: never[];
|
|
261
|
+
bucket: {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
displayName: string;
|
|
265
|
+
stage: "in";
|
|
266
|
+
description: string;
|
|
267
|
+
created: string;
|
|
268
|
+
lastChangeDate: string;
|
|
269
|
+
isMaintenance: boolean;
|
|
270
|
+
isReadOnly: boolean;
|
|
271
|
+
isSnowflakeSharedDatabase: boolean;
|
|
272
|
+
hasExternalSchema: boolean;
|
|
273
|
+
rowsCount: number;
|
|
274
|
+
dataSizeBytes: number;
|
|
275
|
+
uri: string;
|
|
276
|
+
backend: "snowflake";
|
|
277
|
+
backendPath: never[];
|
|
278
|
+
databaseName: null;
|
|
279
|
+
color: null;
|
|
280
|
+
idBranch: number;
|
|
281
|
+
owner: null;
|
|
282
|
+
sharing: null;
|
|
283
|
+
path: string;
|
|
284
|
+
tables: string;
|
|
285
|
+
updated: string;
|
|
286
|
+
};
|
|
287
|
+
isTyped: false;
|
|
288
|
+
isAlias: false;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export { fixtures, getTable, listTables, tableFixtures };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
import * as _keboola_api_client_storage_types from '@keboola/api-client/storage/types';
|
|
2
|
+
import { TableDetail } from '@keboola/api-client/storage/types';
|
|
3
|
+
export { Table, TableDetail } from '@keboola/api-client/storage/types';
|
|
4
|
+
|
|
5
|
+
declare const fixtures: {
|
|
6
|
+
storage: {
|
|
7
|
+
tables: {
|
|
8
|
+
getTable: () => _keboola_api_client_storage_types.TableDetail;
|
|
9
|
+
listTables: () => _keboola_api_client_storage_types.TableDetail[];
|
|
10
|
+
fixtures: {
|
|
11
|
+
fresh: {
|
|
12
|
+
id: string;
|
|
13
|
+
name: string;
|
|
14
|
+
displayName: string;
|
|
15
|
+
primaryKey: string[];
|
|
16
|
+
metadata: never[];
|
|
17
|
+
columns: string[];
|
|
18
|
+
columnMetadata: {};
|
|
19
|
+
attributes: never[];
|
|
20
|
+
bucket: {
|
|
21
|
+
id: string;
|
|
22
|
+
name: string;
|
|
23
|
+
displayName: string;
|
|
24
|
+
stage: "in";
|
|
25
|
+
description: string;
|
|
26
|
+
created: string;
|
|
27
|
+
lastChangeDate: string;
|
|
28
|
+
isMaintenance: boolean;
|
|
29
|
+
isReadOnly: boolean;
|
|
30
|
+
isSnowflakeSharedDatabase: boolean;
|
|
31
|
+
hasExternalSchema: boolean;
|
|
32
|
+
rowsCount: number;
|
|
33
|
+
dataSizeBytes: number;
|
|
34
|
+
uri: string;
|
|
35
|
+
backend: "snowflake";
|
|
36
|
+
backendPath: never[];
|
|
37
|
+
databaseName: null;
|
|
38
|
+
color: null;
|
|
39
|
+
idBranch: number;
|
|
40
|
+
owner: null;
|
|
41
|
+
sharing: null;
|
|
42
|
+
path: string;
|
|
43
|
+
tables: string;
|
|
44
|
+
updated: string;
|
|
45
|
+
};
|
|
46
|
+
isTyped: false;
|
|
47
|
+
isAlias: false;
|
|
48
|
+
};
|
|
49
|
+
recentlyUpdated: {
|
|
50
|
+
id: string;
|
|
51
|
+
name: string;
|
|
52
|
+
displayName: string;
|
|
53
|
+
primaryKey: string[];
|
|
54
|
+
metadata: {
|
|
55
|
+
id: string;
|
|
56
|
+
key: string;
|
|
57
|
+
value: string;
|
|
58
|
+
provider: string;
|
|
59
|
+
timestamp: string;
|
|
60
|
+
}[];
|
|
61
|
+
columns: string[];
|
|
62
|
+
columnMetadata: {
|
|
63
|
+
order_id: {
|
|
64
|
+
id: string;
|
|
65
|
+
key: string;
|
|
66
|
+
value: string;
|
|
67
|
+
provider: string;
|
|
68
|
+
timestamp: string;
|
|
69
|
+
}[];
|
|
70
|
+
};
|
|
71
|
+
attributes: never[];
|
|
72
|
+
bucket: {
|
|
73
|
+
id: string;
|
|
74
|
+
name: string;
|
|
75
|
+
displayName: string;
|
|
76
|
+
stage: "in";
|
|
77
|
+
description: string;
|
|
78
|
+
created: string;
|
|
79
|
+
lastChangeDate: string;
|
|
80
|
+
isMaintenance: boolean;
|
|
81
|
+
isReadOnly: boolean;
|
|
82
|
+
isSnowflakeSharedDatabase: boolean;
|
|
83
|
+
hasExternalSchema: boolean;
|
|
84
|
+
rowsCount: number;
|
|
85
|
+
dataSizeBytes: number;
|
|
86
|
+
uri: string;
|
|
87
|
+
backend: "snowflake";
|
|
88
|
+
backendPath: never[];
|
|
89
|
+
databaseName: null;
|
|
90
|
+
color: null;
|
|
91
|
+
idBranch: number;
|
|
92
|
+
owner: null;
|
|
93
|
+
sharing: null;
|
|
94
|
+
path: string;
|
|
95
|
+
tables: string;
|
|
96
|
+
updated: string;
|
|
97
|
+
};
|
|
98
|
+
isTyped: false;
|
|
99
|
+
isAlias: false;
|
|
100
|
+
};
|
|
101
|
+
large: {
|
|
102
|
+
id: string;
|
|
103
|
+
name: string;
|
|
104
|
+
displayName: string;
|
|
105
|
+
primaryKey: never[];
|
|
106
|
+
metadata: never[];
|
|
107
|
+
columns: string[];
|
|
108
|
+
columnMetadata: {};
|
|
109
|
+
attributes: never[];
|
|
110
|
+
bucket: {
|
|
111
|
+
id: string;
|
|
112
|
+
name: string;
|
|
113
|
+
displayName: string;
|
|
114
|
+
stage: "in";
|
|
115
|
+
description: string;
|
|
116
|
+
created: string;
|
|
117
|
+
lastChangeDate: string;
|
|
118
|
+
isMaintenance: boolean;
|
|
119
|
+
isReadOnly: boolean;
|
|
120
|
+
isSnowflakeSharedDatabase: boolean;
|
|
121
|
+
hasExternalSchema: boolean;
|
|
122
|
+
rowsCount: number;
|
|
123
|
+
dataSizeBytes: number;
|
|
124
|
+
uri: string;
|
|
125
|
+
backend: "snowflake";
|
|
126
|
+
backendPath: never[];
|
|
127
|
+
databaseName: null;
|
|
128
|
+
color: null;
|
|
129
|
+
idBranch: number;
|
|
130
|
+
owner: null;
|
|
131
|
+
sharing: null;
|
|
132
|
+
path: string;
|
|
133
|
+
tables: string;
|
|
134
|
+
updated: string;
|
|
135
|
+
};
|
|
136
|
+
isTyped: false;
|
|
137
|
+
isAlias: false;
|
|
138
|
+
};
|
|
139
|
+
};
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
};
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Returns a single realistic typed TableDetail (fresh, no imports yet).
|
|
146
|
+
*
|
|
147
|
+
* The explicit return type ensures any divergence from the OpenAPI-derived
|
|
148
|
+
* `TableDetail` in `@keboola/api-client` surfaces as a TypeScript error.
|
|
149
|
+
*/
|
|
150
|
+
declare const getTable: () => TableDetail;
|
|
151
|
+
/**
|
|
152
|
+
* Returns three TableDetail objects representing different lifecycle states:
|
|
153
|
+
* 1. Fresh — just created, no data imported.
|
|
154
|
+
* 2. Recently updated — moderate size, recent import.
|
|
155
|
+
* 3. Large — high row count, large byte size.
|
|
156
|
+
*/
|
|
157
|
+
declare const listTables: () => TableDetail[];
|
|
158
|
+
/**
|
|
159
|
+
* Named fixtures for targeted access in tests.
|
|
160
|
+
*/
|
|
161
|
+
declare const tableFixtures: {
|
|
162
|
+
fresh: {
|
|
163
|
+
id: string;
|
|
164
|
+
name: string;
|
|
165
|
+
displayName: string;
|
|
166
|
+
primaryKey: string[];
|
|
167
|
+
metadata: never[];
|
|
168
|
+
columns: string[];
|
|
169
|
+
columnMetadata: {};
|
|
170
|
+
attributes: never[];
|
|
171
|
+
bucket: {
|
|
172
|
+
id: string;
|
|
173
|
+
name: string;
|
|
174
|
+
displayName: string;
|
|
175
|
+
stage: "in";
|
|
176
|
+
description: string;
|
|
177
|
+
created: string;
|
|
178
|
+
lastChangeDate: string;
|
|
179
|
+
isMaintenance: boolean;
|
|
180
|
+
isReadOnly: boolean;
|
|
181
|
+
isSnowflakeSharedDatabase: boolean;
|
|
182
|
+
hasExternalSchema: boolean;
|
|
183
|
+
rowsCount: number;
|
|
184
|
+
dataSizeBytes: number;
|
|
185
|
+
uri: string;
|
|
186
|
+
backend: "snowflake";
|
|
187
|
+
backendPath: never[];
|
|
188
|
+
databaseName: null;
|
|
189
|
+
color: null;
|
|
190
|
+
idBranch: number;
|
|
191
|
+
owner: null;
|
|
192
|
+
sharing: null;
|
|
193
|
+
path: string;
|
|
194
|
+
tables: string;
|
|
195
|
+
updated: string;
|
|
196
|
+
};
|
|
197
|
+
isTyped: false;
|
|
198
|
+
isAlias: false;
|
|
199
|
+
};
|
|
200
|
+
recentlyUpdated: {
|
|
201
|
+
id: string;
|
|
202
|
+
name: string;
|
|
203
|
+
displayName: string;
|
|
204
|
+
primaryKey: string[];
|
|
205
|
+
metadata: {
|
|
206
|
+
id: string;
|
|
207
|
+
key: string;
|
|
208
|
+
value: string;
|
|
209
|
+
provider: string;
|
|
210
|
+
timestamp: string;
|
|
211
|
+
}[];
|
|
212
|
+
columns: string[];
|
|
213
|
+
columnMetadata: {
|
|
214
|
+
order_id: {
|
|
215
|
+
id: string;
|
|
216
|
+
key: string;
|
|
217
|
+
value: string;
|
|
218
|
+
provider: string;
|
|
219
|
+
timestamp: string;
|
|
220
|
+
}[];
|
|
221
|
+
};
|
|
222
|
+
attributes: never[];
|
|
223
|
+
bucket: {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
displayName: string;
|
|
227
|
+
stage: "in";
|
|
228
|
+
description: string;
|
|
229
|
+
created: string;
|
|
230
|
+
lastChangeDate: string;
|
|
231
|
+
isMaintenance: boolean;
|
|
232
|
+
isReadOnly: boolean;
|
|
233
|
+
isSnowflakeSharedDatabase: boolean;
|
|
234
|
+
hasExternalSchema: boolean;
|
|
235
|
+
rowsCount: number;
|
|
236
|
+
dataSizeBytes: number;
|
|
237
|
+
uri: string;
|
|
238
|
+
backend: "snowflake";
|
|
239
|
+
backendPath: never[];
|
|
240
|
+
databaseName: null;
|
|
241
|
+
color: null;
|
|
242
|
+
idBranch: number;
|
|
243
|
+
owner: null;
|
|
244
|
+
sharing: null;
|
|
245
|
+
path: string;
|
|
246
|
+
tables: string;
|
|
247
|
+
updated: string;
|
|
248
|
+
};
|
|
249
|
+
isTyped: false;
|
|
250
|
+
isAlias: false;
|
|
251
|
+
};
|
|
252
|
+
large: {
|
|
253
|
+
id: string;
|
|
254
|
+
name: string;
|
|
255
|
+
displayName: string;
|
|
256
|
+
primaryKey: never[];
|
|
257
|
+
metadata: never[];
|
|
258
|
+
columns: string[];
|
|
259
|
+
columnMetadata: {};
|
|
260
|
+
attributes: never[];
|
|
261
|
+
bucket: {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
displayName: string;
|
|
265
|
+
stage: "in";
|
|
266
|
+
description: string;
|
|
267
|
+
created: string;
|
|
268
|
+
lastChangeDate: string;
|
|
269
|
+
isMaintenance: boolean;
|
|
270
|
+
isReadOnly: boolean;
|
|
271
|
+
isSnowflakeSharedDatabase: boolean;
|
|
272
|
+
hasExternalSchema: boolean;
|
|
273
|
+
rowsCount: number;
|
|
274
|
+
dataSizeBytes: number;
|
|
275
|
+
uri: string;
|
|
276
|
+
backend: "snowflake";
|
|
277
|
+
backendPath: never[];
|
|
278
|
+
databaseName: null;
|
|
279
|
+
color: null;
|
|
280
|
+
idBranch: number;
|
|
281
|
+
owner: null;
|
|
282
|
+
sharing: null;
|
|
283
|
+
path: string;
|
|
284
|
+
tables: string;
|
|
285
|
+
updated: string;
|
|
286
|
+
};
|
|
287
|
+
isTyped: false;
|
|
288
|
+
isAlias: false;
|
|
289
|
+
};
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
export { fixtures, getTable, listTables, tableFixtures };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
// src/clients/storage/tables.ts
|
|
2
|
+
var bucket = {
|
|
3
|
+
id: "in.c-main",
|
|
4
|
+
name: "c-main",
|
|
5
|
+
displayName: "Main",
|
|
6
|
+
stage: "in",
|
|
7
|
+
description: "Main input bucket",
|
|
8
|
+
created: "2024-01-15T10:00:00+0100",
|
|
9
|
+
lastChangeDate: "2024-03-10T08:30:00+0100",
|
|
10
|
+
isMaintenance: false,
|
|
11
|
+
isReadOnly: false,
|
|
12
|
+
isSnowflakeSharedDatabase: false,
|
|
13
|
+
hasExternalSchema: false,
|
|
14
|
+
rowsCount: 15e4,
|
|
15
|
+
dataSizeBytes: 52428800,
|
|
16
|
+
uri: "https://connection.keboola.com/v2/storage/buckets/in.c-main",
|
|
17
|
+
backend: "snowflake",
|
|
18
|
+
backendPath: [],
|
|
19
|
+
databaseName: null,
|
|
20
|
+
color: null,
|
|
21
|
+
idBranch: 0,
|
|
22
|
+
owner: null,
|
|
23
|
+
sharing: null,
|
|
24
|
+
path: "in.c-main",
|
|
25
|
+
tables: "https://connection.keboola.com/v2/storage/buckets/in.c-main/tables",
|
|
26
|
+
updated: "2024-03-10T08:30:00+0100"
|
|
27
|
+
};
|
|
28
|
+
var freshTable = {
|
|
29
|
+
id: "in.c-main.users",
|
|
30
|
+
name: "users",
|
|
31
|
+
displayName: "Users",
|
|
32
|
+
primaryKey: ["id"],
|
|
33
|
+
metadata: [],
|
|
34
|
+
columns: ["id", "email", "name", "created_at"],
|
|
35
|
+
columnMetadata: {},
|
|
36
|
+
attributes: [],
|
|
37
|
+
bucket,
|
|
38
|
+
isTyped: false,
|
|
39
|
+
isAlias: false
|
|
40
|
+
};
|
|
41
|
+
var recentlyUpdatedTable = {
|
|
42
|
+
id: "in.c-main.orders",
|
|
43
|
+
name: "orders",
|
|
44
|
+
displayName: "Orders",
|
|
45
|
+
primaryKey: ["order_id"],
|
|
46
|
+
metadata: [
|
|
47
|
+
{
|
|
48
|
+
id: "mt1",
|
|
49
|
+
key: "KBC.createdBy.component.id",
|
|
50
|
+
value: "keboola.python-transformation",
|
|
51
|
+
provider: "keboola",
|
|
52
|
+
timestamp: "2024-06-01T09:00:00+0200"
|
|
53
|
+
}
|
|
54
|
+
],
|
|
55
|
+
columns: ["order_id", "user_id", "total", "status", "created_at", "updated_at"],
|
|
56
|
+
columnMetadata: {
|
|
57
|
+
order_id: [
|
|
58
|
+
{
|
|
59
|
+
id: "m1",
|
|
60
|
+
key: "KBC.datatype.type",
|
|
61
|
+
value: "INTEGER",
|
|
62
|
+
provider: "keboola",
|
|
63
|
+
timestamp: "2024-06-01T09:00:00+0200"
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
attributes: [],
|
|
68
|
+
bucket,
|
|
69
|
+
isTyped: false,
|
|
70
|
+
isAlias: false
|
|
71
|
+
};
|
|
72
|
+
var largeTable = {
|
|
73
|
+
id: "in.c-main.events",
|
|
74
|
+
name: "events",
|
|
75
|
+
displayName: "Events",
|
|
76
|
+
primaryKey: [],
|
|
77
|
+
metadata: [],
|
|
78
|
+
columns: ["event_id", "user_id", "event_type", "properties", "occurred_at"],
|
|
79
|
+
columnMetadata: {},
|
|
80
|
+
attributes: [],
|
|
81
|
+
bucket,
|
|
82
|
+
isTyped: false,
|
|
83
|
+
isAlias: false
|
|
84
|
+
};
|
|
85
|
+
var getTable = () => freshTable;
|
|
86
|
+
var listTables = () => [freshTable, recentlyUpdatedTable, largeTable];
|
|
87
|
+
var tableFixtures = {
|
|
88
|
+
fresh: freshTable,
|
|
89
|
+
recentlyUpdated: recentlyUpdatedTable,
|
|
90
|
+
large: largeTable
|
|
91
|
+
};
|
|
92
|
+
|
|
93
|
+
// src/fixtures.ts
|
|
94
|
+
var fixtures = {
|
|
95
|
+
storage: {
|
|
96
|
+
tables: {
|
|
97
|
+
getTable,
|
|
98
|
+
listTables,
|
|
99
|
+
fixtures: tableFixtures
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export { fixtures, getTable, listTables, tableFixtures };
|
|
105
|
+
//# sourceMappingURL=index.js.map
|
|
106
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/clients/storage/tables.ts","../src/fixtures.ts"],"names":[],"mappings":"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","file":"index.js","sourcesContent":["import type { Table, TableDetail } from '@keboola/api-client/storage/types';\n\nconst bucket = {\n id: 'in.c-main',\n name: 'c-main',\n displayName: 'Main',\n stage: 'in' as const,\n description: 'Main input bucket',\n created: '2024-01-15T10:00:00+0100',\n lastChangeDate: '2024-03-10T08:30:00+0100',\n isMaintenance: false,\n isReadOnly: false,\n isSnowflakeSharedDatabase: false,\n hasExternalSchema: false,\n rowsCount: 150000,\n dataSizeBytes: 52428800,\n uri: 'https://connection.keboola.com/v2/storage/buckets/in.c-main',\n backend: 'snowflake' as const,\n backendPath: [],\n databaseName: null,\n color: null,\n idBranch: 0,\n owner: null,\n sharing: null,\n path: 'in.c-main',\n tables: 'https://connection.keboola.com/v2/storage/buckets/in.c-main/tables',\n updated: '2024-03-10T08:30:00+0100',\n};\n\n// A freshly created table with no imports yet (non-typed, non-alias variant).\nconst freshTable = {\n id: 'in.c-main.users',\n name: 'users',\n displayName: 'Users',\n primaryKey: ['id'],\n metadata: [],\n columns: ['id', 'email', 'name', 'created_at'],\n columnMetadata: {},\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n// A recently updated table with a moderate size (non-typed, non-alias variant).\nconst recentlyUpdatedTable = {\n id: 'in.c-main.orders',\n name: 'orders',\n displayName: 'Orders',\n primaryKey: ['order_id'],\n metadata: [\n {\n id: 'mt1',\n key: 'KBC.createdBy.component.id',\n value: 'keboola.python-transformation',\n provider: 'keboola',\n timestamp: '2024-06-01T09:00:00+0200',\n },\n ],\n columns: ['order_id', 'user_id', 'total', 'status', 'created_at', 'updated_at'],\n columnMetadata: {\n order_id: [\n {\n id: 'm1',\n key: 'KBC.datatype.type',\n value: 'INTEGER',\n provider: 'keboola',\n timestamp: '2024-06-01T09:00:00+0200',\n },\n ],\n },\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n// A large table with many rows representing high-volume data (non-typed, non-alias variant).\nconst largeTable = {\n id: 'in.c-main.events',\n name: 'events',\n displayName: 'Events',\n primaryKey: [],\n metadata: [],\n columns: ['event_id', 'user_id', 'event_type', 'properties', 'occurred_at'],\n columnMetadata: {},\n attributes: [],\n bucket,\n isTyped: false as const,\n isAlias: false as const,\n} satisfies TableDetail;\n\n/**\n * Returns a single realistic typed TableDetail (fresh, no imports yet).\n *\n * The explicit return type ensures any divergence from the OpenAPI-derived\n * `TableDetail` in `@keboola/api-client` surfaces as a TypeScript error.\n */\nexport const getTable = (): TableDetail => freshTable;\n\n/**\n * Returns three TableDetail objects representing different lifecycle states:\n * 1. Fresh — just created, no data imported.\n * 2. Recently updated — moderate size, recent import.\n * 3. Large — high row count, large byte size.\n */\nexport const listTables = (): TableDetail[] => [freshTable, recentlyUpdatedTable, largeTable];\n\n/**\n * Named fixtures for targeted access in tests.\n */\nexport const tableFixtures = {\n fresh: freshTable,\n recentlyUpdated: recentlyUpdatedTable,\n large: largeTable,\n} satisfies Record<'fresh' | 'recentlyUpdated' | 'large', TableDetail>;\n\nexport type { Table, TableDetail };\n","import { getTable, listTables, tableFixtures } from './clients/storage/tables';\n\nexport const fixtures = {\n storage: {\n tables: {\n getTable,\n listTables,\n fixtures: tableFixtures,\n },\n },\n};\n"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@keboola/api-fixtures",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Typed test fixtures keyed by Keboola API endpoint",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"main": "./dist/index.cjs",
|
|
8
|
+
"module": "./dist/index.js",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"README.md"
|
|
13
|
+
],
|
|
14
|
+
"publishConfig": {
|
|
15
|
+
"access": "public"
|
|
16
|
+
},
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"exports": {
|
|
19
|
+
".": {
|
|
20
|
+
"import": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"require": {
|
|
25
|
+
"types": "./dist/index.d.cts",
|
|
26
|
+
"default": "./dist/index.cjs"
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
30
|
+
"scripts": {
|
|
31
|
+
"type-check": "tsc",
|
|
32
|
+
"lint": "yarn lint:format && yarn lint:oxlint",
|
|
33
|
+
"lint:fix": "oxlint --fix . && oxfmt",
|
|
34
|
+
"lint:oxlint": "oxlint . --quiet",
|
|
35
|
+
"lint:format": "oxfmt --check",
|
|
36
|
+
"knip:check": "yarn --cwd ../.. exec knip --workspace packages/api-fixtures",
|
|
37
|
+
"knip:fix": "yarn --cwd ../.. exec knip --workspace packages/api-fixtures --fix-type types,exports,files",
|
|
38
|
+
"test": "vitest run --passWithNoTests --reporter=dot",
|
|
39
|
+
"transit": "yarn build",
|
|
40
|
+
"build": "tsup",
|
|
41
|
+
"build:check": "attw --pack .",
|
|
42
|
+
"prepublishOnly": "yarn build && yarn build:check"
|
|
43
|
+
},
|
|
44
|
+
"engines": {
|
|
45
|
+
"node": "24.x"
|
|
46
|
+
},
|
|
47
|
+
"repository": {
|
|
48
|
+
"type": "git",
|
|
49
|
+
"url": "https://github.com/keboola/ui.git",
|
|
50
|
+
"directory": "packages/api-fixtures"
|
|
51
|
+
},
|
|
52
|
+
"homepage": "https://github.com/keboola/ui/tree/main/packages/api-fixtures#readme",
|
|
53
|
+
"bugs": {
|
|
54
|
+
"url": "https://github.com/keboola/ui/issues"
|
|
55
|
+
},
|
|
56
|
+
"keywords": [
|
|
57
|
+
"keboola",
|
|
58
|
+
"fixtures",
|
|
59
|
+
"testing",
|
|
60
|
+
"msw",
|
|
61
|
+
"typescript"
|
|
62
|
+
],
|
|
63
|
+
"peerDependencies": {
|
|
64
|
+
"@keboola/api-client": "workspace:^"
|
|
65
|
+
},
|
|
66
|
+
"devDependencies": {
|
|
67
|
+
"@arethetypeswrong/cli": "^0.18.2",
|
|
68
|
+
"@keboola/oxlint-config": "workspace:^",
|
|
69
|
+
"@keboola/tsconfig": "workspace:^",
|
|
70
|
+
"@types/node": "24.12.0",
|
|
71
|
+
"esbuild": "^0.28.1",
|
|
72
|
+
"oxfmt": "^0.44.0",
|
|
73
|
+
"oxlint": "^1.56.0",
|
|
74
|
+
"tsup": "^8.5.1",
|
|
75
|
+
"typescript": "^6.0.3",
|
|
76
|
+
"vite": "^8.0.16",
|
|
77
|
+
"vitest": "^4.1.8"
|
|
78
|
+
}
|
|
79
|
+
}
|