@workos/oagen-emitters 0.2.0 → 0.2.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/.oxfmtrc.json +8 -1
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +7 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +633 -85
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
- package/smoke/sdk-dotnet.ts +17 -3
- package/smoke/sdk-elixir.ts +17 -3
- package/smoke/sdk-go.ts +21 -4
- package/smoke/sdk-kotlin.ts +23 -4
- package/smoke/sdk-node.ts +15 -3
- package/smoke/sdk-ruby.ts +17 -3
- package/smoke/sdk-rust.ts +16 -3
- package/src/node/client.ts +94 -12
- package/src/node/common.ts +1 -1
- package/src/node/enums.ts +4 -4
- package/src/node/errors.ts +5 -1
- package/src/node/fixtures.ts +6 -4
- package/src/node/index.ts +65 -9
- package/src/node/models.ts +86 -75
- package/src/node/naming.ts +91 -2
- package/src/node/resources.ts +462 -23
- package/src/node/serializers.ts +3 -1
- package/src/node/tests.ts +39 -15
- package/src/node/utils.ts +52 -2
- package/test/node/client.test.ts +181 -82
- package/test/node/enums.test.ts +73 -3
- package/test/node/models.test.ts +107 -20
- package/test/node/naming.test.ts +14 -4
- package/test/node/resources.test.ts +627 -25
- package/test/node/serializers.test.ts +33 -6
package/test/node/models.test.ts
CHANGED
|
@@ -30,7 +30,13 @@ describe('generateModels', () => {
|
|
|
30
30
|
name: 'getOrganization',
|
|
31
31
|
httpMethod: 'get',
|
|
32
32
|
path: '/organizations/{id}',
|
|
33
|
-
pathParams: [
|
|
33
|
+
pathParams: [
|
|
34
|
+
{
|
|
35
|
+
name: 'id',
|
|
36
|
+
type: { kind: 'primitive', type: 'string' },
|
|
37
|
+
required: true,
|
|
38
|
+
},
|
|
39
|
+
],
|
|
34
40
|
queryParams: [],
|
|
35
41
|
headerParams: [],
|
|
36
42
|
response: { kind: 'model', name: 'Organization' },
|
|
@@ -101,7 +107,13 @@ describe('generateModels', () => {
|
|
|
101
107
|
name: 'getOrganization',
|
|
102
108
|
httpMethod: 'get',
|
|
103
109
|
path: '/organizations/{id}',
|
|
104
|
-
pathParams: [
|
|
110
|
+
pathParams: [
|
|
111
|
+
{
|
|
112
|
+
name: 'id',
|
|
113
|
+
type: { kind: 'primitive', type: 'string' },
|
|
114
|
+
required: true,
|
|
115
|
+
},
|
|
116
|
+
],
|
|
105
117
|
queryParams: [],
|
|
106
118
|
headerParams: [],
|
|
107
119
|
response: { kind: 'model', name: 'Organization' },
|
|
@@ -247,7 +259,13 @@ describe('generateModels', () => {
|
|
|
247
259
|
name: 'getOrganization',
|
|
248
260
|
httpMethod: 'get',
|
|
249
261
|
path: '/organizations/{id}',
|
|
250
|
-
pathParams: [
|
|
262
|
+
pathParams: [
|
|
263
|
+
{
|
|
264
|
+
name: 'id',
|
|
265
|
+
type: { kind: 'primitive', type: 'string' },
|
|
266
|
+
required: true,
|
|
267
|
+
},
|
|
268
|
+
],
|
|
251
269
|
queryParams: [],
|
|
252
270
|
headerParams: [],
|
|
253
271
|
response: { kind: 'model', name: 'Organization' },
|
|
@@ -306,7 +324,13 @@ describe('generateModels', () => {
|
|
|
306
324
|
name: 'getOrganization',
|
|
307
325
|
httpMethod: 'get',
|
|
308
326
|
path: '/organizations/{id}',
|
|
309
|
-
pathParams: [
|
|
327
|
+
pathParams: [
|
|
328
|
+
{
|
|
329
|
+
name: 'id',
|
|
330
|
+
type: { kind: 'primitive', type: 'string' },
|
|
331
|
+
required: true,
|
|
332
|
+
},
|
|
333
|
+
],
|
|
310
334
|
queryParams: [],
|
|
311
335
|
headerParams: [],
|
|
312
336
|
response: { kind: 'model', name: 'Organization' },
|
|
@@ -386,7 +410,13 @@ describe('generateModels', () => {
|
|
|
386
410
|
name: 'getOrganization',
|
|
387
411
|
httpMethod: 'get',
|
|
388
412
|
path: '/organizations/{id}',
|
|
389
|
-
pathParams: [
|
|
413
|
+
pathParams: [
|
|
414
|
+
{
|
|
415
|
+
name: 'id',
|
|
416
|
+
type: { kind: 'primitive', type: 'string' },
|
|
417
|
+
required: true,
|
|
418
|
+
},
|
|
419
|
+
],
|
|
390
420
|
queryParams: [],
|
|
391
421
|
headerParams: [],
|
|
392
422
|
response: { kind: 'model', name: 'Organization' },
|
|
@@ -470,12 +500,18 @@ describe('generateModels', () => {
|
|
|
470
500
|
fields: [
|
|
471
501
|
{
|
|
472
502
|
name: 'before',
|
|
473
|
-
type: {
|
|
503
|
+
type: {
|
|
504
|
+
kind: 'nullable',
|
|
505
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
506
|
+
},
|
|
474
507
|
required: false,
|
|
475
508
|
},
|
|
476
509
|
{
|
|
477
510
|
name: 'after',
|
|
478
|
-
type: {
|
|
511
|
+
type: {
|
|
512
|
+
kind: 'nullable',
|
|
513
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
514
|
+
},
|
|
479
515
|
required: false,
|
|
480
516
|
},
|
|
481
517
|
],
|
|
@@ -542,7 +578,10 @@ describe('generateModels', () => {
|
|
|
542
578
|
},
|
|
543
579
|
{
|
|
544
580
|
name: 'data',
|
|
545
|
-
type: {
|
|
581
|
+
type: {
|
|
582
|
+
kind: 'array',
|
|
583
|
+
items: { kind: 'model', name: 'Connection' },
|
|
584
|
+
},
|
|
546
585
|
required: true,
|
|
547
586
|
},
|
|
548
587
|
{
|
|
@@ -557,12 +596,18 @@ describe('generateModels', () => {
|
|
|
557
596
|
fields: [
|
|
558
597
|
{
|
|
559
598
|
name: 'before',
|
|
560
|
-
type: {
|
|
599
|
+
type: {
|
|
600
|
+
kind: 'nullable',
|
|
601
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
602
|
+
},
|
|
561
603
|
required: false,
|
|
562
604
|
},
|
|
563
605
|
{
|
|
564
606
|
name: 'after',
|
|
565
|
-
type: {
|
|
607
|
+
type: {
|
|
608
|
+
kind: 'nullable',
|
|
609
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
610
|
+
},
|
|
566
611
|
required: false,
|
|
567
612
|
},
|
|
568
613
|
],
|
|
@@ -607,7 +652,13 @@ describe('generateModels', () => {
|
|
|
607
652
|
name: 'getOrganization',
|
|
608
653
|
httpMethod: 'get',
|
|
609
654
|
path: '/organizations/{id}',
|
|
610
|
-
pathParams: [
|
|
655
|
+
pathParams: [
|
|
656
|
+
{
|
|
657
|
+
name: 'id',
|
|
658
|
+
type: { kind: 'primitive', type: 'string' },
|
|
659
|
+
required: true,
|
|
660
|
+
},
|
|
661
|
+
],
|
|
611
662
|
queryParams: [],
|
|
612
663
|
headerParams: [],
|
|
613
664
|
response: { kind: 'model', name: 'Pagination' },
|
|
@@ -623,12 +674,18 @@ describe('generateModels', () => {
|
|
|
623
674
|
fields: [
|
|
624
675
|
{
|
|
625
676
|
name: 'before',
|
|
626
|
-
type: {
|
|
677
|
+
type: {
|
|
678
|
+
kind: 'nullable',
|
|
679
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
680
|
+
},
|
|
627
681
|
required: false,
|
|
628
682
|
},
|
|
629
683
|
{
|
|
630
684
|
name: 'after',
|
|
631
|
-
type: {
|
|
685
|
+
type: {
|
|
686
|
+
kind: 'nullable',
|
|
687
|
+
inner: { kind: 'primitive', type: 'string' },
|
|
688
|
+
},
|
|
632
689
|
required: false,
|
|
633
690
|
},
|
|
634
691
|
{
|
|
@@ -661,7 +718,13 @@ describe('model deduplication', () => {
|
|
|
661
718
|
name: 'getRole',
|
|
662
719
|
httpMethod: 'get',
|
|
663
720
|
path: '/roles/{id}',
|
|
664
|
-
pathParams: [
|
|
721
|
+
pathParams: [
|
|
722
|
+
{
|
|
723
|
+
name: 'id',
|
|
724
|
+
type: { kind: 'primitive', type: 'string' },
|
|
725
|
+
required: true,
|
|
726
|
+
},
|
|
727
|
+
],
|
|
665
728
|
queryParams: [],
|
|
666
729
|
headerParams: [],
|
|
667
730
|
response: { kind: 'model', name: 'EnvironmentRole' },
|
|
@@ -675,17 +738,41 @@ describe('model deduplication', () => {
|
|
|
675
738
|
{
|
|
676
739
|
name: 'EnvironmentRole',
|
|
677
740
|
fields: [
|
|
678
|
-
{
|
|
679
|
-
|
|
680
|
-
|
|
741
|
+
{
|
|
742
|
+
name: 'id',
|
|
743
|
+
type: { kind: 'primitive', type: 'string' },
|
|
744
|
+
required: true,
|
|
745
|
+
},
|
|
746
|
+
{
|
|
747
|
+
name: 'name',
|
|
748
|
+
type: { kind: 'primitive', type: 'string' },
|
|
749
|
+
required: true,
|
|
750
|
+
},
|
|
751
|
+
{
|
|
752
|
+
name: 'type',
|
|
753
|
+
type: { kind: 'literal', value: 'environment_role' },
|
|
754
|
+
required: true,
|
|
755
|
+
},
|
|
681
756
|
],
|
|
682
757
|
},
|
|
683
758
|
{
|
|
684
759
|
name: 'OrganizationRole',
|
|
685
760
|
fields: [
|
|
686
|
-
{
|
|
687
|
-
|
|
688
|
-
|
|
761
|
+
{
|
|
762
|
+
name: 'id',
|
|
763
|
+
type: { kind: 'primitive', type: 'string' },
|
|
764
|
+
required: true,
|
|
765
|
+
},
|
|
766
|
+
{
|
|
767
|
+
name: 'name',
|
|
768
|
+
type: { kind: 'primitive', type: 'string' },
|
|
769
|
+
required: true,
|
|
770
|
+
},
|
|
771
|
+
{
|
|
772
|
+
name: 'type',
|
|
773
|
+
type: { kind: 'literal', value: 'environment_role' },
|
|
774
|
+
required: true,
|
|
775
|
+
},
|
|
689
776
|
],
|
|
690
777
|
},
|
|
691
778
|
];
|
package/test/node/naming.test.ts
CHANGED
|
@@ -116,7 +116,12 @@ describe('naming', () => {
|
|
|
116
116
|
methodByOperation: new Map([
|
|
117
117
|
[
|
|
118
118
|
'POST /auth/factors/enroll',
|
|
119
|
-
{
|
|
119
|
+
{
|
|
120
|
+
className: 'Mfa',
|
|
121
|
+
methodName: 'enrollFactor',
|
|
122
|
+
params: [],
|
|
123
|
+
returnType: 'void',
|
|
124
|
+
},
|
|
120
125
|
],
|
|
121
126
|
]),
|
|
122
127
|
httpKeyByMethod: new Map(),
|
|
@@ -133,7 +138,7 @@ describe('naming', () => {
|
|
|
133
138
|
|
|
134
139
|
it('falls back to PascalCase of service.name', () => {
|
|
135
140
|
const service: Service = {
|
|
136
|
-
name: '
|
|
141
|
+
name: 'SomeNewService',
|
|
137
142
|
operations: [],
|
|
138
143
|
};
|
|
139
144
|
|
|
@@ -143,7 +148,7 @@ describe('naming', () => {
|
|
|
143
148
|
spec: emptySpec,
|
|
144
149
|
};
|
|
145
150
|
|
|
146
|
-
expect(resolveServiceName(service, ctx)).toBe('
|
|
151
|
+
expect(resolveServiceName(service, ctx)).toBe('SomeNewService');
|
|
147
152
|
});
|
|
148
153
|
});
|
|
149
154
|
|
|
@@ -189,7 +194,12 @@ describe('naming', () => {
|
|
|
189
194
|
methodByOperation: new Map([
|
|
190
195
|
[
|
|
191
196
|
'POST /auth/factors/enroll',
|
|
192
|
-
{
|
|
197
|
+
{
|
|
198
|
+
className: 'Mfa',
|
|
199
|
+
methodName: 'enrollFactor',
|
|
200
|
+
params: [],
|
|
201
|
+
returnType: 'void',
|
|
202
|
+
},
|
|
193
203
|
],
|
|
194
204
|
]),
|
|
195
205
|
httpKeyByMethod: new Map(),
|