@firecms/data_import_export 3.0.0-canary.8 → 3.0.0-canary.80

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.
Files changed (38) hide show
  1. package/LICENSE +113 -21
  2. package/README.md +1 -1
  3. package/dist/components/DataNewPropertiesMapping.d.ts +3 -5
  4. package/dist/components/ImportFileUpload.d.ts +1 -1
  5. package/dist/export_import/BasicExportAction.d.ts +7 -0
  6. package/dist/export_import/ExportCollectionAction.d.ts +1 -1
  7. package/dist/export_import/export.d.ts +15 -4
  8. package/dist/export_import/index.d.ts +4 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.es.js +940 -570
  11. package/dist/index.es.js.map +1 -1
  12. package/dist/index.umd.js +2 -2
  13. package/dist/index.umd.js.map +1 -1
  14. package/dist/types/column_mapping.d.ts +5 -7
  15. package/dist/useImportExportPlugin.d.ts +1 -1
  16. package/dist/utils/data.d.ts +3 -10
  17. package/dist/utils/file_headers.d.ts +1 -0
  18. package/dist/utils/file_to_json.d.ts +6 -1
  19. package/dist/utils/get_properties_mapping.d.ts +0 -3
  20. package/dist/utils/index.d.ts +0 -1
  21. package/package.json +20 -34
  22. package/src/components/DataNewPropertiesMapping.tsx +153 -40
  23. package/src/components/ImportFileUpload.tsx +12 -4
  24. package/src/components/ImportNewPropertyFieldPreview.tsx +7 -2
  25. package/src/export_import/BasicExportAction.tsx +147 -0
  26. package/src/export_import/ExportCollectionAction.tsx +45 -9
  27. package/src/export_import/ImportCollectionAction.tsx +22 -22
  28. package/src/export_import/export.ts +63 -29
  29. package/src/export_import/index.ts +4 -0
  30. package/src/hooks/useImportConfig.tsx +6 -0
  31. package/src/index.ts +1 -0
  32. package/src/types/column_mapping.ts +6 -6
  33. package/src/useImportExportPlugin.tsx +2 -2
  34. package/src/utils/data.ts +36 -126
  35. package/src/utils/file_headers.ts +90 -0
  36. package/src/utils/file_to_json.ts +33 -15
  37. package/src/utils/get_properties_mapping.ts +63 -59
  38. package/src/utils/index.ts +0 -1
