@expresscsv/sdk 1.0.0 → 1.0.1
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 +11 -11
- package/dist/index.d.cts +11 -11
- package/dist/index.d.mts +11 -11
- package/dist/index.d.ts +11 -11
- package/dist/index.js +2 -2
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,7 +35,7 @@ const schema = x.row({
|
|
|
35
35
|
|
|
36
36
|
const importer = new CSVImporter({
|
|
37
37
|
schema,
|
|
38
|
-
|
|
38
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
39
39
|
importNamespace: "user-import",
|
|
40
40
|
title: "Import Users",
|
|
41
41
|
});
|
|
@@ -60,7 +60,7 @@ importer.open({
|
|
|
60
60
|
|
|
61
61
|
If your schema is assembled dynamically at runtime, still use `x.row(...)`. Just note that dynamic schema assembly can widen TypeScript inference, so use it intentionally when you need runtime-driven columns.
|
|
62
62
|
|
|
63
|
-
Have your backend keep the ExpressCSV secret key, call the ExpressCSV session-creation endpoint, and return a short-lived importer
|
|
63
|
+
Have your backend keep the ExpressCSV secret key, call the ExpressCSV session-creation endpoint, and return a short-lived importer auth token to the browser via `getAuthToken`. The SDK opens the importer immediately, then completes the initial session bootstrap in the background.
|
|
64
64
|
|
|
65
65
|
## Delivery
|
|
66
66
|
|
|
@@ -125,7 +125,7 @@ By default, the SDK preloads the importer in a hidden iframe for instant display
|
|
|
125
125
|
// Preload is enabled by default
|
|
126
126
|
const importer = new CSVImporter({
|
|
127
127
|
schema,
|
|
128
|
-
|
|
128
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
129
129
|
importNamespace: "user-import",
|
|
130
130
|
});
|
|
131
131
|
|
|
@@ -138,7 +138,7 @@ To disable preloading (there will be a brief loading screen instead):
|
|
|
138
138
|
```typescript
|
|
139
139
|
const importer = new CSVImporter({
|
|
140
140
|
schema,
|
|
141
|
-
|
|
141
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
142
142
|
importNamespace: "user-import",
|
|
143
143
|
preload: false,
|
|
144
144
|
});
|
|
@@ -162,7 +162,7 @@ const candidateSchema = x.row({
|
|
|
162
162
|
|
|
163
163
|
const importer = new CSVImporter({
|
|
164
164
|
schema: candidateSchema,
|
|
165
|
-
|
|
165
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
166
166
|
importNamespace: "candidate-import",
|
|
167
167
|
templateDownload: {
|
|
168
168
|
source: "generate",
|
|
@@ -218,7 +218,7 @@ const dualTheme: Theme = {
|
|
|
218
218
|
|
|
219
219
|
const importer = new CSVImporter({
|
|
220
220
|
schema,
|
|
221
|
-
|
|
221
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
222
222
|
importNamespace: "user-import",
|
|
223
223
|
theme,
|
|
224
224
|
});
|
|
@@ -262,7 +262,7 @@ Control light/dark mode with `colorMode`:
|
|
|
262
262
|
```typescript
|
|
263
263
|
const importer = new CSVImporter({
|
|
264
264
|
schema,
|
|
265
|
-
|
|
265
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
266
266
|
importNamespace: "user-import",
|
|
267
267
|
colorMode: "system", // 'light' | 'dark' | 'system'
|
|
268
268
|
});
|
|
@@ -275,7 +275,7 @@ Inject custom CSS for fine-grained styling overrides.
|
|
|
275
275
|
```typescript
|
|
276
276
|
const importer = new CSVImporter({
|
|
277
277
|
schema,
|
|
278
|
-
|
|
278
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
279
279
|
importNamespace: "user-import",
|
|
280
280
|
customCSS: `
|
|
281
281
|
.ecsv [data-step="upload"] {
|
|
@@ -295,7 +295,7 @@ Load custom fonts via the `fonts` option:
|
|
|
295
295
|
```typescript
|
|
296
296
|
const importer = new CSVImporter({
|
|
297
297
|
schema,
|
|
298
|
-
|
|
298
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
299
299
|
importNamespace: "user-import",
|
|
300
300
|
fonts: {
|
|
301
301
|
title: { source: "google", name: "Space Grotesk", weights: [400, 600, 700] },
|
|
@@ -557,7 +557,7 @@ new CSVImporter(options: SDKOptions)
|
|
|
557
557
|
| Option | Type | Required | Default | Description |
|
|
558
558
|
|---|---|---|---|---|
|
|
559
559
|
| `schema` | Schema | Yes | - | Schema definition created with `x.row()` |
|
|
560
|
-
| `
|
|
560
|
+
| `getAuthToken` | `() => Promise<string>` | Yes | - | Async callback that asks your backend for a short-lived importer auth token |
|
|
561
561
|
| `importNamespace` | `string` | Yes | - | Stable namespace string your app assigns to this importer configuration. Keep it the same for the same workflow; use a different value for different importers. |
|
|
562
562
|
| `title` | `string` | No | - | Title shown in the importer header |
|
|
563
563
|
| `preload` | `boolean` | No | `true` | Preload the importer for instant display |
|
|
@@ -652,7 +652,7 @@ type Row = Infer<typeof schema>;
|
|
|
652
652
|
|
|
653
653
|
const importer = new CSVImporter({
|
|
654
654
|
schema,
|
|
655
|
-
|
|
655
|
+
getAuthToken: async () => fetchAuthToken(),
|
|
656
656
|
importNamespace: "user-import",
|
|
657
657
|
});
|
|
658
658
|
|
package/dist/index.d.cts
CHANGED
|
@@ -1293,10 +1293,10 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1293
1293
|
private debug;
|
|
1294
1294
|
private importNamespace;
|
|
1295
1295
|
private sessionId;
|
|
1296
|
-
private
|
|
1297
|
-
private
|
|
1298
|
-
private
|
|
1299
|
-
private
|
|
1296
|
+
private currentAuthToken;
|
|
1297
|
+
private currentAuthTokenExpiresAt;
|
|
1298
|
+
private authTokenRefreshTimer;
|
|
1299
|
+
private authTokenRefreshPromise;
|
|
1300
1300
|
private _destroyTimer;
|
|
1301
1301
|
private _beforeUnloadHandler;
|
|
1302
1302
|
private importerUrl;
|
|
@@ -1337,12 +1337,12 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1337
1337
|
private completeOpenLifecycleForClose;
|
|
1338
1338
|
private sendImportProgress;
|
|
1339
1339
|
private waitForEvent;
|
|
1340
|
-
private
|
|
1341
|
-
private
|
|
1342
|
-
private
|
|
1343
|
-
private
|
|
1344
|
-
private
|
|
1345
|
-
private
|
|
1340
|
+
private fetchImporterAuthToken;
|
|
1341
|
+
private updateAuthToken;
|
|
1342
|
+
private clearAuthTokenRefreshTimer;
|
|
1343
|
+
private scheduleAuthTokenRefresh;
|
|
1344
|
+
private ensureActiveAuthToken;
|
|
1345
|
+
private refreshBoundAuthToken;
|
|
1346
1346
|
private beginImporterStartup;
|
|
1347
1347
|
private cancelImporterStartup;
|
|
1348
1348
|
private assertActiveImporterStartup;
|
|
@@ -3940,7 +3940,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3940
3940
|
|
|
3941
3941
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3942
3942
|
schema: TSchema;
|
|
3943
|
-
|
|
3943
|
+
getAuthToken: () => Promise<string>;
|
|
3944
3944
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3945
3945
|
importNamespace: string;
|
|
3946
3946
|
title?: string;
|
package/dist/index.d.mts
CHANGED
|
@@ -1293,10 +1293,10 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1293
1293
|
private debug;
|
|
1294
1294
|
private importNamespace;
|
|
1295
1295
|
private sessionId;
|
|
1296
|
-
private
|
|
1297
|
-
private
|
|
1298
|
-
private
|
|
1299
|
-
private
|
|
1296
|
+
private currentAuthToken;
|
|
1297
|
+
private currentAuthTokenExpiresAt;
|
|
1298
|
+
private authTokenRefreshTimer;
|
|
1299
|
+
private authTokenRefreshPromise;
|
|
1300
1300
|
private _destroyTimer;
|
|
1301
1301
|
private _beforeUnloadHandler;
|
|
1302
1302
|
private importerUrl;
|
|
@@ -1337,12 +1337,12 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1337
1337
|
private completeOpenLifecycleForClose;
|
|
1338
1338
|
private sendImportProgress;
|
|
1339
1339
|
private waitForEvent;
|
|
1340
|
-
private
|
|
1341
|
-
private
|
|
1342
|
-
private
|
|
1343
|
-
private
|
|
1344
|
-
private
|
|
1345
|
-
private
|
|
1340
|
+
private fetchImporterAuthToken;
|
|
1341
|
+
private updateAuthToken;
|
|
1342
|
+
private clearAuthTokenRefreshTimer;
|
|
1343
|
+
private scheduleAuthTokenRefresh;
|
|
1344
|
+
private ensureActiveAuthToken;
|
|
1345
|
+
private refreshBoundAuthToken;
|
|
1346
1346
|
private beginImporterStartup;
|
|
1347
1347
|
private cancelImporterStartup;
|
|
1348
1348
|
private assertActiveImporterStartup;
|
|
@@ -3940,7 +3940,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3940
3940
|
|
|
3941
3941
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3942
3942
|
schema: TSchema;
|
|
3943
|
-
|
|
3943
|
+
getAuthToken: () => Promise<string>;
|
|
3944
3944
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3945
3945
|
importNamespace: string;
|
|
3946
3946
|
title?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1293,10 +1293,10 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1293
1293
|
private debug;
|
|
1294
1294
|
private importNamespace;
|
|
1295
1295
|
private sessionId;
|
|
1296
|
-
private
|
|
1297
|
-
private
|
|
1298
|
-
private
|
|
1299
|
-
private
|
|
1296
|
+
private currentAuthToken;
|
|
1297
|
+
private currentAuthTokenExpiresAt;
|
|
1298
|
+
private authTokenRefreshTimer;
|
|
1299
|
+
private authTokenRefreshPromise;
|
|
1300
1300
|
private _destroyTimer;
|
|
1301
1301
|
private _beforeUnloadHandler;
|
|
1302
1302
|
private importerUrl;
|
|
@@ -1337,12 +1337,12 @@ export declare class CSVImporter<TSchema extends ExType<unknown, ExBaseDef, unkn
|
|
|
1337
1337
|
private completeOpenLifecycleForClose;
|
|
1338
1338
|
private sendImportProgress;
|
|
1339
1339
|
private waitForEvent;
|
|
1340
|
-
private
|
|
1341
|
-
private
|
|
1342
|
-
private
|
|
1343
|
-
private
|
|
1344
|
-
private
|
|
1345
|
-
private
|
|
1340
|
+
private fetchImporterAuthToken;
|
|
1341
|
+
private updateAuthToken;
|
|
1342
|
+
private clearAuthTokenRefreshTimer;
|
|
1343
|
+
private scheduleAuthTokenRefresh;
|
|
1344
|
+
private ensureActiveAuthToken;
|
|
1345
|
+
private refreshBoundAuthToken;
|
|
1346
1346
|
private beginImporterStartup;
|
|
1347
1347
|
private cancelImporterStartup;
|
|
1348
1348
|
private assertActiveImporterStartup;
|
|
@@ -3940,7 +3940,7 @@ export declare type SchemaFieldName<TSchema extends ExType<unknown, ExBaseDef, u
|
|
|
3940
3940
|
|
|
3941
3941
|
export declare interface SDKOptions<TSchema extends ExType<unknown, ExBaseDef, unknown>> {
|
|
3942
3942
|
schema: TSchema;
|
|
3943
|
-
|
|
3943
|
+
getAuthToken: () => Promise<string>;
|
|
3944
3944
|
/** Stable namespace string your app assigns to this importer configuration or workflow */
|
|
3945
3945
|
importNamespace: string;
|
|
3946
3946
|
title?: string;
|