@workos/oagen 0.2.0 → 0.3.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/dist/cli/index.mjs +238 -23
- package/dist/cli/index.mjs.map +1 -1
- package/dist/compat/index.mjs +2 -2
- package/dist/{diff-DyQF4sel.mjs → diff-Cn6S74vV.mjs} +194 -12
- package/dist/diff-Cn6S74vV.mjs.map +1 -0
- package/dist/{differ-BwelBJN0.mjs → differ-B6472Yef.mjs} +2 -2
- package/dist/{differ-BwelBJN0.mjs.map → differ-B6472Yef.mjs.map} +1 -1
- package/dist/index.d.mts +30 -1
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/scripts/smoke/baseline.mjs +37 -2
- package/dist/scripts/smoke/baseline.mjs.map +1 -1
- package/dist/smoke.d.mts.map +1 -1
- package/dist/smoke.mjs +37 -2
- package/dist/smoke.mjs.map +1 -1
- package/dist/{tree-sitter-BPNfbEzY.mjs → tree-sitter-DFRXfWg9.mjs} +38 -3
- package/dist/{tree-sitter-BPNfbEzY.mjs.map → tree-sitter-DFRXfWg9.mjs.map} +1 -1
- package/dist/verify/index.mjs +4 -4
- package/package.json +1 -1
- package/dist/diff-DyQF4sel.mjs.map +0 -1
|
@@ -107,15 +107,49 @@ function walkTypeRef(ref, visitor) {
|
|
|
107
107
|
//#endregion
|
|
108
108
|
//#region src/utils/naming.ts
|
|
109
109
|
/**
|
|
110
|
+
* Known compound tokens that the regex-based splitter over-splits.
|
|
111
|
+
* Each entry is [lowercase-word-sequence, canonical-form].
|
|
112
|
+
* Sorted longest-first so greedy matching works correctly.
|
|
113
|
+
*/
|
|
114
|
+
const COMPOUND_WORDS = [[[
|
|
115
|
+
"m",
|
|
116
|
+
"2",
|
|
117
|
+
"m"
|
|
118
|
+
], "M2M"], [["o", "auth"], "OAuth"]];
|
|
119
|
+
/**
|
|
120
|
+
* Recombine adjacent words that form a known compound token.
|
|
121
|
+
*/
|
|
122
|
+
function recombineCompounds(words) {
|
|
123
|
+
const result = [];
|
|
124
|
+
let i = 0;
|
|
125
|
+
while (i < words.length) {
|
|
126
|
+
let matched = false;
|
|
127
|
+
for (const [pattern, canonical] of COMPOUND_WORDS) if (i + pattern.length <= words.length) {
|
|
128
|
+
if (pattern.every((p, j) => words[i + j].toLowerCase() === p)) {
|
|
129
|
+
result.push(canonical);
|
|
130
|
+
i += pattern.length;
|
|
131
|
+
matched = true;
|
|
132
|
+
break;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
if (!matched) {
|
|
136
|
+
result.push(words[i]);
|
|
137
|
+
i++;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
return result;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
110
143
|
* Split a string into words, handling:
|
|
111
144
|
* - camelCase / PascalCase boundaries
|
|
112
145
|
* - snake_case / kebab-case separators
|
|
113
146
|
* - Consecutive capitals (e.g., "HTTPClient" → ["HTTP", "Client"])
|
|
114
147
|
* - Numbers as word boundaries (e.g., "OAuth2Token" → ["OAuth", "2", "Token"])
|
|
148
|
+
* - Known compounds are recombined (e.g., "M2M" stays as one word)
|
|
115
149
|
*/
|
|
116
150
|
function splitWords(s) {
|
|
117
151
|
if (!s) return [];
|
|
118
|
-
return s.replace(/[^a-zA-Z0-9_\-\s.]/g, "_").replace(/([a-z])([A-Z])/g, "$1\0$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1\0$2").replace(/([a-zA-Z])(\d)/g, "$1\0$2").replace(/(\d)([a-zA-Z])/g, "$1\0$2").split(/[\0_\-\s.]+/).filter((w) => w.length > 0);
|
|
152
|
+
return recombineCompounds(s.replace(/[^a-zA-Z0-9_\-\s.]/g, "_").replace(/([a-z])([A-Z])/g, "$1\0$2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1\0$2").replace(/([a-zA-Z])(\d)/g, "$1\0$2").replace(/(\d)([a-zA-Z])/g, "$1\0$2").split(/[\0_\-\s.]+/).filter((w) => w.length > 0));
|
|
119
153
|
}
|
|
120
154
|
const ACRONYM_SET = new Set([
|
|
121
155
|
"SSO",
|
|
@@ -123,7 +157,8 @@ const ACRONYM_SET = new Set([
|
|
|
123
157
|
"SAML",
|
|
124
158
|
"SCIM",
|
|
125
159
|
"JWT",
|
|
126
|
-
"HMAC"
|
|
160
|
+
"HMAC",
|
|
161
|
+
"M2M"
|
|
127
162
|
]);
|
|
128
163
|
function toPascalCase(s, acronyms) {
|
|
129
164
|
const merged = acronyms ? new Set([...ACRONYM_SET, ...acronyms]) : ACRONYM_SET;
|