ampscript-data 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.
Files changed (3) hide show
  1. package/README.md +141 -0
  2. package/package.json +32 -0
  3. package/src/index.js +2896 -0
package/README.md ADDED
@@ -0,0 +1,141 @@
1
+ # ampscript-data
2
+
3
+ Canonical AMPscript function catalog, keywords, and personalization strings for Salesforce Marketing Cloud (SFMC) tooling.
4
+
5
+ This package is the single source of truth consumed by:
6
+
7
+ - [eslint-plugin-sfmc](https://www.npmjs.com/package/eslint-plugin-sfmc) — unknown-function detection and arity validation
8
+ - [prettier-plugin-sfmc](https://www.npmjs.com/package/prettier-plugin-sfmc) — casing normalization
9
+ - [vscode-sfmc-language](https://marketplace.visualstudio.com/items?itemName=joernberkefeld.vscode-sfmc-language) — completions, hover, and diagnostics
10
+
11
+ ## Installation
12
+
13
+ ```sh
14
+ npm install ampscript-data
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ ```js
20
+ import {
21
+ FUNCTIONS,
22
+ AMPSCRIPT_KEYWORDS,
23
+ PERSONALIZATION_STRINGS,
24
+ DEPRECATED_FUNCTIONS,
25
+ functionLookup,
26
+ functionNames,
27
+ CANONICAL_FUNCTIONS,
28
+ FUNCTION_CANONICAL_MAP,
29
+ deprecatedFunctionLookup,
30
+ isEmailExcluded,
31
+ } from 'ampscript-data';
32
+ ```
33
+
34
+ ### `FUNCTIONS`
35
+
36
+ An array of all known AMPscript functions with full metadata:
37
+
38
+ ```js
39
+ import { FUNCTIONS } from 'ampscript-data';
40
+
41
+ for (const fn of FUNCTIONS) {
42
+ console.log(fn.name); // e.g. 'Lookup'
43
+ console.log(fn.minArgs); // minimum argument count
44
+ console.log(fn.maxArgs); // maximum argument count (Infinity = variadic)
45
+ console.log(fn.category); // e.g. 'Data Extension'
46
+ console.log(fn.description); // human-readable description
47
+ console.log(fn.params); // array of { name, description, type?, optional? }
48
+ console.log(fn.returnType); // e.g. 'string'
49
+ console.log(fn.syntax); // canonical signature string
50
+ console.log(fn.example); // usage example (where available)
51
+ }
52
+ ```
53
+
54
+ ### `functionLookup`
55
+
56
+ A `Map<string, FunctionEntry>` keyed by lowercase function name for O(1) lookups:
57
+
58
+ ```js
59
+ import { functionLookup } from 'ampscript-data';
60
+
61
+ const entry = functionLookup.get('lookup');
62
+ ```
63
+
64
+ ### `functionNames`
65
+
66
+ A `Set<string>` of all function names in lowercase — useful for existence checks:
67
+
68
+ ```js
69
+ import { functionNames } from 'ampscript-data';
70
+
71
+ if (functionNames.has('lookup')) { /* ... */ }
72
+ ```
73
+
74
+ ### `CANONICAL_FUNCTIONS`
75
+
76
+ An array of function names in their canonical casing (e.g. `'Lookup'`), used for casing normalization:
77
+
78
+ ```js
79
+ import { CANONICAL_FUNCTIONS } from 'ampscript-data';
80
+ ```
81
+
82
+ ### `FUNCTION_CANONICAL_MAP`
83
+
84
+ A `Map<string, string>` from lowercase name to canonical-cased name:
85
+
86
+ ```js
87
+ import { FUNCTION_CANONICAL_MAP } from 'ampscript-data';
88
+
89
+ FUNCTION_CANONICAL_MAP.get('lookup'); // 'Lookup'
90
+ ```
91
+
92
+ ### `DEPRECATED_FUNCTIONS`
93
+
94
+ An array of deprecated function entries with the same shape as `FUNCTIONS`:
95
+
96
+ ```js
97
+ import { DEPRECATED_FUNCTIONS } from 'ampscript-data';
98
+ ```
99
+
100
+ ### `deprecatedFunctionLookup`
101
+
102
+ A `Map<string, FunctionEntry>` for deprecated functions, keyed by lowercase name:
103
+
104
+ ```js
105
+ import { deprecatedFunctionLookup } from 'ampscript-data';
106
+ ```
107
+
108
+ ### `isEmailExcluded`
109
+
110
+ Returns `true` if the function is not available in email send contexts:
111
+
112
+ ```js
113
+ import { isEmailExcluded } from 'ampscript-data';
114
+
115
+ isEmailExcluded('HTTPGet'); // true — not available in email
116
+ ```
117
+
118
+ ### `AMPSCRIPT_KEYWORDS`
119
+
120
+ An array of AMPscript language keywords (`IF`, `FOR`, `SET`, etc.):
121
+
122
+ ```js
123
+ import { AMPSCRIPT_KEYWORDS } from 'ampscript-data';
124
+ ```
125
+
126
+ ### `PERSONALIZATION_STRINGS`
127
+
128
+ An array of AMPscript personalization string descriptors (subscriber attributes, system variables, etc.):
129
+
130
+ ```js
131
+ import { PERSONALIZATION_STRINGS } from 'ampscript-data';
132
+
133
+ for (const ps of PERSONALIZATION_STRINGS) {
134
+ console.log(ps.name); // e.g. 'emailaddr'
135
+ console.log(ps.description); // human-readable description
136
+ }
137
+ ```
138
+
139
+ ## License
140
+
141
+ MIT
package/package.json ADDED
@@ -0,0 +1,32 @@
1
+ {
2
+ "name": "ampscript-data",
3
+ "version": "0.1.0",
4
+ "description": "Canonical AMPscript function catalog, keywords, and personalization strings for SFMC tooling",
5
+ "type": "module",
6
+ "main": "src/index.js",
7
+ "exports": {
8
+ ".": "./src/index.js"
9
+ },
10
+ "files": ["src"],
11
+ "repository": {
12
+ "type": "git",
13
+ "url": "git+https://github.com/JoernBerkefeld/ampscript-data.git"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/JoernBerkefeld/ampscript-data/issues"
17
+ },
18
+ "homepage": "https://github.com/JoernBerkefeld/ampscript-data#readme",
19
+ "author": "Joern Berkefeld",
20
+ "keywords": [
21
+ "ampscript",
22
+ "sfmc",
23
+ "salesforce",
24
+ "marketing-cloud",
25
+ "email",
26
+ "personalization"
27
+ ],
28
+ "license": "MIT",
29
+ "engines": {
30
+ "node": ">=18.0.0"
31
+ }
32
+ }