launchpy 0.4.9__tar.gz → 0.5.0__tar.gz

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 (35) hide show
  1. {launchpy-0.4.9/launchpy.egg-info → launchpy-0.5.0}/PKG-INFO +1 -1
  2. {launchpy-0.4.9 → launchpy-0.5.0}/docs/cli.md +118 -26
  3. {launchpy-0.4.9 → launchpy-0.5.0}/docs/getstarted.md +61 -5
  4. {launchpy-0.4.9 → launchpy-0.5.0}/docs/releases.md +19 -1
  5. {launchpy-0.4.9 → launchpy-0.5.0}/docs/synchronizer.md +25 -1
  6. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/__init__.py +41 -2
  7. launchpy-0.5.0/launchpy/__version__.py +1 -0
  8. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/admin.py +6 -4
  9. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/cli/__main__.py +227 -61
  10. launchpy-0.5.0/launchpy/config.py +8 -0
  11. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/configs.py +86 -30
  12. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/connector.py +27 -15
  13. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/launchpy.py +7 -5
  14. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/library.py +5 -4
  15. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/property.py +7 -8
  16. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/synchronizer.py +301 -141
  17. {launchpy-0.4.9 → launchpy-0.5.0/launchpy.egg-info}/PKG-INFO +1 -1
  18. launchpy-0.4.9/launchpy/__version__.py +0 -1
  19. launchpy-0.4.9/launchpy/config.py +0 -24
  20. {launchpy-0.4.9 → launchpy-0.5.0}/LICENSE +0 -0
  21. {launchpy-0.4.9 → launchpy-0.5.0}/README.md +0 -0
  22. {launchpy-0.4.9 → launchpy-0.5.0}/docs/admin.md +0 -0
  23. {launchpy-0.4.9 → launchpy-0.5.0}/docs/library.md +0 -0
  24. {launchpy-0.4.9 → launchpy-0.5.0}/docs/main.md +0 -0
  25. {launchpy-0.4.9 → launchpy-0.5.0}/docs/property.md +0 -0
  26. {launchpy-0.4.9 → launchpy-0.5.0}/docs/translator.md +0 -0
  27. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy/cli/__init__.py +0 -0
  28. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy.egg-info/SOURCES.txt +0 -0
  29. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy.egg-info/dependency_links.txt +0 -0
  30. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy.egg-info/entry_points.txt +0 -0
  31. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy.egg-info/requires.txt +0 -0
  32. {launchpy-0.4.9 → launchpy-0.5.0}/launchpy.egg-info/top_level.txt +0 -0
  33. {launchpy-0.4.9 → launchpy-0.5.0}/pyproject.toml +0 -0
  34. {launchpy-0.4.9 → launchpy-0.5.0}/requirements.txt +0 -0
  35. {launchpy-0.4.9 → launchpy-0.5.0}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: launchpy
3
- Version: 0.4.9
3
+ Version: 0.5.0
4
4
  Summary: Adobe Launch API wrapper
5
5
  Author-email: Julien Piccini <piccini.julien@gmail.com>
6
6
  License: Apache License 2.0
