@fluid-app/fluid-cli-connect 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 ADDED
@@ -0,0 +1,82 @@
1
+ # @fluid-app/fluid-cli-connect
2
+
3
+ Fluid CLI plugin for Fluid Connect: link a back-office platform (Exigo,
4
+ InfoTrax, ByDesign, or Pillars) to Fluid, then set its credentials, data
5
+ mappings, and sync settings.
6
+
7
+ ```bash
8
+ npm install -g @fluid-app/fluid-cli @fluid-app/fluid-cli-connect
9
+ fluid login
10
+ fluid connect list # each provider and whether it's installed
11
+ fluid connect install exigo --yes # install the droplet, creating the connection
12
+ fluid connect credentials exigo --yes \
13
+ --set api.company=acme --set api.username=api_user --set api.password=... \
14
+ --set mssql.dataserver=sql.example.com --set mssql.database=acme \
15
+ --set mssql.username=reader --set mssql.password=...
16
+ fluid connect show exigo # state, supported mappings, every setting
17
+ fluid connect unmapped exigo --auto-map --yes # map exact name matches, list what's left
18
+ fluid connect mappings exigo customer_type --options # Fluid's and Exigo's values to map
19
+ fluid connect map exigo customer_type --yes --set source_type_slug=rep --set target_type_id=2
20
+ fluid connect settings exigo --yes --defaults # take every default
21
+ fluid connect settings exigo --yes --set order.refund_handling=hold
22
+ ```
23
+
24
+ ## Set up interactively
25
+
26
+ ```bash
27
+ fluid connect walk exigo # or: fluid setup run connect-exigo
28
+ ```
29
+
30
+ `walk` runs the whole setup in the terminal, one question at a time:
31
+
32
+ 1. Installs the provider if it isn't installed, after you confirm.
33
+ 2. Asks each credential (passwords and tokens are typed hidden; Exigo also
34
+ asks the environment, and the sandbox ID outside production). Fluid tests
35
+ the connection before saving; if the provider refuses, its reason is shown
36
+ and the questions are asked again, with Enter keeping what you typed.
37
+ On a connected provider, you can keep the saved credentials.
38
+ 3. Maps what's unmapped. Exigo first offers to map exact name matches, then
39
+ gives a searchable list of Exigo's values; for the others you type the
40
+ provider's value. Answer `*` to send every remaining value of that type to
41
+ one value. Ranks and ship methods get a note and an optional row by hand.
42
+ 4. Settings: keep them as they are, put them all back to the defaults, or go
43
+ through the common settings, each with its label, description, default,
44
+ and options.
45
+ 5. Prints a summary, and the result as JSON.
46
+
47
+ Every answer is saved as you give it, through the same calls as the commands
48
+ above. Type `<` to go back (a changed mapping replaces the row it saved), `>`
49
+ to skip, and `?` for the menu: jump to a part, change an answer, finish, or
50
+ stop. Run `walk` again later to pick up what's left. In a script, use the
51
+ commands above with `--yes`; `walk` needs a terminal.
52
+
53
+ ## Commands
54
+
55
+ `unmapped` lists, per mapping type, the Fluid values that have no row and no
56
+ `*` fallback. `done: true` means nothing is left. Ranks and ship methods come
57
+ back as `check_by_hand` because the API doesn't list Fluid's values for them.
58
+ `--auto-map` works for Exigo only, since it is the one provider whose values
59
+ the API lists. It adds a row wherever a Fluid value's name matches exactly one
60
+ Exigo value, and leaves ambiguous names for a person.
61
+
62
+ A new connection already starts on the default settings. `settings --defaults`
63
+ puts them back, all at once or one at a time with `--only order.refund_handling`.
64
+
65
+ Values passed with `--set` end up in your shell history and are visible in
66
+ process listings. For passwords and tokens, prefer `fluid connect walk`, which
67
+ asks for them without echoing. `credentials` keeps every value as typed (a
68
+ password like `123456` stays a string), and creates the connection if
69
+ installing the droplet hasn't yet. `unmapped` exits non-zero when a mapping
70
+ type couldn't be checked.
71
+
72
+ Every command prints JSON; failures print a JSON `error` on stderr and exit
73
+ non-zero. A failed credential test prints the provider's reason in `details`.
74
+ Commands that change live configuration ask for confirmation unless you pass
75
+ `--yes`.
76
+
77
+ The CLI talks to two services with the same Fluid API token: api.fluid.app to
78
+ install the droplet, and fluid-integrations for everything else. Set
79
+ `FLUID_INTEGRATIONS_BASE` to point at another fluid-integrations host.
80
+
81
+ The walkthroughs for each provider, including data mapping and the common
82
+ settings, are the Connect guided setups at https://docs.fluid.app/setup.
@@ -0,0 +1,14 @@
1
+ import { CommandContext, FluidPlugin } from "@fluid-app/fluid-cli";
2
+ import { Command } from "commander";
3
+
4
+ //#region src/index.d.ts
5
+ /**
6
+ * Changes to a live connection need an explicit yes. Scripts and agents
7
+ * pass `--yes`; an interactive terminal is asked. With neither, nothing runs.
8
+ */
9
+ declare function confirmChange(question: string, yes: boolean, interactive?: boolean): Promise<void>;
10
+ declare function registerConnectCommands(parent: Command, ctx: CommandContext): void;
11
+ declare const plugin: FluidPlugin;
12
+ //#endregion
13
+ export { confirmChange, plugin as default, registerConnectCommands };
14
+ //# sourceMappingURL=index.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../src/index.ts"],"mappings":";;;;;;AAyCA;;iBAAsB,aAAA,CACpB,QAAA,UACA,GAAA,WACA,WAAA,aACC,OAAA;AAAA,iBA+Ca,uBAAA,CACd,MAAA,EAAQ,OAAA,EACR,GAAA,EAAK,cAAA;AAAA,cAyND,MAAA,EAAQ,WAAA"}