@enonic-types/lib-export 0.1.1 → 7.11.0-B3

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 (3) hide show
  1. package/README.md +4 -4
  2. package/export.d.ts +95 -95
  3. package/package.json +33 -32
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  ## Install
6
6
 
7
7
  ```bash
8
- npm i --save-dev @enonic/lib-export
8
+ npm i --save-dev @enonic-types/lib-export
9
9
  ```
10
10
 
11
11
  ## Use
@@ -26,8 +26,8 @@ Add the corresponding types to your `tsconfig.json` file that is used for applic
26
26
 
27
27
  ### Require and custom imports
28
28
 
29
- To make `require` work out of box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP global
30
- objects, e.g. `log`, `app`, `__`, etc, requiring library by the default path will return typed object.
29
+ To make `require` work out of the box, you must install and add the `@enonic-types/global` types. Aside from providing definitions for XP
30
+ global objects, e.g. `log`, `app`, `__`, etc, requiring a library by the default path will return typed object.
31
31
 
32
32
  `tsconfig.json`
33
33
 
@@ -49,7 +49,7 @@ const {importNodes, exportNodes} = require('/lib/xp/export');
49
49
  ```
50
50
 
51
51
  More detailed explanation on how it works and how to type custom import function can be
52
- found [here](https://github.com/enonic/xp/tree/master/modules/lib/typescript/README.md).
52
+ found [here](https://developer.enonic.com/docs/xp/stable/api).
53
53
 
54
54
  ### ES6-style import
55
55
 
package/export.d.ts CHANGED
@@ -1,95 +1,95 @@
1
- /**
2
- * Export related functions.
3
- *
4
- * @example
5
- * var exportLib = require('/lib/xp/export');
6
- *
7
- * @module export
8
- */
9
- declare global {
10
- interface XpLibraries {
11
- '/lib/xp/export': typeof import('./export');
12
- }
13
- }
14
- export interface ResourceKey {
15
- applicationKey: string;
16
- path: string;
17
- uri: string;
18
- root: boolean;
19
- name: string;
20
- extension: string;
21
- }
22
- export interface ImportNodesParams {
23
- source: string | object;
24
- targetNodePath: string;
25
- xslt?: string | ResourceKey;
26
- xsltParams?: unknown;
27
- includeNodeIds?: boolean;
28
- includePermissions?: boolean;
29
- nodeResolved: (numberOfNodes: number) => void;
30
- nodeImported: (numberOfImportedNodes: number) => void;
31
- }
32
- export interface ImportNodesError {
33
- exception: string;
34
- message: string;
35
- stacktrace: string[];
36
- }
37
- export interface ImportNodesResult {
38
- addedNodes: string[];
39
- updatedNodes: string[];
40
- importedBinaries: string[];
41
- importErrors: ImportNodesError[];
42
- }
43
- /**
44
- * Import nodes from a nodes-export.
45
- * Could be used to import node-export from exports directory or from application resource files.
46
- * Optionally pre-transforms node XML node files with XSLT before import.
47
- *
48
- * @example-ref examples/export/importNodes.js
49
- *
50
- * @param {object} params JSON with the parameters.
51
- * @param {string|object} params.source Either name of nodes-export located in exports directory or application resource key.
52
- * @param {string} params.targetNodePath Target path for imported nodes.
53
- * @param {string|object} [params.xslt] XSLT file name in exports directory or application resource key. Used for XSLT transformation.
54
- * @param {object} [params.xsltParams] Parameters used in XSLT transformation.
55
- * @param {boolean} [params.includeNodeIds=false] Set to true to use node IDs from the import, false to generate new node IDs.
56
- * @param {boolean} [params.includePermissions=false] Set to true to use Node permissions from the import, false to use target node permissions.
57
- * @param {function} [params.nodeResolved] A function to be called before import starts with number of nodes to import.
58
- * @param {function} [params.nodeImported] A function to be called during import with number of nodes imported since last call.
59
- *
60
- * @returns {ImportNodesResult} Node import results.
61
- */
62
- export declare function importNodes(params: ImportNodesParams): ImportNodesResult;
63
- export interface ExportNodesParams {
64
- sourceNodePath: string;
65
- exportName: string;
66
- includeNodeIds?: boolean;
67
- includeVersions?: boolean;
68
- nodeResolved: (numberOfNodes: number) => void;
69
- nodeExported: (numberOfExportedNodes: number) => void;
70
- }
71
- export interface ExportNodesError {
72
- message: string;
73
- }
74
- export interface ExportNodesResult {
75
- exportedNodes: string[];
76
- exportedBinaries: string[];
77
- exportErrors: ExportNodesError[];
78
- }
79
- /**
80
- * Export nodes to a nodes-export.
81
- * Export is created in exports directory.
82
- *
83
- * @example-ref examples/export/exportNodes.js
84
- *
85
- * @param {object} params JSON with the parameters.
86
- * @param {string} params.sourceNodePath Source nodes path.
87
- * @param {string} params.exportName Export name.
88
- * @param {boolean} [params.includeNodeIds=true] Set to true to export node IDs.
89
- * @param {boolean} [params.includeVersions=false] Set to true to export all node versions.
90
- * @param {function} [params.nodeResolved] A function to be called before export starts with number of nodes to export.
91
- * @param {function} [params.nodeExported] A function to be called during export with number of nodes exported since last call.
92
- *
93
- * @returns {ExportNodesResult} Node export results.
94
- */
95
- export declare function exportNodes(params: ExportNodesParams): ExportNodesResult;
1
+ /**
2
+ * Export related functions.
3
+ *
4
+ * @example
5
+ * var exportLib = require('/lib/xp/export');
6
+ *
7
+ * @module export
8
+ */
9
+ declare global {
10
+ interface XpLibraries {
11
+ '/lib/xp/export': typeof import('./export');
12
+ }
13
+ }
14
+ export interface ResourceKey {
15
+ applicationKey: string;
16
+ path: string;
17
+ uri: string;
18
+ root: boolean;
19
+ name: string;
20
+ extension: string;
21
+ }
22
+ export interface ImportNodesParams {
23
+ source: string | object;
24
+ targetNodePath: string;
25
+ xslt?: string | ResourceKey;
26
+ xsltParams?: unknown;
27
+ includeNodeIds?: boolean;
28
+ includePermissions?: boolean;
29
+ nodeResolved: (numberOfNodes: number) => void;
30
+ nodeImported: (numberOfImportedNodes: number) => void;
31
+ }
32
+ export interface ImportNodesError {
33
+ exception: string;
34
+ message: string;
35
+ stacktrace: string[];
36
+ }
37
+ export interface ImportNodesResult {
38
+ addedNodes: string[];
39
+ updatedNodes: string[];
40
+ importedBinaries: string[];
41
+ importErrors: ImportNodesError[];
42
+ }
43
+ /**
44
+ * Import nodes from a nodes-export.
45
+ * Could be used to import node-export from exports directory or from application resource files.
46
+ * Optionally pre-transforms node XML node files with XSLT before import.
47
+ *
48
+ * @example-ref examples/export/importNodes.js
49
+ *
50
+ * @param {object} params JSON with the parameters.
51
+ * @param {string|object} params.source Either name of nodes-export located in exports directory or application resource key.
52
+ * @param {string} params.targetNodePath Target path for imported nodes.
53
+ * @param {string|object} [params.xslt] XSLT file name in exports directory or application resource key. Used for XSLT transformation.
54
+ * @param {object} [params.xsltParams] Parameters used in XSLT transformation.
55
+ * @param {boolean} [params.includeNodeIds=false] Set to true to use node IDs from the import, false to generate new node IDs.
56
+ * @param {boolean} [params.includePermissions=false] Set to true to use Node permissions from the import, false to use target node permissions.
57
+ * @param {function} [params.nodeResolved] A function to be called before import starts with number of nodes to import.
58
+ * @param {function} [params.nodeImported] A function to be called during import with number of nodes imported since last call.
59
+ *
60
+ * @returns {ImportNodesResult} Node import results.
61
+ */
62
+ export declare function importNodes(params: ImportNodesParams): ImportNodesResult;
63
+ export interface ExportNodesParams {
64
+ sourceNodePath: string;
65
+ exportName: string;
66
+ includeNodeIds?: boolean;
67
+ includeVersions?: boolean;
68
+ nodeResolved: (numberOfNodes: number) => void;
69
+ nodeExported: (numberOfExportedNodes: number) => void;
70
+ }
71
+ export interface ExportNodesError {
72
+ message: string;
73
+ }
74
+ export interface ExportNodesResult {
75
+ exportedNodes: string[];
76
+ exportedBinaries: string[];
77
+ exportErrors: ExportNodesError[];
78
+ }
79
+ /**
80
+ * Export nodes to a nodes-export.
81
+ * Export is created in exports directory.
82
+ *
83
+ * @example-ref examples/export/exportNodes.js
84
+ *
85
+ * @param {object} params JSON with the parameters.
86
+ * @param {string} params.sourceNodePath Source nodes path.
87
+ * @param {string} params.exportName Export name.
88
+ * @param {boolean} [params.includeNodeIds=true] Set to true to export node IDs.
89
+ * @param {boolean} [params.includeVersions=false] Set to true to export all node versions.
90
+ * @param {function} [params.nodeResolved] A function to be called before export starts with number of nodes to export.
91
+ * @param {function} [params.nodeExported] A function to be called during export with number of nodes exported since last call.
92
+ *
93
+ * @returns {ExportNodesResult} Node export results.
94
+ */
95
+ export declare function exportNodes(params: ExportNodesParams): ExportNodesResult;
package/package.json CHANGED
@@ -1,32 +1,33 @@
1
- {
2
- "name": "@enonic-types/lib-export",
3
- "version": "0.1.1",
4
- "description": "Type definitions for lib-export.",
5
- "types": "export.d.ts",
6
- "files": [
7
- "export.d.ts"
8
- ],
9
- "repository": {
10
- "type": "git",
11
- "url": "git+https://github.com/enonic/xp.git#master"
12
- },
13
- "keywords": [
14
- "enonic",
15
- "enonic-xp",
16
- "lib-export",
17
- "export",
18
- "types",
19
- "typescript"
20
- ],
21
- "contributors": [
22
- "Mikita Taukachou <edloidas@gmail.com> (https://edloidas.github.io/)"
23
- ],
24
- "license": "Apache-2.0",
25
- "bugs": {
26
- "url": "https://github.com/enonic/xp/issues"
27
- },
28
- "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
- "publishConfig": {
30
- "access": "public"
31
- }
32
- }
1
+ {
2
+ "name": "@enonic-types/lib-export",
3
+ "version": "7.11.0-B3",
4
+ "description": "Type definitions for lib-export.",
5
+ "types": "export.d.ts",
6
+ "files": [
7
+ "export.d.ts"
8
+ ],
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/enonic/xp.git#master"
12
+ },
13
+ "keywords": [
14
+ "enonic",
15
+ "enonic-xp",
16
+ "lib-export",
17
+ "export",
18
+ "types",
19
+ "typescript"
20
+ ],
21
+ "contributors": [
22
+ "Mikita Taukachou <edloidas@gmail.com> (https://edloidas.github.io/)"
23
+ ],
24
+ "license": "Apache-2.0",
25
+ "bugs": {
26
+ "url": "https://github.com/enonic/xp/issues"
27
+ },
28
+ "homepage": "https://github.com/enonic/xp/tree/master#readme",
29
+ "dependencies": {},
30
+ "publishConfig": {
31
+ "access": "public"
32
+ }
33
+ }