package/LICENSE CHANGED
@@ -1,21 +1,113 @@
1
- MIT License
2
-
3
- Copyright (c) 2023 FireCMS
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ Business Source License 1.1
2
+
3
+ Parameters
4
+
5
+ Licensor: Firecms S.L.
6
+ Licensed Work: Firecms CMS packages:
7
+ cli
8
+ collection_editor
9
+ collection_editor_firebase
10
+ data_enhancement
11
+ data_import_export
12
+ editor
13
+ firecms_cloud
14
+ schema_inference
15
+ user_management
16
+
17
+ The Licensed Work is (c) 2024 Firecms S.L
18
+ Additional Use Grant: You may make use of the Licensed Work, provided that
19
+ you may not use the Licensed Work for a CMS Data Enhancement
20
+ Service.
21
+
22
+ A “CMS package” is a commercial offering that
23
+ allows third parties (other than your employees and
24
+ contractors) to access the functionality of the
25
+ Licensed Work by using software to extend the base features of
26
+ content management system controlled by such third parties.
27
+
28
+ Change Date: Four years from the date the Licensed Work is published.
29
+
30
+ Change License: MIT
31
+
32
+ For information about alternative licensing arrangements for the Software,
33
+ please visit: https://firecms.co
34
+
35
+ Notice
36
+
37
+ The Business Source License (this document, or the “License”) is not an Open
38
+ Source license. However, the Licensed Work will eventually be made available
39
+ under an Open Source License, as stated in this License.
40
+
41
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved.
42
+ “Business Source License” is a trademark of MariaDB Corporation Ab.
43
+
44
+ -----------------------------------------------------------------------------
45
+
46
+ Business Source License 1.1
47
+
48
+ Terms
49
+
50
+ The Licensor hereby grants you the right to copy, modify, create derivative
51
+ works, redistribute, and make non-production use of the Licensed Work. The
52
+ Licensor may make an Additional Use Grant, above, permitting limited
53
+ production use.
54
+
55
+ Effective on the Change Date, or the fourth anniversary of the first publicly
56
+ available distribution of a specific version of the Licensed Work under this
57
+ License, whichever comes first, the Licensor hereby grants you rights under
58
+ the terms of the Change License, and the rights granted in the paragraph
59
+ above terminate.
60
+
61
+ If your use of the Licensed Work does not comply with the requirements
62
+ currently in effect as described in this License, you must purchase a
63
+ commercial license from the Licensor, its affiliated entities, or authorized
64
+ resellers, or you must refrain from using the Licensed Work.
65
+
66
+ All copies of the original and modified Licensed Work, and derivative works
67
+ of the Licensed Work, are subject to this License. This License applies
68
+ separately for each version of the Licensed Work and the Change Date may vary
69
+ for each version of the Licensed Work released by Licensor.
70
+
71
+ You must conspicuously display this License on each original or modified copy
72
+ of the Licensed Work. If you receive the Licensed Work in original or
73
+ modified form from a third party, the terms and conditions set forth in this
74
+ License apply to your use of that work.
75
+
76
+ Any use of the Licensed Work in violation of this License will automatically
77
+ terminate your rights under this License for the current and all other
78
+ versions of the Licensed Work.
79
+
80
+ This License does not grant you any right in any trademark or logo of
81
+ Licensor or its affiliates (provided that you may use a trademark or logo of
82
+ Licensor as expressly required by this License).
83
+
84
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON
85
+ AN “AS IS” BASIS. LICENSOR HEREBY DISCLAIMS ALL WARRANTIES AND CONDITIONS,
86
+ EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF
87
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND
88
+ TITLE.
89
+
90
+ MariaDB hereby grants you permission to use this License’s text to license
91
+ your works, and to refer to it using the trademark “Business Source License”,
92
+ as long as you comply with the Covenants of Licensor below.
93
+
94
+ Covenants of Licensor
95
+
96
+ In consideration of the right to use this License’s text and the “Business
97
+ Source License” name and trademark, Licensor covenants to MariaDB, and to all
98
+ other recipients of the licensed work to be provided by Licensor:
99
+
100
+ 1. To specify as the Change License the GPL Version 2.0 or any later version,
101
+ or a license that is compatible with GPL Version 2.0 or a later version,
102
+ where “compatible” means that software provided under the Change License can
103
+ be included in a program with software provided under GPL Version 2.0 or a
104
+ later version. Licensor may specify additional Change Licenses without
105
+ limitation.
106
+
107
+ 2. To either: (a) specify an additional grant of rights to use that does not
108
+ impose any additional restriction on the right granted in this License, as
109
+ the Additional Use Grant; or (b) insert the text “None”.
110
+
111
+ 3. To specify a Change Date.
112
+
113
+ 4. Not to modify this License in any other way.
package/README.md CHANGED
@@ -26,7 +26,7 @@ No need to add any subscription key or anything like that.
26
26
  import React from "react";
27
27
  import { FirebaseCMSApp } from "@firecms/core";
28
28
  import "typeface-rubik";
29
- import "@fontsource/ibm-plex-mono";
29
+ import "@fontsource/jetbrains-mono";
30
30
 
31
31
  import { useDataImportPlugin } from "@firecms/data_import_export";
32
32
 
@@ -1,10 +1,8 @@
1
1
  import { Property } from "@firecms/core";
