@voxgig/sdkgen 4.2.7 → 4.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/bin/voxgig-sdkgen +1 -1
- package/dist/helpers/naming.d.ts +2 -1
- package/dist/helpers/naming.js +50 -12
- package/dist/helpers/naming.js.map +1 -1
- package/dist/sdkgen.d.ts +2 -2
- package/dist/sdkgen.js +4 -3
- package/dist/sdkgen.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/project/.sdk/tm/go/test/custom_utility_test.go +103 -0
- package/project/.sdk/tm/go/test/feature_corpus_test.go +550 -0
- package/project/.sdk/tm/go/utility/make_options.go +7 -1
- package/project/.sdk/tm/go/utility/register.go +194 -0
- package/project/.sdk/tm/java/test/CustomUtilityTest.java +55 -0
- package/project/.sdk/tm/java/test/FeatureCorpusTest.java +463 -0
- package/project/.sdk/tm/java/utility/MakeOptions.java +11 -2
- package/project/.sdk/tm/java/utility/Register.java +91 -0
- package/project/.sdk/tm/js/test/feature/Corpus.test.js +24 -3
- package/project/.sdk/tm/perl/t/feature_corpus.t +345 -0
- package/project/.sdk/tm/perl/utility/make_options.pm +33 -1
- package/project/.sdk/tm/php/core/Context.php +3 -0
- package/project/.sdk/tm/php/core/Control.php +13 -0
- package/project/.sdk/tm/php/core/Error.php +12 -0
- package/project/.sdk/tm/php/test/FeatureCorpusTest.php +376 -0
- package/project/.sdk/tm/php/utility/MakeOptions.php +30 -1
- package/project/.sdk/tm/py/pkg/utility/make_options.py +42 -1
- package/project/.sdk/tm/py/test/test_feature_corpus.py +309 -0
- package/project/.sdk/tm/rb/test/feature_corpus_test.rb +281 -0
- package/project/.sdk/tm/rb/utility/make_options.rb +32 -1
- package/project/.sdk/tm/ts/test/feature/Corpus.test.ts +24 -3
- package/project/sdkgen-package.json +1 -1
- package/src/helpers/naming.ts +54 -12
- package/src/sdkgen.ts +2 -1
package/src/helpers/naming.ts
CHANGED
|
@@ -149,9 +149,9 @@ const RB_SDK_CONSTANTS = new Set<string>([
|
|
|
149
149
|
'StructRunner', 'StructTestClient', 'StructUtilityTest', 'VoxgigStruct',
|
|
150
150
|
'STRUCT_TEST_JSON_FILE',
|
|
151
151
|
// the generated/templated test classes
|
|
152
|
-
'ExistsTest', '
|
|
153
|
-
'
|
|
154
|
-
'TestInitFeature',
|
|
152
|
+
'ExistsTest', 'FeatureCorpusTest', 'FeatureTest', 'NetsimTest',
|
|
153
|
+
'PipelineTest', 'PrimaryUtilityTest', 'ReadmeExamplesTest',
|
|
154
|
+
'TestHookFeature', 'TestInitFeature',
|
|
155
155
|
])
|
|
156
156
|
|
|
157
157
|
|
|
@@ -304,18 +304,59 @@ function isPhpReservedType(Name: string): boolean {
|
|
|
304
304
|
}
|
|
305
305
|
|
|
306
306
|
|
|
307
|
-
//
|
|
308
|
-
//
|
|
309
|
-
//
|
|
310
|
-
//
|
|
311
|
-
//
|
|
307
|
+
// CLASSES THE GENERATED PHP SDK ITSELF DECLARES — the second half of "already
|
|
308
|
+
// taken", exactly as RB_SDK_CONSTANTS is for ruby. `PHP_RESERVED_TYPES` covers
|
|
309
|
+
// what the LANGUAGE owns; this covers what OUR OWN scaffolding claims, which a
|
|
310
|
+
// keyword list can never catch.
|
|
311
|
+
//
|
|
312
|
+
// The generated PHP SDK uses NO NAMESPACES, and composer classmaps both the
|
|
313
|
+
// runtime (`types/`) and the tests (`autoload-dev`: `test/`). An entity named
|
|
314
|
+
// `feature_test` emits `class FeatureTest` in `<Sdk>Types.php` while
|
|
315
|
+
// `tm/php/test/FeatureTest.php` declares one too: composer maps one name to
|
|
316
|
+
// two files, and loading both fatals on redeclaration. Ruby's equivalent only
|
|
317
|
+
// warns; PHP does not.
|
|
318
|
+
//
|
|
319
|
+
// Only UNPREFIXED, UNNAMESPACED declarations are listed. `ProjectNameUtility`
|
|
320
|
+
// substitutes to `<Sdk>Utility`, which no bare entity type can equal, and
|
|
321
|
+
// `utility/struct/Struct.php` and `test/StructRunner.php` declare inside a
|
|
322
|
+
// namespace — neither is reachable from the global name an entity type takes.
|
|
323
|
+
//
|
|
324
|
+
// `php-sdk-classes.test.ts` re-derives this from the templates AND the
|
|
325
|
+
// components and fails on drift, the same discipline as the rb and swift
|
|
326
|
+
// guards, and for the same reason: a hand-collected list rots.
|
|
327
|
+
//
|
|
328
|
+
// Folded, and matched folded: PHP class names are case-insensitive, so
|
|
329
|
+
// `FeatureTest` and `featuretest` are one identifier.
|
|
330
|
+
const PHP_SDK_CLASSES = new Set<string>([
|
|
331
|
+
// the generated/templated test classes
|
|
332
|
+
'existstest', 'featurecorpustest', 'featuretest', 'netsimtest',
|
|
333
|
+
'pipelinetest', 'primaryutilitytest', 'readmeexamplestest',
|
|
334
|
+
'structutilitytest',
|
|
335
|
+
// helper classes those suites declare beside them
|
|
336
|
+
'ftclient', 'ftclock', 'ftctrl', 'ftentity', 'ftharness', 'ftrecorder',
|
|
337
|
+
'plclient', 'plentity', 'plentityitem',
|
|
338
|
+
])
|
|
339
|
+
|
|
340
|
+
|
|
341
|
+
// Does `Name` collide with a class the generated PHP SDK already declares?
|
|
342
|
+
function isPhpSdkClass(Name: string): boolean {
|
|
343
|
+
return PHP_SDK_CLASSES.has(String(Name).toLowerCase())
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
// A declarable PHP class name for a generated type: unchanged, unless the name
|
|
348
|
+
// is ALREADY TAKEN — by PHP itself, or by the SDK's own scaffolding — in which
|
|
349
|
+
// case `Type` is appended (`Namespace` -> `NamespaceType`). Mirrors
|
|
350
|
+
// rbSafeTypeName and swiftSafeTypeName deliberately — same suffix, same "only
|
|
351
|
+
// rename on an actual collision" rule, so every SDK that does not collide is
|
|
352
|
+
// byte-identical to before.
|
|
312
353
|
//
|
|
313
354
|
// Applied ONLY to the bare entity data class. Per-op type names already carry
|
|
314
|
-
// their own suffix (`NamespaceLoadData`, `NamespaceCreateData`), which
|
|
315
|
-
//
|
|
316
|
-
//
|
|
355
|
+
// their own suffix (`NamespaceLoadData`, `NamespaceCreateData`), which neither
|
|
356
|
+
// set matches, and the entity ACCESSOR is a method rather than a class — PHP
|
|
357
|
+
// resolves those separately — so the public surface is unchanged.
|
|
317
358
|
function phpSafeTypeName(Name: string): string {
|
|
318
|
-
return isPhpReservedType(Name) ? Name + 'Type' : Name
|
|
359
|
+
return isPhpReservedType(Name) || isPhpSdkClass(Name) ? Name + 'Type' : Name
|
|
319
360
|
}
|
|
320
361
|
|
|
321
362
|
|
|
@@ -496,6 +537,7 @@ export {
|
|
|
496
537
|
isSwiftSdkType,
|
|
497
538
|
swiftSafeTypeName,
|
|
498
539
|
isPhpReservedType,
|
|
540
|
+
isPhpSdkClass,
|
|
499
541
|
phpSafeTypeName,
|
|
500
542
|
isTsReservedType,
|
|
501
543
|
tsSafeTypeName,
|
package/src/sdkgen.ts
CHANGED
|
@@ -59,7 +59,7 @@ import { collectDeps } from './helpers/collectDeps'
|
|
|
59
59
|
import type { DepEntry } from './helpers/collectDeps'
|
|
60
60
|
import { canonToType, canonToDtype, canonKey, canonScalarKey } from './helpers/canonType'
|
|
61
61
|
import { OP_SUFFIX, opTypeName, opParams, ownPoint, opActions, entityActions, entityPath, opRequestShape, entityIdField, entityDataIdField, entityOps, entityPrimaryOp, pickExampleEntity, entityClassName, entityTypeCollisions, warnEntityTypeCollisions, deriveEntityNames, entityCollection } from './helpers/opShape'
|
|
62
|
-
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, phpSafeTypeName, isTsReservedType, tsSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
|
|
62
|
+
import { isReservedName, safeVarName, exampleVarName, phpEntityAccessor, entityCacheField, isRbCoreConstant, isRbSdkConstant, rbSafeTypeName, isSwiftSdkType, swiftSafeTypeName, isPhpReservedType, isPhpSdkClass, phpSafeTypeName, isTsReservedType, tsSafeTypeName, jsProp, jsOptProp, jsKey } from './helpers/naming'
|
|
63
63
|
import { serverVariables, hasServerVariables } from './helpers/serverVars'
|
|
64
64
|
import { primaryOpCall, idLiteral, matchArg, dataArg, litFor } from './helpers/opExample'
|
|
65
65
|
import type { ExampleLang } from './helpers/opExample'
|
|
@@ -1126,6 +1126,7 @@ export {
|
|
|
1126
1126
|
isSwiftSdkType,
|
|
1127
1127
|
swiftSafeTypeName,
|
|
1128
1128
|
isPhpReservedType,
|
|
1129
|
+
isPhpSdkClass,
|
|
1129
1130
|
phpSafeTypeName,
|
|
1130
1131
|
isTsReservedType,
|
|
1131
1132
|
tsSafeTypeName,
|