@workos/oagen 0.0.1 → 0.1.1
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 +1 -3
- package/dist/{chunk-P5XUDUGY.js → chunk-2JXFTDTO.js} +13 -92
- package/dist/cli/index.js +185 -466
- package/dist/compat/index.js +40 -2
- package/dist/index.d.ts +2 -25
- package/dist/index.js +122 -290
- package/dist/scripts/smoke/baseline.js +88 -26
- package/dist/smoke.js +88 -26
- package/dist/verify/index.js +1 -1
- package/docs/agents/architecture.md +1 -1
- package/docs/agents/emitters.md +2 -2
- package/docs/architecture/dependency-layers.md +1 -5
- package/docs/architecture/emitter-contract.md +13 -10
- package/docs/architecture/extractor-contract.md +30 -22
- package/docs/architecture/ir-types.md +2 -1
- package/docs/architecture/pipeline.md +1 -1
- package/docs/architecture/workflows.md +21 -20
- package/docs/cli.md +10 -14
- package/docs/contributor/public-api.md +2 -2
- package/package.json +2 -2
- package/skills/check-emitter-parity/SKILL.md +232 -0
package/dist/compat/index.js
CHANGED
|
@@ -675,6 +675,43 @@ function parseInterfaceDeclarations(tree, sourceFile, namespace) {
|
|
|
675
675
|
}
|
|
676
676
|
return interfaces;
|
|
677
677
|
}
|
|
678
|
+
function parseEnumDeclarations(tree, sourceFile, namespace) {
|
|
679
|
+
const enums = [];
|
|
680
|
+
for (const node of tree.rootNode.descendantsOfType("enum_declaration")) {
|
|
681
|
+
const nameNode = node.childForFieldName("name");
|
|
682
|
+
if (!nameNode) continue;
|
|
683
|
+
const bodyNode = node.childForFieldName("body");
|
|
684
|
+
if (!bodyNode) continue;
|
|
685
|
+
const constants = [];
|
|
686
|
+
for (const child of bodyNode.namedChildren) {
|
|
687
|
+
if (child.type !== "enum_case") continue;
|
|
688
|
+
const caseNameNode = child.childForFieldName("name");
|
|
689
|
+
if (!caseNameNode) continue;
|
|
690
|
+
let value = caseNameNode.text;
|
|
691
|
+
const valueNode = child.namedChildren.find(
|
|
692
|
+
(c) => c.type === "encapsed_string" || c.type === "string" || c.type === "integer"
|
|
693
|
+
);
|
|
694
|
+
if (valueNode) {
|
|
695
|
+
const contentNode = valueNode.namedChildren.find((c) => c.type === "string_content");
|
|
696
|
+
value = contentNode ? contentNode.text : valueNode.text;
|
|
697
|
+
}
|
|
698
|
+
constants.push({ name: caseNameNode.text, value });
|
|
699
|
+
}
|
|
700
|
+
const methods = parseMethods(bodyNode);
|
|
701
|
+
enums.push({
|
|
702
|
+
name: nameNode.text,
|
|
703
|
+
namespace,
|
|
704
|
+
extends: null,
|
|
705
|
+
isInterface: false,
|
|
706
|
+
methods,
|
|
707
|
+
properties: [],
|
|
708
|
+
constants,
|
|
709
|
+
resourceAttributes: [],
|
|
710
|
+
sourceFile
|
|
711
|
+
});
|
|
712
|
+
}
|
|
713
|
+
return enums;
|
|
714
|
+
}
|
|
678
715
|
function parsePhpFile(filePath, sdkPath) {
|
|
679
716
|
const source = readFileSync2(filePath, "utf-8");
|
|
680
717
|
const relPath = relative2(sdkPath, filePath);
|
|
@@ -682,8 +719,9 @@ function parsePhpFile(filePath, sdkPath) {
|
|
|
682
719
|
const namespace = extractNamespace(tree);
|
|
683
720
|
const classDecls = parseClassDeclarations(tree, relPath, namespace);
|
|
684
721
|
const interfaceDecls = parseInterfaceDeclarations(tree, relPath, namespace);
|
|
722
|
+
const enumDecls = parseEnumDeclarations(tree, relPath, namespace);
|
|
685
723
|
return {
|
|
686
|
-
classes: [...classDecls, ...interfaceDecls]
|
|
724
|
+
classes: [...classDecls, ...interfaceDecls, ...enumDecls]
|
|
687
725
|
};
|
|
688
726
|
}
|
|
689
727
|
|
|
@@ -877,7 +915,7 @@ var phpHints = {
|
|
|
877
915
|
}
|
|
878
916
|
return false;
|
|
879
917
|
},
|
|
880
|
-
modelBaseClasses: [],
|
|
918
|
+
modelBaseClasses: ["BaseWorkOSResource"],
|
|
881
919
|
exceptionBaseClasses: ["Exception", "\\Exception"]
|
|
882
920
|
};
|
|
883
921
|
function createPhpExtractor(hintOverrides) {
|
package/dist/index.d.ts
CHANGED
|
@@ -53,9 +53,6 @@ interface GeneratedFile {
|
|
|
53
53
|
headerPlacement?: 'prepend' | 'skip';
|
|
54
54
|
/** When false, exclude this file from --target integration. Defaults to true. */
|
|
55
55
|
integrateTarget?: boolean;
|
|
56
|
-
/** Controls merge behavior: 'full' (default) adds symbols/members/imports;
|
|
57
|
-
* 'docstring-only' only updates docstrings and ensures the header. */
|
|
58
|
-
mergeMode?: 'full' | 'docstring-only';
|
|
59
56
|
}
|
|
60
57
|
interface EmitterContext {
|
|
61
58
|
namespace: string;
|
|
@@ -222,7 +219,7 @@ interface WriteResult {
|
|
|
222
219
|
ignored: string[];
|
|
223
220
|
}
|
|
224
221
|
|
|
225
|
-
declare function mapFilesForTargetIntegration(files: GeneratedFile[], language: string
|
|
222
|
+
declare function mapFilesForTargetIntegration(files: GeneratedFile[], language: string): GeneratedFile[];
|
|
226
223
|
declare function integrateGeneratedFiles(opts: {
|
|
227
224
|
files: GeneratedFile[];
|
|
228
225
|
language: string;
|
|
@@ -235,26 +232,6 @@ declare function getEmitter(language: string): Emitter;
|
|
|
235
232
|
|
|
236
233
|
declare function diffSpecs(oldSpec: ApiSpec, newSpec: ApiSpec): DiffReport;
|
|
237
234
|
|
|
238
|
-
interface AffectedFiles {
|
|
239
|
-
regenerate: string[];
|
|
240
|
-
delete: string[];
|
|
241
|
-
}
|
|
242
|
-
declare function mapChangesToFiles(changes: Change[], emitter: Emitter, ctx: EmitterContext): AffectedFiles;
|
|
243
|
-
|
|
244
|
-
declare function generateIncremental(oldSpec: ApiSpec, newSpec: ApiSpec, emitter: Emitter, options: {
|
|
245
|
-
namespace: string;
|
|
246
|
-
outputDir: string;
|
|
247
|
-
dryRun?: boolean;
|
|
248
|
-
force?: boolean;
|
|
249
|
-
target?: string;
|
|
250
|
-
apiSurface?: ApiSurface;
|
|
251
|
-
overlayLookup?: OverlayLookup;
|
|
252
|
-
}): Promise<{
|
|
253
|
-
generated: GeneratedFile[];
|
|
254
|
-
deleted: string[];
|
|
255
|
-
diff: ReturnType<typeof diffSpecs>;
|
|
256
|
-
}>;
|
|
257
|
-
|
|
258
235
|
declare const ACRONYM_SET: Set<string>;
|
|
259
236
|
declare function toPascalCase(s: string, acronyms?: Set<string>): string;
|
|
260
237
|
declare function toCamelCase(s: string, acronyms?: Set<string>): string;
|
|
@@ -297,4 +274,4 @@ interface OagenConfig {
|
|
|
297
274
|
docUrl?: string;
|
|
298
275
|
}
|
|
299
276
|
|
|
300
|
-
export { ACRONYM_SET, ApiSpec, type Change, CommandError, ConfigError, ConfigLoadError, ConfigVersionMismatchError, type DiffReport, type Emitter, type EmitterContext, Enum, type EnumAdded, type EnumModified, type EnumRemoved, type EnumValueChange, ExtractorError, type FieldChange, type GeneratedFile, InternalError, Model, type ModelAdded, type ModelModified, type ModelRemoved, type OagenConfig, OagenError, Operation, type OperationAdded, type OperationModified, type OperationPlan, type OperationRemoved, type ParamChange, RegistryError, Service, type ServiceAdded, type ServiceRemoved, SpecParseError, applyFileHeaders, buildEmitterContext, cleanSchemaName, diffSpecs, generate, generateAllFiles, generateFiles,
|
|
277
|
+
export { ACRONYM_SET, ApiSpec, type Change, CommandError, ConfigError, ConfigLoadError, ConfigVersionMismatchError, type DiffReport, type Emitter, type EmitterContext, Enum, type EnumAdded, type EnumModified, type EnumRemoved, type EnumValueChange, ExtractorError, type FieldChange, type GeneratedFile, InternalError, Model, type ModelAdded, type ModelModified, type ModelRemoved, type OagenConfig, OagenError, Operation, type OperationAdded, type OperationModified, type OperationPlan, type OperationRemoved, type ParamChange, RegistryError, Service, type ServiceAdded, type ServiceRemoved, SpecParseError, applyFileHeaders, buildEmitterContext, cleanSchemaName, diffSpecs, generate, generateAllFiles, generateFiles, getEmitter, integrateGeneratedFiles, mapFilesForTargetIntegration, parseSpec, planOperation, registerEmitter, stripBackendPrefixes, toCamelCase, toKebabCase, toPascalCase, toSnakeCase, toUpperSnakeCase };
|