2
+ import { ImportConfig } from "../types";
2
3
  export interface DataPropertyMappingProps {
3
- idColumn?: string;
4
- headersMapping: Record<string, string | null>;
5
- originProperties: Record<string, Property>;
4
+ importConfig: ImportConfig;
6
5
  destinationProperties: Record<string, Property>;
7
- onIdPropertyChanged: (value: string | null) => void;
8
6
  buildPropertyView?: (props: {
9
7
  isIdColumn: boolean;
10
8
  property: Property | null;
@@ -12,4 +10,4 @@ export interface DataPropertyMappingProps {
12
10
  importKey: string;
13
11
  }) => React.ReactNode;
14
12
  }
15
- export declare function DataNewPropertiesMapping({ idColumn, headersMapping, originProperties, destinationProperties, onIdPropertyChanged, buildPropertyView, }: DataPropertyMappingProps): import("react/jsx-runtime").JSX.Element;
13
+ export declare function DataNewPropertiesMapping({ importConfig, destinationProperties, buildPropertyView }: DataPropertyMappingProps): import("react/jsx-runtime").JSX.Element;
@@ -1,3 +1,3 @@
1
1
  export declare function ImportFileUpload({ onDataAdded }: {
2
- onDataAdded: (data: object[]) => void;
2
+ onDataAdded: (data: object[], propertiesOrder?: string[]) => void;
3
3
  }): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { Entity, ResolvedProperties } from "@firecms/core";
2
+ export type BasicExportActionProps = {
3
+ data: Entity<any>[];
4
+ properties: ResolvedProperties;
5
+ propertiesOrder?: string[];
6
+ };
7
+ export declare function BasicExportAction({ data, properties, propertiesOrder }: BasicExportActionProps): import("react/jsx-runtime").JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import React from "react";
2
2
  import { CollectionActionsProps, EntityCollection, User } from "@firecms/core";
3
- export declare function ExportCollectionAction<M extends Record<string, any>, UserType extends User>({ collection: inputCollection, path: inputPath, collectionEntitiesCount, exportAllowed, notAllowedView }: CollectionActionsProps<M, UserType, EntityCollection<M, any>> & {
3
+ export declare function ExportCollectionAction<M extends Record<string, any>, UserType extends User>({ collection: inputCollection, path: inputPath, collectionEntitiesCount, onAnalyticsEvent, exportAllowed, notAllowedView }: CollectionActionsProps<M, UserType, EntityCollection<M, any>> & {
4
4
  exportAllowed?: (props: {
5
5
  collectionEntitiesCount: number;
6
6
  path: string;
@@ -1,10 +1,21 @@
1
- import { Entity, ResolvedEntityCollection, ResolvedProperties } from "@firecms/core";
1
+ import { Entity, ResolvedProperties } from "@firecms/core";
2
2
  interface Header {
3
3
  key: string;
4
4
  label: string;
5
5
  }
6
- export declare function downloadExport<M extends Record<string, any>>(data: Entity<M>[], additionalData: Record<string, any>[] | undefined, collection: ResolvedEntityCollection<M>, flattenArrays: boolean, additionalHeaders: string[] | undefined, exportType: "csv" | "json", dateExportType: "timestamp" | "string"): void;
7
- export declare function getCSVExportableData(data: Entity<any>[], additionalData: Record<string, any>[] | undefined, properties: ResolvedProperties, headers: Header[], dateExportType: "timestamp" | "string"): any[][];
8
- export declare function getJsonExportableData(data: Entity<any>[], additionalData: Record<string, any>[] | undefined, properties: ResolvedProperties, dateExportType: "timestamp" | "string"): any[];
6
+ export interface DownloadEntitiesExportParams<M extends Record<string, any>> {
7
+ data: Entity<M>[];
8
+ additionalData: Record<string, any>[] | undefined;
9
+ properties: ResolvedProperties<M>;
10
+ propertiesOrder: string[] | undefined;
11
+ name: string;
12
+ flattenArrays: boolean;
13
+ additionalHeaders: string[] | undefined;
14
+ exportType: "csv" | "json";
15
+ dateExportType: "timestamp" | "string";
16
+ }
17
+ export declare function downloadEntitiesExport<M extends Record<string, any>>({ data, additionalData, properties, propertiesOrder, name, flattenArrays, additionalHeaders, exportType, dateExportType }: DownloadEntitiesExportParams<M>): void;
18
+ export declare function getEntityCSVExportableData(data: Entity<any>[], additionalData: Record<string, any>[] | undefined, properties: ResolvedProperties, headers: Header[], dateExportType: "timestamp" | "string"): any[][];
19
+ export declare function getEntityJsonExportableData(data: Entity<any>[], additionalData: Record<string, any>[] | undefined, properties: ResolvedProperties, dateExportType: "timestamp" | "string"): any[];
9
20
  export declare function downloadBlob(content: BlobPart[], filename: string, contentType: string): void;
10
21
  export {};
@@ -0,0 +1,4 @@
1
+ export * from "./export";
2
+ export * from "./BasicExportAction";
3
+ export * from "./ExportCollectionAction";
4
+ export * from "./ImportCollectionAction";
package/dist/index.d.ts CHANGED
@@ -3,3 +3,4 @@ export * from "./components";
3
3
  export * from "./types";
4
4
  export * from "./utils";
5
5
  export * from "./hooks";
6
+ export * from "./export_import";