@@ -10,6 +10,7 @@ This document provides an overview of the command line interface (CLI) for `laun
10
10
  - [Instantiation](#instantiation)
11
11
  - [create\_config\_file](#create_config_file)
12
12
  - [config](#config)
13
+ - [change\_org](#change_org)
13
14
  - [get\_properties](#get_properties)
14
15
  - [create\_property](#create_property)
15
16
  - [delete\_property](#delete_property)
@@ -34,6 +35,9 @@ This document provides an overview of the command line interface (CLI) for `laun
34
35
  - [Synchronizer Layer Commands](#synchronizer-layer-commands)
35
36
  - [check\_component](#check_component)
36
37
  - [sync](#sync)
38
+ - [sync\_rules](#sync_rules)
39
+ - [sync\_data\_elements](#sync_data_elements)
40
+ - [sync\_extensions](#sync_extensions)
37
41
  - [rename\_component](#rename_component)
38
42
  - [get\_targets](#get_targets)
39
43
  - [upgrade\_extension](#upgrade_extension)
@@ -99,8 +103,9 @@ The config method also take individual parameters as arguments, which would over
99
103
 
100
104
  #### create_config_file
101
105
  Create a config file to store your credentials and other necessary information for using `launchpy`. This is a one-time setup step that allows you to save your configuration for future use.\
102
- Arguments
103
- `-fn`, `--file_name`: The name of the config file to be created. If not provided, it defaults to `launchpy_config.json`.\
106
+ Arguments:
107
+ `-fn`, `--file_name`: The name of the config file to be created. If not provided, it defaults to `launchpy_config.json`.
108
+ `-m`, `--multi_org`: Flag. If present, generate a config file template for multiple organizations (a JSON list, each entry with its own `org_name`) instead of the default single-organization template (a JSON object).
104
109
 
105
110
  You can create a config file by running the following command:
106
111
 
@@ -109,6 +114,29 @@ python -m launchpy.cli
109
114
  (Cmd) create_config_file
110
115
  ```
111
116
 
117
+ If you need to connect to several Adobe Experience Platform organizations from the same CLI session, generate a multi-org template instead:
118
+
119
+ ```bash
120
+ python -m launchpy.cli
121
+ (Cmd) create_config_file --multi_org
122
+ ```
123
+
124
+ This produces a JSON list of config blocks (instead of a single JSON object), where each block requires an `org_name` key used to reference that organization, for example:
125
+
126
+ ```json
127
+ [
128
+ {
129
+ "org_id": "<orgID>",
130
+ "client_id": "<client_id>",
131
+ "secret": "<YourSecret>",
132
+ "scopes": "<scopes>",
133
+ "org_name": "<org_name>"
134
+ }
135
+ ]
136
+ ```
137
+
138
+ You can duplicate that block for each organization you want to connect to, giving each a unique `org_name`. See the [config](#config) and [change_org](#change_org) commands below for how to use this file.
139
+
112
140
 
113
141
  #### config
114
142
  Setup the API connection to use the full capacity of the CLI.
@@ -119,6 +147,7 @@ Arguments
119
147
  `-sc`,`--scopes`: The scopes that define the permissions for your API connection. This is a required parameter.
120
148
  `-cf`,`--config_file`: The path to the config file that contains your credentials and other necessary information.
121
149
  `-p`,`--property` : The property name to be used and directly instantiated the property layer. This is an optional parameter.
150
+ `-on`,`--org_name`: The organization name to use when your `--config_file` is a multi-org config file (see [create_config_file](#create_config_file)). This is an optional parameter, it defaults to the first organization found in the file (or `default` when using individual parameters).
122
151
 
123
152
  Example via parameters:
124
153
  ```bash
@@ -156,6 +185,27 @@ It also supports direct access to the property layer by providing the property n
156
185
  python -m launchpy.cli --config_file <path_to_your_config_file> --property <your_property_name>
157
186
  ```
158
187
 
188
+ Example with a multi-org config file, connecting directly to the `client_a` organization:
189
+ ```bash
190
+ python -m launchpy.cli
191
+ (Cmd) config --config_file <path_to_your_multi_org_config_file> --org_name client_a
192
+ launchpy:client_a>
193
+ ```
194
+
195
+ When in a non-multi-org environment, the prompt of the CLI will be `launchpy>`, and when in a multi-org environment, the prompt will be `launchpy:<org_name>`, where `<org_name>` is the name of the organization you are currently connected to.\
196
+ By default, the first organization found in the multi-org config file will be used if no `--org_name` is provided. You can switch between organizations using the `change_org` command.
197
+
198
+ #### change_org
199
+ Switch the current CLI session to another organization that has already been loaded from a multi-org config file (via `config` or `--config_file` at startup). This avoids re-running `config` when you need to move between organizations.\
200
+ Arguments:
201
+ `org_name`: The name of the organization to switch to, matching one of the `org_name` values in your multi-org config file. This is a required parameter.
202
+
203
+ ```bash
204
+ python -m launchpy.cli
205
+ (Cmd) config --config_file <path_to_your_multi_org_config_file>
206
+ launchpy:client_a> change_org client_b
207
+ launchpy:client_b>
208
+ ```
159
209
 
160
210
  #### get_properties
161
211
  Retrieve a list of properties associated with your Adobe Developer Project. This command allows you to view the properties that you have access to and can manage using `launchpy`.\
@@ -194,9 +244,11 @@ launchpy> delete_property "Property Name"
194
244
 
195
245
  #### extract_property
196
246
  This method allows you to extract the details of a specific property and save them to a folder.\
197
- The folder name would be the name of the property, it will contains sub folders for each rules.\
247
+ By default, the folder name would be the name of the property, and it will contain sub folders for each rule.\
198
248
  Arguments:
199
249
  `name`: The name of the property to extract. This is a required parameter.
250
+ `-p`, `--published_version`: Boolean. Extract only the latest published version of the components instead of the current (development) version. Default False. Possible values: `True`, `False`
251
+ `-f`, `--folder`: The folder to extract the property into. This is an optional parameter, if not provided, it defaults to a folder named after the property in the current working directory.
200
252
 
201
253
  This can be useful for searching code or for backup purposes.
202
254
 
@@ -206,6 +258,12 @@ python -m launchpy.cli -cf <path_to_your_config_file>
206
258
  launchpy> extract_property "Property Name"
207
259
  ```
208
260
 
261
+ Example extracting the latest published version into a specific folder:
262
+ ```bash
263
+ python -m launchpy.cli -cf <path_to_your_config_file>
264
+ launchpy> extract_property "Property Name" --published_version True --folder "./exports/property_name"
265
+ ```
266
+
209
267
 
210
268
  #### load_property
211
269
  This method load the property layer for a specific property, allowing you to access and manage that property directly.
@@ -248,62 +306,62 @@ Once you have instantiated the property layer for a specific property, you can a
248
306
  #### get_extensions
249
307
  Get all extensions in the property and list them.\
250
308
  Arguments:
251
- `-s`, `--save`: Boolean. Save extensions to a CSV file. Default False. Possible values: `True`, `False`
309
+ `-s`, `--save`: Flag. Save extensions to a CSV file. Default False.
252
310
 
253
311
  ```bash
254
- property_name> get_extensions -s True
312
+ property_name> get_extensions -s
255
313
  ```
256
314
 
257
315
  #### get_extension
258
316
  Get details of a specific extension in the property.\
259
317
  Arguments:
260
318
  `name`: The name of the extension to retrieve details for. This is a required parameter.
261
- `-s`, `--save`: Boolean. Save the extension details to a JSON file. Default False. Possible values: `True`, `False`
319
+ `-s`, `--save`: Flag. Save the extension details to a JSON file. Default False.
262
320
 
263
321
  ```bash
264
- property_name> get_extension "Extension Name" -s True
322
+ property_name> get_extension "Extension Name" -s
265
323
  ```
266
324
 
267
325
  #### get_rules
268
326
  Get all rules in the property and list them.\
269
327
  Arguments:
270
328
  `-n`, `--name`: The name of the rule to filter the results (partial match, non-case sensitive). This is an optional parameter.
271
- `-s`, `--save`: Boolean. Save rules to a CSV file. Default False. Possible values: `True`, `False`
329
+ `-s`, `--save`: Flag. Save rules to a CSV file. Default False.
272
330
 
273
331
  ```bash
274
- property_name> get_rules -n "Rule Name" -s True
332
+ property_name> get_rules -n "Rule Name" -s
275
333
  ```
276
334
 
277
335
  #### get_rule
278
336
  Get details of a specific rule in the property.\
279
337
  Arguments:
280
338
  `name`: The name of the rule to retrieve details for. This is a required parameter.
281
- `-s`, `--save`: Boolean. Save the rule details to a JSON file. Default False. Possible values: `True`, `False`
339
+ `-s`, `--save`: Flag. Save the rule details to a JSON file. Default False.
282
340
 
283
341
  ```bash
284
- property_name> get_rule "Rule Name" -s True
342
+ property_name> get_rule "Rule Name" -s
285
343
  ```
286
344
 
287
345
  #### get_rules_components
288
346
  Get all rule components, and save them to a CSV file if specified. Intended to be used for all components, but can be filtering.\
289
347
  Arguments:
290
- `-s`, `--save`: Boolean. Save rules components to a CSV file. Default False. Possible values: `True`, `False`
348
+ `-s`, `--save`: Flag. Save rules components to a CSV file. Default False.
291
349
  `-rn`, `--rule_name`: (Partial) Name of the rule to get components for. This is an optional parameter.
292
350
  `-rid`, `--rule_id`: ID of the rule to get components for. This is an optional parameter, if both `rule_name` and `rule_id` are provided, it will use `rule_id`.
293
351
 
294
352
  ```bash
295
- property_name> get_rules_components -s True
353
+ property_name> get_rules_components -s
296
354
  ```
297
355
 
298
356
  #### get_rule_components
299
357
  Get all components for a specific rule by name or ID. Way more effective than the other methods and provide more details.\
300
358
  Arguments:
301
- `-s`, `--save`: Boolean. Save the rule components to a JSON file. Default False. Possible values: `True`, `False`
359
+ `-s`, `--save`: Flag. Save the rule components to a JSON file. Default False.
302
360
  `-rn`, `--rule_name`: (Partial) Name of the rule to get components for. This is an optional parameter.
303
361
  `-rid`, `--rule_id`: ID of the rule to get components for. This is an optional parameter, if both `rule_name` and `rule_id` are provided, it will use `rule_id`.
304
362
 
305
363
  ```bash
306
- property_name> get_rule_components -rn "Rule Name" -s True
364
+ property_name> get_rule_components -rn "Rule Name" -s
307
365
  ```
308
366
 
309
367
  #### get_data_elements
@@ -320,10 +378,10 @@ property_name> get_data_elements -n "Data Element Name" -s True
320
378
  Get details of a specific data element in the property.\
321
379
  Arguments:
322
380
  `name`: The name of the data element to retrieve details for. This is a required parameter.
323
- `-s`, `--save`: Boolean. Save the data element details to a JSON file. Default False. Possible values: `True`, `False`
381
+ `-s`, `--save`: Flag. Save the data element details to a JSON file. Default False.
324
382
 
325
383
  ```bash
326
- property_name> get_data_element "Data Element Name" -s True
384
+ property_name> get_data_element "Data Element Name" -s
327
385
  ```
328
386
 
329
387
  #### get_latest_published_version
@@ -331,20 +389,20 @@ Get the latest published version of a specific component in the property.\
331
389
  Arguments:
332
390
  `-n`, `--name`: The name of the component to get the latest published version for. This is a required parameter.
333
391
  `-t`, `--type`: The type of the component (e.g. 'rule', 'data_element', 'extension') to get the latest published version for. This is a required parameter.
334
- `-s`, `--save`: Boolean. Save the latest published version details to a JSON file. Default False. Possible values: `True`, `False`
392
+ `-s`, `--save`: Flag. Save the latest published version details to a JSON file. Default False.
335
393
 
336
394
  ```bash
337
- property_name> get_latest_published_version -n "Component Name" -t "rule" -s True
395
+ property_name> get_latest_published_version -n "Component Name" -t "rule" -s
338
396
  ```
339
397
 
340
398
  #### get_libraries
341
399
  Get all libraries in the property and list them.\
342
400
  Arguments:
343
- `-s`, `--save`: Boolean. Save libraries to a CSV file. Default False. Possible values: `True`, `False`
401
+ `-s`, `--save`: Flag. Save libraries to a CSV file. Default False.
344
402
  `-st`, `--state`: Filter by library state. Possible values: 'development' (default), 'submitted', 'approved', 'rejected', 'published'. This is an optional parameter.
345
403
 
346
404
  ```bash
347
- property_name> get_libraries -s True -st "development"
405
+ property_name> get_libraries -s -st "development"
348
406
  ```
349
407
 
350
408
  #### delete_library
@@ -382,10 +440,10 @@ Check if a specific component is in sync between the base property and target pr
382
440
  Arguments:
383
441
  `-n`, `--name`: The name of the component to check for synchronization. This is a required parameter.
384
442
  `-id`, `--id`: ID of the component to check (overrides name if both provided)
385
- `-p`, `--published` : Boolean. Check the synchronization based on the latest published version of the component. Default False. Possible values: `True`, `False`
443
+ `-p`, `--published` : Flag. Check the synchronization based on the latest published version of the component. Default False.
386
444
 
387
445
  ```bash
388
- synchronizer:Base_Property_Name> check_component -n "Component Name" -p True
446
+ synchronizer:Base_Property_Name> check_component -n "Component Name" -p
389
447
  ```
390
448
 
391
449
  #### sync
@@ -393,11 +451,45 @@ Synchronize a specific component between the base property and target properties
393
451
  Arguments:
394
452
  `-n`, `--name`: The name of the component to synchronize. This is a required parameter.
395
453
  `-id`, `--id`: ID of the component to synchronize (overrides name if both provided)
396
- `-p`, `--published` : Boolean. Synchronize the latest published version of the component. Default `False`. Possible values: `True`, `False`
397
- `-f`, `--force` : Boolean. Create the component if it does not exist. Default `True`. Possible values: `True`, `False`
454
+ `-p`, `--published` : Flag. Synchronize the latest published version of the component. Default False.
455
+ `-c`, `--create` : Flag. Create the component if it does not exist. Default False.
456
+ `-v`, `--verbose` : Flag. Print detailed information about the sync process. Default False.
457
+
458
+ ```bash
459
+ synchronizer:Base_Property_Name> sync -n "Component Name" -p -c
460
+ ```
461
+
462
+ #### sync_rules
463
+ Synchronize all rules between the base property and target properties in a single call, instead of syncing them one by one with [sync](#sync).\
464
+ Arguments:
465
+ `-r`, `--regex`: Regex pattern to filter rules by name (partial match, non-case sensitive). This is an optional parameter, if not provided, all rules are synced.
466
+ `-c`, `--create` : Flag. Create rules that do not exist in the destination property. Default False.
467
+ `-p`, `--published` : Flag. Sync the latest published version of the rules. Default False.
468
+
469
+ ```bash
470
+ synchronizer:Base_Property_Name> sync_rules -r "Rule Name" -c
471
+ ```
472
+
473
+ #### sync_data_elements
474
+ Synchronize all data elements between the base property and target properties in a single call, instead of syncing them one by one with [sync](#sync).\
475
+ Arguments:
476
+ `-r`, `--regex`: Regex pattern to filter data elements by name (partial match, non-case sensitive). This is an optional parameter, if not provided, all data elements are synced.
477
+ `-c`, `--create` : Flag. Create data elements that do not exist in the destination property. Default False.
478
+ `-p`, `--published` : Flag. Sync the latest published version of the data elements. Default False.
479
+
480
+ ```bash
481
+ synchronizer:Base_Property_Name> sync_data_elements -r "Data Element Name" -c
482
+ ```
483
+
484
+ #### sync_extensions
485
+ Synchronize all extensions between the base property and target properties in a single call, instead of syncing them one by one with [sync](#sync).\
486
+ Arguments:
487
+ `-r`, `--regex`: Regex pattern to filter extensions by name (partial match, non-case sensitive). This is an optional parameter, if not provided, all extensions are synced.
488
+ `-c`, `--create` : Flag. Create extensions that do not exist in the destination property. Default False.
489
+ `-v`, `--verbose` : Flag. Print detailed information about the sync process. Default False.
398
490
 
399
491
  ```bash
400
- synchronizer:Base_Property_Name> sync -n "Component Name" -p True -f True
492
+ synchronizer:Base_Property_Name> sync_extensions -r "Extension Name" -c
401
493
  ```
402
494
 
403
495
  #### rename_component
@@ -23,17 +23,49 @@ import launchpy as lp
23
23
  lp.createConfigFile()
24
24
  ```
25
25
 
26
+ It takes these parameters:
27
+ * filename : OPTIONAL : The name of the JSON file to create. Default: "config_launch.json"
28
+ * auth_type : OPTIONAL : The type of authentication to use. Default: "oauthV2".
29
+ * scope : OPTIONAL : The scope of the authentication. Default: "https://ims-na1.adobelogin.com/s/ent_reactor_admin_sdk".
30
+ if any problem occurs, you can update the scope to "https://ims-na1.adobelogin.com/s/ent_reactor_sdk"
31
+ * multi_org : OPTIONAL : If set to True, it will create a multi-org config file. Default: False.
32
+
33
+
34
+ The config JSON will look like:
35
+
36
+ ```JSON
37
+ {
38
+ "org_id": "<orgID>",
39
+ "client_id": "<client_id>",
40
+ "secret": "<YourSecret>",
41
+ "scopes": "<scopes>",
42
+ }
43
+ ```
44
+
26
45
  This will create a JSON and you will need to fill it with the information available in your adobe io account.
27
46
 
28
47
  **NOTE**: scope in the config file has evolved over time so you can change it. Following this [link](https://www.adobe.io/authentication/auth-methods.html#!AdobeDocs/adobeio-auth/master/JWT/Scopes.md) to see the different scope possible.\
29
48
  You can change the `scope` attribute for one of these values: `"https://ims-na1.adobelogin.com/s/ent_reactor_admin_sdk"` or `"https://ims-na1.adobelogin.com/s/ent_reactor_sdk"`
30
49
  By default, I will test the dev scope if the scope provided fails. So normally nothing you need to do.
31
50
 
32
- **NOTE 2**: There is a possibility till end of 2024 to use the JWT.\
33
- launchpy supports both `jwt` and `oauthV2` authentication.\
34
- By default the latest version will try to use the `oauthV2`.\
35
- You can specify the keys generated in the config file by using the `auth_type` parameter.\
36
- Possible values : `oauthV2` (default) or `jwt`
51
+
52
+ ### 3. Bis Multi Org Setup
53
+
54
+ In case you have a multi IMS Org setup and you would need to do synchronization between different IMS Org, you can use the `multi_org` parameter to create a multi-org config file.\
55
+ This will change your JSON file into a list, and add the `org_name` attribute.\
56
+ So your config file will look like this:
57
+ ```JSON
58
+ [
59
+ {
60
+ "org_id": "<orgID>",
61
+ "client_id": "<client_id>",
62
+ "secret": "<YourSecret>",
63
+ "scopes": "<scopes>",
64
+ "org_name": "<org_name>"
65
+ }
66
+ ]
67
+
68
+ ```
37
69
 
38
70
 
39
71
  ## 4. Import the configuration file
@@ -45,6 +77,30 @@ I would recommend to store the config file and the key in the folder that you ar
45
77
  lp.importConfigFile('myconfig.json')
46
78
  ```
47
79
 
80
+ ### 4. Bis Multi Org Setup
81
+
82
+ In case you are loading multi org setup, you need to have the `org_name` attribute filled.\
83
+ So your config file will look like this:
84
+ ```JSON
85
+ [
86
+ {
87
+ "org_id": "<orgID>",
88
+ "client_id": "<client_id>",
89
+ "secret": "<YourSecret>",
90
+ "scopes": "<scopes>",
91
+ "org_name": "org_name1"
92
+ },
93
+ {
94
+ "org_id": "<orgID>",
95
+ "client_id": "<client_id>",
96
+ "secret": "<YourSecret>",
97
+ "scopes": "<scopes>",
98
+ "org_name": "org_name2"
99
+ }
100
+ ]
101
+ ```
102
+
103
+
48
104
  ## 5. Instantiate the Admin class & get Company ID to retrieve properties
49
105
 
50
106
  Once all of these setup steps are completed, you can instantiate the `Admin` class.
@@ -3,11 +3,29 @@
3
3
  This page gathered the changes made between version of the launchpy module.\
4
4
  This has been started after the 0.3.0 release.\
5
5
 
6
+ ## 0.5.0
7
+ * Adding option to extract only the latest published version of the artifacts when extracting a property. This is available in the CLI with the `-p` or `--published_version` flag and in the `extractProperty` function with the `publishedVersion` parameter.
8
+ * Fixing the `create_property` method in the CLI
9
+ * Adding support for multi-org config files.
10
+ * Adding support for multi-org instantiation in the synchronizer module.
11
+ * Adding capability to sync extensions via syncComponent method.
12
+ * Adding `sync_rules` capabilitiy in the CLI and `syncRules` in synchronizer module.
13
+ * Adding `sync_extensions` capabilitiy in the CLI and `syncExtensions` in synchronizer module.
14
+ * Adding `sync_data_elements` capabilitiy in the CLI and `syncDataElements` in synchronizer module.
15
+ * Fixing the `createTargetsLibrary` method in the synchronizer where using existing library that contained rules not touched by the synchronizer would delete them. Now it will keep them and only update the ones that are in the source property.
16
+ * `extractProperty` can now extract the elements as they are in their published version. This is available in the CLI with the `-p` or `--published_version` flag and in the `extractProperty` function with the `publishedVersion` parameter.
17
+ * `extractProperty` has a new parameter `folder` that allows you to specify the folder where the property will be extracted. If None, a folder named after the property name will be created in the current working directory.
18
+
19
+
6
20
  ## 0.4.9
7
21
  * fixing httpx dependency requirement
8
22
  * extractProperty will now also extract Data Elements and Extensions configurations in separate folders.
9
23
  * fix the argument handling for linkedLibrary in CLI.
10
- * Change of the `force` parameter to `create` in the synchronizer CLI for better understanding of the action. `create` is now default to `False`. The synchronizer module keeps its long name `forceCreation` for backward compatibility and better understanding of the action. Also turning it to `False` by default.
24
+ * Change of the `force` parameter to `create` in the synchronizer CLI for better understanding of the action. `create` is now default to `False`. The synchronizer module keeps its long name `forceCreation` for backward compatibility and better understanding of the action. Also turning it to `False` by default. \
25
+ Patch:
26
+ * adding a `verbose` parameter to the synchronizer CLI for better understanding of the process. Default to `False`.
27
+ * adding a `verbose` parameter to the synchronizer module for better understanding of the process. Default to `False`.
28
+ * fixing default value for `create` parameter and its documentation in the CLI.
11
29
 
12
30
  ## 0.4.8
13
31
  * Adding the `clear` method in CLI
@@ -137,7 +137,7 @@ You can pass down a list of component names or componentIds.\
137
137
  It takes 3 arguments:\
138
138
  Arguments:
139
139
  * componentsName : REQUIRED : The list of component names to sync
140
- * componentsId : REQUIRED : The list of component ID to sync*
140
+ * componentsId : REQUIRED : The list of component ID to sync
141
141
  * publishedVersion : OPTIONAL : if you want to take the version that has been published
142
142
 
143
143
  ## syncFromLibrary
@@ -158,6 +158,30 @@ By default, the method will sync the components present in the library as they a
158
158
  If the `publishedVersion` is set to True, it will try to sync the version that has been published in the base property to the targets.\
159
159
  If the `libraryLinked` is set to `False` and the `publishedVersion` is set to `False` (default), it will try to sync the latest version of the components present in the base property library to the targets.\
160
160
 
161
+ ## syncExtensions
162
+
163
+ This method allows you to sync the extension(s) from the base property to the target properties.\
164
+ It will check if the extension is already installed in the target property, if not, it will install it if you have used the forceCreation parameter. Note that we cannot guarantee the same version as only the latest version is available for installation.\
165
+ If the extension(s) is already installed, it will check if the settings are the same, if not, it will update the settings to match the base property.\
166
+ Arguments:
167
+ * regex : OPTIONAL : If you want to filter the extensions name to sync based on a regex pattern. Default: None (sync all extensions)
168
+ * forceCreation : OPTIONAL : If set to True, will force the creation of the extension even if it already exists. Default: False
169
+
170
+ ## syncDataElements
171
+ Synchronizing the data elements in the base property to the target properties.
172
+ Arguments:
173
+ * regex : OPTIONAL : If you want to filter the data elements to sync based on a regex pattern. Default: None (sync all data elements)
174
+ * forceCreation : OPTIONAL : If set to True, it will sync the data elements even if they do not exist in the target properties. If set to False, it will only sync the data elements that already exist in the target properties. Default: False.
175
+ * publishedVersion : OPTIONAL : If set to True, it will sync the latest published version of the data elements. Default: False.
176
+
177
+ ## SyncRules
178
+ It will synchronize the rules in the base property to the target properties.
179
+ Arguments:
180
+ * regex : OPTIONAL : If you want to filter the rules to sync based on a regex pattern. Default: None (sync all rules)
181
+ * forceCreation : OPTIONAL : If set to True, it will sync the rules even if they do not exist in the target properties. If set to False, it will only sync the rules that already exist in the target properties. Default: False.
182
+ * publishedVersion : OPTIONAL : If set to True, it will sync the latest published version of the rules. Default: False.
183
+
184
+
161
185
  ## createTargetsLibrary
162
186
 
163
187
  The synchronizer will automatically track the component that has been updated via the module.\
@@ -60,7 +60,15 @@ async def write_all_data_elements(data_elements_list, folder, header):
60
60
  json.dump(data_element, f, indent=4)
61
61
 
62
62
 
63
- def extractProperty(property: dict | Property):
63
+ def extractProperty(property: dict | Property, publishedVersion: bool = False,folder: str = None):
64
+ """
65
+ Extract the rules, Data Elements and Extensions configuration for a given property and save them in a folder named after the property.
66
+ Arguments:
67
+ property: dict | Property: The property to extract. Can be a Property object or a dictionary containing the property data.
68
+ publishedVersion: bool: If True, only the latest published version of each rule will be extracted. If False, all rules as latest state will be extracted.
69
+ For rules that are not yet published, the latest state will be extracted regardless of the value of this parameter.
70
+ folder : str: The folder where the property will be extracted. If None, a folder named after the property will be created in the current working directory.
71
+ """
64
72
  if property is None:
65
73
  raise ValueError("Property is None")
66
74
  elif type(property) is not Property and type(property) is dict:
@@ -68,17 +76,48 @@ def extractProperty(property: dict | Property):
68
76
  property = Property(property)
69
77
  else:
70
78
  raise ValueError("Property is not of type Property")
71
- folder = __safe_name__(property.name)
79
+ if folder is None:
80
+ folder = __safe_name__(property.name)
72
81
  Path(folder).mkdir(parents=True, exist_ok=True)
73
82
  rules = property.getRules()
83
+ if publishedVersion:
84
+ published_rules = []
85
+ for rule in rules:
86
+ revisions = property.getRevisions(rule)
87
+ try:
88
+ publishedRule = property.getLatestPublishedVersion(revisions)
89
+ published_rules.append(publishedRule)
90
+ except Exception as e:
91
+ published_rules.append(rule)
92
+ rules = published_rules
74
93
  asyncio.run(process_all_rules(rules, folder, property.header))
75
94
  dataElements = property.getDataElements()
95
+ if publishedVersion:
96
+ published_data_elements = []
97
+ for data_element in dataElements:
98
+ revisions = property.getRevisions(data_element)
99
+ try:
100
+ publishedDataElement = property.getLatestPublishedVersion(revisions)
101
+ published_data_elements.append(publishedDataElement)
102
+ except Exception as e:
103
+ published_data_elements.append(data_element)
104
+ dataElements = published_data_elements
76
105
  dataElements_folder = Path(folder) / "data_elements"
77
106
  Path(dataElements_folder).mkdir(parents=True, exist_ok=True)
78
107
  asyncio.run(write_all_data_elements(dataElements, dataElements_folder, property.header))
79
108
  extension_folder = Path(folder) / "extensions"
80
109
  extension_folder.mkdir(parents=True, exist_ok=True)
81
110
  extensions = property.getExtensions()
111
+ if publishedVersion:
112
+ published_extensions = []
113
+ for extension in extensions:
114
+ revisions = property.getRevisions(extension)
115
+ try:
116
+ publishedExtension = property.getLatestPublishedVersion(revisions)
117
+ published_extensions.append(publishedExtension)
118
+ except Exception as e:
119
+ published_extensions.append(extension)
120
+ extensions = published_extensions
82
121
  for extension in extensions:
83
122
  extension_name = __safe_name__(extension['attributes']['name'])
84
123
  file_path = extension_folder / f"{extension_name}.json"
@@ -0,0 +1 @@
1
+ __version__ = "0.5.0"
@@ -6,12 +6,14 @@ from .property import Property
6
6
 
7
7
  class Admin:
8
8
 
9
- def __init__(self,config_object:dict=config.config_object,header:dict=config.header):
9
+ def __init__(self, _connector: connector.AdobeRequest = None, org_name: str = None):
10
10
  """
11
- Instantiate the connector for the Login class
11
+ Instantiate the connector for the Login class.
12
+ Arguments:
13
+ _connector : OPTIONAL : Pass an existing AdobeRequest instance (internal use / multi-org).
14
+ org_name : OPTIONAL : The name of the organization (internal use / multi-org).
12
15
  """
13
- self.connector = connector.AdobeRequest(
14
- config_object=config_object, header=header)
16
+ self.connector = _connector if _connector is not None else connector.AdobeRequest(org_name=org_name)
15
17
  self.header = self.connector.header
16
18
  self.COMPANY_ID = ""
17
19
  self.COMPANY_NAME = ""