@jetstreamapp/soql-parser-js 6.2.2 → 6.2.3
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/CHANGELOG.md +7 -0
- package/README.md +68 -0
- package/dist/lwc/index.js +12629 -0
- package/package.json +3 -2
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -508,6 +508,74 @@ WHERE Name LIKE 'a%'
|
|
|
508
508
|
OR Name LIKE 'c%'
|
|
509
509
|
```
|
|
510
510
|
|
|
511
|
+
## Using in LWC
|
|
512
|
+
|
|
513
|
+
The easiest way to utilize this library in LWC is to deploy the compiled code as a web component in your org.
|
|
514
|
+
|
|
515
|
+
:warning: The minified version ends up with `$A` characters in the output, which causes the deployment to SFD to fail, so we have created an unminified version of the library just for Salesforce.
|
|
516
|
+
|
|
517
|
+
### Obtaining the build artifacts
|
|
518
|
+
|
|
519
|
+
We don't store the built artifacts on github, so you will need to obtain from NPM or run the build command yourself.
|
|
520
|
+
|
|
521
|
+
#### Download from NPM
|
|
522
|
+
|
|
523
|
+
Download from [npm](https://www.npmjs.com/package/@jetstreamapp/soql-parser-js)
|
|
524
|
+
|
|
525
|
+
**Either:**
|
|
526
|
+
|
|
527
|
+
1. Go to the "Code Tab" on the [npm](https://www.npmjs.com/package/@jetstreamapp/soql-parser-js) listing
|
|
528
|
+
1. Navigate to `/dist/lwc.index.mjs`
|
|
529
|
+
2. Install this project in an existing node library by running `npm install @jetstreamapp/soql-parser-js`
|
|
530
|
+
1. then navigating to the downloaded code in this folder: `node_modules/@jetstreamapp/soql-parser-js/dist/lwc`
|
|
531
|
+
|
|
532
|
+
#### Build the files yourself
|
|
533
|
+
|
|
534
|
+
1. Clone/download the repository from GitHub
|
|
535
|
+
2. Ensure you have node installed (version 22 or higher)
|
|
536
|
+
3. Install dependencies with `npm install`
|
|
537
|
+
4. Run `npm build:lwc`
|
|
538
|
+
5. The output will be placed in `/dist/lwc.index.mjs`
|
|
539
|
+
|
|
540
|
+
### Deploying and Using in Salesforce
|
|
541
|
+
|
|
542
|
+
Copy `index.mjs` into an LWC component.
|
|
543
|
+
|
|
544
|
+
For example:
|
|
545
|
+
|
|
546
|
+
```
|
|
547
|
+
soqlParserJsLib
|
|
548
|
+
- soqlParserJsLib.js <--- copy the code here
|
|
549
|
+
- soqlParserJsLib.js-meta.xml
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
After you have deployed the LWC, you can import it just like any other LWC import.
|
|
553
|
+
|
|
554
|
+
```js
|
|
555
|
+
import { LightningElement } from 'lwc';
|
|
556
|
+
import { parseQuery } from 'c/soqlParserJsLib';
|
|
557
|
+
|
|
558
|
+
export default class SoqlParserJs extends LightningElement {
|
|
559
|
+
parsedQuery;
|
|
560
|
+
|
|
561
|
+
get parsedQueryString() {
|
|
562
|
+
return this.parsedQuery ? JSON.stringify(this.parsedQuery, null, 2) : '';
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
handleClick() {
|
|
566
|
+
this.parsedQuery = parseQuery("SELECT Id, Name FROM Account WHERE Industry = 'Technology'");
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
```html
|
|
572
|
+
<template>
|
|
573
|
+
<button class="slds-button slds-button_neutral" onclick="{handleClick}">Click Me</button>
|
|
574
|
+
|
|
575
|
+
<p>Parsed Query: {parsedQueryString}</p>
|
|
576
|
+
</template>
|
|
577
|
+
```
|
|
578
|
+
|
|
511
579
|
## CLI
|
|
512
580
|
|
|
513
581
|
Install globally or use `npx` to interact with the cli.
|