@osdk/generator 2.1.0-beta.2 → 2.1.0-beta.20
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/CHANGELOG.md +193 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts +1 -0
- package/build/browser/GenerateContext/GenerateContext.d.ts.map +1 -1
- package/build/browser/generateClientSdkPackage.test.js +2 -2
- package/build/browser/generateClientSdkPackage.test.js.map +1 -1
- package/build/browser/util/test/TodoWireOntology.d.ts +5 -0
- package/build/browser/util/test/TodoWireOntology.d.ts.map +1 -1
- package/build/browser/util/test/TodoWireOntology.js +10 -5
- package/build/browser/util/test/TodoWireOntology.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +6 -6
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +14 -20
- package/build/browser/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js +74 -87
- package/build/browser/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerActionDataFiles.js +3 -2
- package/build/browser/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js +4 -3
- package/build/browser/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js +1 -1
- package/build/browser/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.js +5 -5
- package/build/browser/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js +7 -8
- package/build/browser/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +21 -10
- package/build/browser/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/browser/validateWireOntologyAssumptions.js +2 -2
- package/build/browser/validateWireOntologyAssumptions.js.map +1 -1
- package/build/esm/GenerateContext/GenerateContext.d.ts +1 -0
- package/build/esm/GenerateContext/GenerateContext.d.ts.map +1 -1
- package/build/esm/generateClientSdkPackage.test.js +2 -2
- package/build/esm/generateClientSdkPackage.test.js.map +1 -1
- package/build/esm/util/test/TodoWireOntology.d.ts +5 -0
- package/build/esm/util/test/TodoWireOntology.d.ts.map +1 -1
- package/build/esm/util/test/TodoWireOntology.js +10 -5
- package/build/esm/util/test/TodoWireOntology.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js +6 -6
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.js.map +1 -1
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js +14 -20
- package/build/esm/v2.0/UNSTABLE_wireInterfaceTypeV2ToSdkObjectConst.test.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.d.ts.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js +3 -2
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.js.map +1 -1
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js +74 -87
- package/build/esm/v2.0/generateClientSdkVersionTwoPointZero.test.js.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerActionDataFiles.js +3 -2
- package/build/esm/v2.0/generatePerActionDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js +4 -3
- package/build/esm/v2.0/generatePerInterfaceDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js +1 -1
- package/build/esm/v2.0/generatePerObjectDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.d.ts.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.js +5 -5
- package/build/esm/v2.0/generatePerQueryDataFiles.js.map +1 -1
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js +7 -8
- package/build/esm/v2.0/generatePerQueryDataFiles.test.js.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.d.ts.map +1 -1
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js +21 -10
- package/build/esm/v2.0/wireObjectTypeV2ToSdkObjectConstV2.js.map +1 -1
- package/build/esm/validateWireOntologyAssumptions.js +2 -2
- package/build/esm/validateWireOntologyAssumptions.js.map +1 -1
- package/package.json +12 -9
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
* See the License for the specific language governing permissions and
|
|
14
14
|
* limitations under the License.
|
|
15
15
|
*/
|
|
16
|
+
import { consola } from "consola";
|
|
16
17
|
import { mkdir, readdir, rmdir, writeFile } from "fs/promises";
|
|
17
18
|
import * as immer from "immer";
|
|
18
19
|
import { beforeEach, describe, expect, it, test, vi } from "vitest";
|
|
@@ -153,12 +154,20 @@ const referencedOntology = {
|
|
|
153
154
|
"taskId": {
|
|
154
155
|
"dataType": {
|
|
155
156
|
"type": "string"
|
|
156
|
-
}
|
|
157
|
+
},
|
|
158
|
+
"rid": "ridForTaskId"
|
|
157
159
|
},
|
|
158
160
|
"body": {
|
|
159
161
|
"dataType": {
|
|
160
162
|
"type": "string"
|
|
161
|
-
}
|
|
163
|
+
},
|
|
164
|
+
"rid": "ridForBody"
|
|
165
|
+
},
|
|
166
|
+
"shouldBeIgnored": {
|
|
167
|
+
"dataType": {
|
|
168
|
+
"type": "futureUnknownType"
|
|
169
|
+
},
|
|
170
|
+
"rid": "ridForShouldBeIgnored"
|
|
162
171
|
}
|
|
163
172
|
},
|
|
164
173
|
"status": "ACTIVE",
|
|
@@ -184,6 +193,7 @@ const referencedOntology = {
|
|
|
184
193
|
rid: "idk"
|
|
185
194
|
}
|
|
186
195
|
},
|
|
196
|
+
implementedByObjectTypes: [],
|
|
187
197
|
links: {}
|
|
188
198
|
}
|
|
189
199
|
},
|
|
@@ -256,12 +266,14 @@ const referencingOntology = {
|
|
|
256
266
|
"id": {
|
|
257
267
|
dataType: {
|
|
258
268
|
type: "integer"
|
|
259
|
-
}
|
|
269
|
+
},
|
|
270
|
+
rid: "rid"
|
|
260
271
|
},
|
|
261
272
|
"body": {
|
|
262
273
|
dataType: {
|
|
263
274
|
type: "string"
|
|
264
|
-
}
|
|
275
|
+
},
|
|
276
|
+
"rid": "rid"
|
|
265
277
|
}
|
|
266
278
|
},
|
|
267
279
|
rid: "ridForThing",
|
|
@@ -288,12 +300,14 @@ const referencingOntology = {
|
|
|
288
300
|
"id": {
|
|
289
301
|
dataType: {
|
|
290
302
|
type: "integer"
|
|
291
|
-
}
|
|
303
|
+
},
|
|
304
|
+
rid: "rid"
|
|
292
305
|
},
|
|
293
306
|
"body": {
|
|
294
307
|
dataType: {
|
|
295
308
|
type: "string"
|
|
296
|
-
}
|
|
309
|
+
},
|
|
310
|
+
rid: "rid"
|
|
297
311
|
}
|
|
298
312
|
},
|
|
299
313
|
rid: "theRid",
|
|
@@ -396,7 +410,7 @@ describe("generator", () => {
|
|
|
396
410
|
ActionReturnTypeForOptions,
|
|
397
411
|
ApplyActionOptions,
|
|
398
412
|
ApplyBatchActionOptions,
|
|
399
|
-
} from '@osdk/
|
|
413
|
+
} from '@osdk/client';
|
|
400
414
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
401
415
|
import type { Todo } from '../objects/Todo';
|
|
402
416
|
|
|
@@ -472,7 +486,7 @@ describe("generator", () => {
|
|
|
472
486
|
ActionReturnTypeForOptions,
|
|
473
487
|
ApplyActionOptions,
|
|
474
488
|
ApplyBatchActionOptions,
|
|
475
|
-
} from '@osdk/
|
|
489
|
+
} from '@osdk/client';
|
|
476
490
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
477
491
|
import type { Todo } from '../objects/Todo';
|
|
478
492
|
|
|
@@ -548,7 +562,7 @@ describe("generator", () => {
|
|
|
548
562
|
",
|
|
549
563
|
"/foo/ontology/interfaces.ts": "export { SomeInterface } from './interfaces/SomeInterface';
|
|
550
564
|
",
|
|
551
|
-
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
565
|
+
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
552
566
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
553
567
|
|
|
554
568
|
import type {
|
|
@@ -556,7 +570,7 @@ describe("generator", () => {
|
|
|
556
570
|
ObjectSet as $ObjectSet,
|
|
557
571
|
Osdk as $Osdk,
|
|
558
572
|
PropertyValueWireToClient as $PropType,
|
|
559
|
-
} from '@osdk/
|
|
573
|
+
} from '@osdk/client';
|
|
560
574
|
|
|
561
575
|
export type OsdkObjectLinks$SomeInterface = {};
|
|
562
576
|
|
|
@@ -566,20 +580,18 @@ describe("generator", () => {
|
|
|
566
580
|
export interface Props {
|
|
567
581
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
568
582
|
}
|
|
569
|
-
export
|
|
570
|
-
readonly SomeProperty: $PropType['string'] | undefined;
|
|
571
|
-
}
|
|
583
|
+
export type StrictProps = Props;
|
|
572
584
|
|
|
573
585
|
export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
|
|
574
586
|
|
|
575
587
|
export type OsdkInstance<
|
|
576
|
-
OPTIONS extends never | '$
|
|
588
|
+
OPTIONS extends never | '$rid' = never,
|
|
577
589
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
578
590
|
> = $Osdk.Instance<SomeInterface, OPTIONS, K>;
|
|
579
591
|
|
|
580
592
|
/** @deprecated use OsdkInstance */
|
|
581
593
|
export type OsdkObject<
|
|
582
|
-
OPTIONS extends never | '$
|
|
594
|
+
OPTIONS extends never | '$rid' = never,
|
|
583
595
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
584
596
|
> = OsdkInstance<OPTIONS, K>;
|
|
585
597
|
}
|
|
@@ -619,7 +631,7 @@ describe("generator", () => {
|
|
|
619
631
|
"/foo/ontology/objects.ts": "export { Person } from './objects/Person';
|
|
620
632
|
export { Todo } from './objects/Todo';
|
|
621
633
|
",
|
|
622
|
-
"/foo/ontology/objects/Person.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
634
|
+
"/foo/ontology/objects/Person.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
623
635
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
624
636
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
625
637
|
import type { Todo } from './Todo';
|
|
@@ -627,14 +639,14 @@ describe("generator", () => {
|
|
|
627
639
|
PropertyKeys as $PropertyKeys,
|
|
628
640
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
629
641
|
ObjectMetadata as $ObjectMetadata,
|
|
630
|
-
} from '@osdk/
|
|
642
|
+
} from '@osdk/client';
|
|
631
643
|
import type {
|
|
632
644
|
ObjectSet as $ObjectSet,
|
|
633
645
|
Osdk as $Osdk,
|
|
634
646
|
OsdkObject as $OsdkObject,
|
|
635
647
|
PropertyValueWireToClient as $PropType,
|
|
636
648
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
637
|
-
} from '@osdk/
|
|
649
|
+
} from '@osdk/client';
|
|
638
650
|
|
|
639
651
|
export namespace Person {
|
|
640
652
|
export type PropertyKeys = 'email';
|
|
@@ -644,22 +656,20 @@ describe("generator", () => {
|
|
|
644
656
|
}
|
|
645
657
|
|
|
646
658
|
export interface Props {
|
|
647
|
-
readonly email: $PropType['string'] | undefined;
|
|
648
|
-
}
|
|
649
|
-
export interface StrictProps {
|
|
650
659
|
readonly email: $PropType['string'];
|
|
651
660
|
}
|
|
661
|
+
export type StrictProps = Props;
|
|
652
662
|
|
|
653
663
|
export interface ObjectSet extends $ObjectSet<Person, Person.ObjectSet> {}
|
|
654
664
|
|
|
655
665
|
export type OsdkInstance<
|
|
656
|
-
OPTIONS extends never | '$
|
|
666
|
+
OPTIONS extends never | '$rid' = never,
|
|
657
667
|
K extends keyof Person.Props = keyof Person.Props,
|
|
658
668
|
> = $Osdk.Instance<Person, OPTIONS, K>;
|
|
659
669
|
|
|
660
670
|
/** @deprecated use OsdkInstance */
|
|
661
671
|
export type OsdkObject<
|
|
662
|
-
OPTIONS extends never | '$
|
|
672
|
+
OPTIONS extends never | '$rid' = never,
|
|
663
673
|
K extends keyof Person.Props = keyof Person.Props,
|
|
664
674
|
> = OsdkInstance<OPTIONS, K>;
|
|
665
675
|
}
|
|
@@ -709,7 +719,7 @@ describe("generator", () => {
|
|
|
709
719
|
osdkMetadata: $osdkMetadata,
|
|
710
720
|
};
|
|
711
721
|
",
|
|
712
|
-
"/foo/ontology/objects/Todo.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
722
|
+
"/foo/ontology/objects/Todo.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
713
723
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
714
724
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
715
725
|
import type { Person } from './Person';
|
|
@@ -717,14 +727,14 @@ describe("generator", () => {
|
|
|
717
727
|
PropertyKeys as $PropertyKeys,
|
|
718
728
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
719
729
|
ObjectMetadata as $ObjectMetadata,
|
|
720
|
-
} from '@osdk/
|
|
730
|
+
} from '@osdk/client';
|
|
721
731
|
import type {
|
|
722
732
|
ObjectSet as $ObjectSet,
|
|
723
733
|
Osdk as $Osdk,
|
|
724
734
|
OsdkObject as $OsdkObject,
|
|
725
735
|
PropertyValueWireToClient as $PropType,
|
|
726
736
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
727
|
-
} from '@osdk/
|
|
737
|
+
} from '@osdk/client';
|
|
728
738
|
|
|
729
739
|
export namespace Todo {
|
|
730
740
|
export type PropertyKeys = 'id' | 'body' | 'complete';
|
|
@@ -734,26 +744,22 @@ describe("generator", () => {
|
|
|
734
744
|
}
|
|
735
745
|
|
|
736
746
|
export interface Props {
|
|
737
|
-
readonly body: $PropType['string'] | undefined;
|
|
738
|
-
readonly complete: $PropType['boolean'] | undefined;
|
|
739
|
-
readonly id: $PropType['integer'] | undefined;
|
|
740
|
-
}
|
|
741
|
-
export interface StrictProps {
|
|
742
747
|
readonly body: $PropType['string'] | undefined;
|
|
743
748
|
readonly complete: $PropType['boolean'] | undefined;
|
|
744
749
|
readonly id: $PropType['integer'];
|
|
745
750
|
}
|
|
751
|
+
export type StrictProps = Props;
|
|
746
752
|
|
|
747
753
|
export interface ObjectSet extends $ObjectSet<Todo, Todo.ObjectSet> {}
|
|
748
754
|
|
|
749
755
|
export type OsdkInstance<
|
|
750
|
-
OPTIONS extends never | '$
|
|
756
|
+
OPTIONS extends never | '$rid' = never,
|
|
751
757
|
K extends keyof Todo.Props = keyof Todo.Props,
|
|
752
758
|
> = $Osdk.Instance<Todo, OPTIONS, K>;
|
|
753
759
|
|
|
754
760
|
/** @deprecated use OsdkInstance */
|
|
755
761
|
export type OsdkObject<
|
|
756
|
-
OPTIONS extends never | '$
|
|
762
|
+
OPTIONS extends never | '$rid' = never,
|
|
757
763
|
K extends keyof Todo.Props = keyof Todo.Props,
|
|
758
764
|
> = OsdkInstance<OPTIONS, K>;
|
|
759
765
|
}
|
|
@@ -823,8 +829,7 @@ describe("generator", () => {
|
|
|
823
829
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount';
|
|
824
830
|
export { returnsTodo } from './queries/returnsTodo';
|
|
825
831
|
",
|
|
826
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, VersionBound } from '@osdk/
|
|
827
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
832
|
+
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
828
833
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
829
834
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
830
835
|
|
|
@@ -877,8 +882,7 @@ describe("generator", () => {
|
|
|
877
882
|
osdkMetadata: $osdkMetadata,
|
|
878
883
|
};
|
|
879
884
|
",
|
|
880
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, VersionBound } from '@osdk/
|
|
881
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
885
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/client';
|
|
882
886
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata';
|
|
883
887
|
import { $osdkMetadata } from '../../OntologyMetadata';
|
|
884
888
|
import type { Todo } from '../objects/Todo';
|
|
@@ -949,14 +953,14 @@ describe("generator", () => {
|
|
|
949
953
|
it("throws an error if a namespace is provided that all top levels do not use", async () => {
|
|
950
954
|
await expect(generateClientSdkVersionTwoPointZero({
|
|
951
955
|
...TodoWireOntology
|
|
952
|
-
}, "", helper.minimalFiles, BASE_PATH, "module"));
|
|
956
|
+
}, "", helper.minimalFiles, BASE_PATH, "module", undefined, undefined, undefined, true));
|
|
953
957
|
// Disabled for now since we can't really enforce it from dev console at the moment
|
|
954
958
|
// .rejects.toThrowErrorMatchingInlineSnapshot(
|
|
955
959
|
// `[Error: Found type { ns:'undefined', shortName: 'Todo'} but it is not in the generation namespace 'foo.bar'. This violates the contract of the generator.]`,
|
|
956
960
|
// );
|
|
957
961
|
});
|
|
958
962
|
it("does not throw an error if a namespace is provided that all top levels use", async () => {
|
|
959
|
-
await expect(generateClientSdkVersionTwoPointZero(fooBarTodoWireOntology, "", helper.minimalFiles, BASE_PATH, "module")).resolves.toMatchInlineSnapshot(`undefined`);
|
|
963
|
+
await expect(generateClientSdkVersionTwoPointZero(fooBarTodoWireOntology, "", helper.minimalFiles, BASE_PATH, "module", undefined, undefined, undefined, true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
960
964
|
expect(helper.getFiles()["/foo/ontology/objects/foo.bar.Todo.ts"]).toBeUndefined();
|
|
961
965
|
expect(helper.getFiles()["/foo/ontology/objects/Todo.ts"]).not.toBeUndefined();
|
|
962
966
|
expect(tweakedFilesForSnapshotConsistency(helper.getFiles())).toMatchInlineSnapshot(`
|
|
@@ -1156,20 +1160,18 @@ describe("generator", () => {
|
|
|
1156
1160
|
export interface Props {
|
|
1157
1161
|
readonly SomeProperty: $PropType['string'] | undefined;
|
|
1158
1162
|
}
|
|
1159
|
-
export
|
|
1160
|
-
readonly SomeProperty: $PropType['string'] | undefined;
|
|
1161
|
-
}
|
|
1163
|
+
export type StrictProps = Props;
|
|
1162
1164
|
|
|
1163
1165
|
export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
|
|
1164
1166
|
|
|
1165
1167
|
export type OsdkInstance<
|
|
1166
|
-
OPTIONS extends never | '$
|
|
1168
|
+
OPTIONS extends never | '$rid' = never,
|
|
1167
1169
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
1168
1170
|
> = $Osdk.Instance<SomeInterface, OPTIONS, K>;
|
|
1169
1171
|
|
|
1170
1172
|
/** @deprecated use OsdkInstance */
|
|
1171
1173
|
export type OsdkObject<
|
|
1172
|
-
OPTIONS extends never | '$
|
|
1174
|
+
OPTIONS extends never | '$rid' = never,
|
|
1173
1175
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
1174
1176
|
> = OsdkInstance<OPTIONS, K>;
|
|
1175
1177
|
}
|
|
@@ -1234,22 +1236,20 @@ describe("generator", () => {
|
|
|
1234
1236
|
}
|
|
1235
1237
|
|
|
1236
1238
|
export interface Props {
|
|
1237
|
-
readonly email: $PropType['string'] | undefined;
|
|
1238
|
-
}
|
|
1239
|
-
export interface StrictProps {
|
|
1240
1239
|
readonly email: $PropType['string'];
|
|
1241
1240
|
}
|
|
1241
|
+
export type StrictProps = Props;
|
|
1242
1242
|
|
|
1243
1243
|
export interface ObjectSet extends $ObjectSet<Person, Person.ObjectSet> {}
|
|
1244
1244
|
|
|
1245
1245
|
export type OsdkInstance<
|
|
1246
|
-
OPTIONS extends never | '$
|
|
1246
|
+
OPTIONS extends never | '$rid' = never,
|
|
1247
1247
|
K extends keyof Person.Props = keyof Person.Props,
|
|
1248
1248
|
> = $Osdk.Instance<Person, OPTIONS, K>;
|
|
1249
1249
|
|
|
1250
1250
|
/** @deprecated use OsdkInstance */
|
|
1251
1251
|
export type OsdkObject<
|
|
1252
|
-
OPTIONS extends never | '$
|
|
1252
|
+
OPTIONS extends never | '$rid' = never,
|
|
1253
1253
|
K extends keyof Person.Props = keyof Person.Props,
|
|
1254
1254
|
> = OsdkInstance<OPTIONS, K>;
|
|
1255
1255
|
}
|
|
@@ -1324,26 +1324,22 @@ describe("generator", () => {
|
|
|
1324
1324
|
}
|
|
1325
1325
|
|
|
1326
1326
|
export interface Props {
|
|
1327
|
-
readonly body: $PropType['string'] | undefined;
|
|
1328
|
-
readonly complete: $PropType['boolean'] | undefined;
|
|
1329
|
-
readonly id: $PropType['integer'] | undefined;
|
|
1330
|
-
}
|
|
1331
|
-
export interface StrictProps {
|
|
1332
1327
|
readonly body: $PropType['string'] | undefined;
|
|
1333
1328
|
readonly complete: $PropType['boolean'] | undefined;
|
|
1334
1329
|
readonly id: $PropType['integer'];
|
|
1335
1330
|
}
|
|
1331
|
+
export type StrictProps = Props;
|
|
1336
1332
|
|
|
1337
1333
|
export interface ObjectSet extends $ObjectSet<Todo, Todo.ObjectSet> {}
|
|
1338
1334
|
|
|
1339
1335
|
export type OsdkInstance<
|
|
1340
|
-
OPTIONS extends never | '$
|
|
1336
|
+
OPTIONS extends never | '$rid' = never,
|
|
1341
1337
|
K extends keyof Todo.Props = keyof Todo.Props,
|
|
1342
1338
|
> = $Osdk.Instance<Todo, OPTIONS, K>;
|
|
1343
1339
|
|
|
1344
1340
|
/** @deprecated use OsdkInstance */
|
|
1345
1341
|
export type OsdkObject<
|
|
1346
|
-
OPTIONS extends never | '$
|
|
1342
|
+
OPTIONS extends never | '$rid' = never,
|
|
1347
1343
|
K extends keyof Todo.Props = keyof Todo.Props,
|
|
1348
1344
|
> = OsdkInstance<OPTIONS, K>;
|
|
1349
1345
|
}
|
|
@@ -1413,8 +1409,7 @@ describe("generator", () => {
|
|
|
1413
1409
|
"/foo/ontology/queries.ts": "export { getCount } from './queries/getCount.js';
|
|
1414
1410
|
export { returnsTodo } from './queries/returnsTodo.js';
|
|
1415
1411
|
",
|
|
1416
|
-
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1417
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1412
|
+
"/foo/ontology/queries/getCount.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1418
1413
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1419
1414
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1420
1415
|
|
|
@@ -1467,8 +1462,7 @@ describe("generator", () => {
|
|
|
1467
1462
|
osdkMetadata: $osdkMetadata,
|
|
1468
1463
|
};
|
|
1469
1464
|
",
|
|
1470
|
-
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1471
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1465
|
+
"/foo/ontology/queries/returnsTodo.ts": "import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1472
1466
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1473
1467
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1474
1468
|
import type { Todo } from '../objects/Todo.js';
|
|
@@ -1576,10 +1570,9 @@ describe("generator", () => {
|
|
|
1576
1570
|
});
|
|
1577
1571
|
describe("query depends on foreign object", () => {
|
|
1578
1572
|
it("generates the correct code", async () => {
|
|
1579
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1573
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1580
1574
|
expect(helper.getFiles()["/foo/ontology/queries/getTask.ts"]).toMatchInlineSnapshot(`
|
|
1581
|
-
"import type { QueryDefinition, VersionBound } from '@osdk/api';
|
|
1582
|
-
import type { QueryParam, QueryResult } from '@osdk/api';
|
|
1575
|
+
"import type { QueryDefinition, QueryParam, QueryResult, VersionBound } from '@osdk/api';
|
|
1583
1576
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1584
1577
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1585
1578
|
import type { Task as $Imported$com$example$dep$Task } from '@com.example.dep/osdk';
|
|
@@ -1642,7 +1635,7 @@ describe("generator", () => {
|
|
|
1642
1635
|
});
|
|
1643
1636
|
describe("object uses on foreign spt", () => {
|
|
1644
1637
|
it("stuff", async () => {
|
|
1645
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1638
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1646
1639
|
expect(helper.getFiles()["/foo/ontology/objects/UsesForeignSpt.ts"]).toMatchInlineSnapshot(`
|
|
1647
1640
|
"import type { PropertyDef as $PropertyDef } from '@osdk/api';
|
|
1648
1641
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
@@ -1666,24 +1659,21 @@ describe("generator", () => {
|
|
|
1666
1659
|
export type Links = {};
|
|
1667
1660
|
|
|
1668
1661
|
export interface Props {
|
|
1669
|
-
readonly body: $PropType['string'] | undefined;
|
|
1670
|
-
readonly id: $PropType['integer'] | undefined;
|
|
1671
|
-
}
|
|
1672
|
-
export interface StrictProps {
|
|
1673
1662
|
readonly body: $PropType['string'] | undefined;
|
|
1674
1663
|
readonly id: $PropType['integer'];
|
|
1675
1664
|
}
|
|
1665
|
+
export type StrictProps = Props;
|
|
1676
1666
|
|
|
1677
1667
|
export interface ObjectSet extends $ObjectSet<UsesForeignSpt, UsesForeignSpt.ObjectSet> {}
|
|
1678
1668
|
|
|
1679
1669
|
export type OsdkInstance<
|
|
1680
|
-
OPTIONS extends never | '$
|
|
1670
|
+
OPTIONS extends never | '$rid' = never,
|
|
1681
1671
|
K extends keyof UsesForeignSpt.Props = keyof UsesForeignSpt.Props,
|
|
1682
1672
|
> = $Osdk.Instance<UsesForeignSpt, OPTIONS, K>;
|
|
1683
1673
|
|
|
1684
1674
|
/** @deprecated use OsdkInstance */
|
|
1685
1675
|
export type OsdkObject<
|
|
1686
|
-
OPTIONS extends never | '$
|
|
1676
|
+
OPTIONS extends never | '$rid' = never,
|
|
1687
1677
|
K extends keyof UsesForeignSpt.Props = keyof UsesForeignSpt.Props,
|
|
1688
1678
|
> = OsdkInstance<OPTIONS, K>;
|
|
1689
1679
|
}
|
|
@@ -1739,7 +1729,7 @@ describe("generator", () => {
|
|
|
1739
1729
|
});
|
|
1740
1730
|
describe("action depends on foreign object", () => {
|
|
1741
1731
|
it("can generate the action", async () => {
|
|
1742
|
-
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]))).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1732
|
+
await expect(generateClientSdkVersionTwoPointZero(referencingOntology, "", helper.minimalFiles, BASE_PATH, "module", new Map([["com.example.dep.Task", "@com.example.dep/osdk"]]), new Map([["com.example.dep.SomeInterface", "@com.example.dep/osdk"]]), new Map([["com.example.dep.spt", "@com.example.dep/osdk"]]), true)).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1743
1733
|
expect(helper.getFiles()["/foo/ontology/actions/setTaskBody.ts"]).toMatchInlineSnapshot(`
|
|
1744
1734
|
"import type {
|
|
1745
1735
|
ActionDefinition,
|
|
@@ -1822,7 +1812,9 @@ describe("generator", () => {
|
|
|
1822
1812
|
});
|
|
1823
1813
|
});
|
|
1824
1814
|
it("can generate an sdk package that is entirely a library", async () => {
|
|
1815
|
+
const mockConsola = vi.spyOn(consola, "info");
|
|
1825
1816
|
await expect(generateClientSdkVersionTwoPointZero(referencedOntology, "", helper.minimalFiles, BASE_PATH, "module")).resolves.toMatchInlineSnapshot(`undefined`);
|
|
1817
|
+
expect(mockConsola).toHaveBeenCalledWith(`{"type":"futureUnknownType"} is not a supported propertyType`);
|
|
1826
1818
|
expect(tweakedFilesForSnapshotConsistency(helper.getFiles())).toMatchInlineSnapshot(`
|
|
1827
1819
|
{
|
|
1828
1820
|
"/foo/OntologyMetadata.ts": "export type $ExpectedClientVersion = 'PLACEHOLDER';
|
|
@@ -1844,7 +1836,7 @@ describe("generator", () => {
|
|
|
1844
1836
|
",
|
|
1845
1837
|
"/foo/ontology/interfaces.ts": "export { SomeInterface } from './interfaces/SomeInterface.js';
|
|
1846
1838
|
",
|
|
1847
|
-
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
1839
|
+
"/foo/ontology/interfaces/SomeInterface.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
1848
1840
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1849
1841
|
|
|
1850
1842
|
import type {
|
|
@@ -1852,7 +1844,7 @@ describe("generator", () => {
|
|
|
1852
1844
|
ObjectSet as $ObjectSet,
|
|
1853
1845
|
Osdk as $Osdk,
|
|
1854
1846
|
PropertyValueWireToClient as $PropType,
|
|
1855
|
-
} from '@osdk/
|
|
1847
|
+
} from '@osdk/client';
|
|
1856
1848
|
|
|
1857
1849
|
export type OsdkObjectLinks$SomeInterface = {};
|
|
1858
1850
|
|
|
@@ -1862,20 +1854,18 @@ describe("generator", () => {
|
|
|
1862
1854
|
export interface Props {
|
|
1863
1855
|
readonly spt: $PropType['string'] | undefined;
|
|
1864
1856
|
}
|
|
1865
|
-
export
|
|
1866
|
-
readonly spt: $PropType['string'] | undefined;
|
|
1867
|
-
}
|
|
1857
|
+
export type StrictProps = Props;
|
|
1868
1858
|
|
|
1869
1859
|
export interface ObjectSet extends $ObjectSet<SomeInterface, SomeInterface.ObjectSet> {}
|
|
1870
1860
|
|
|
1871
1861
|
export type OsdkInstance<
|
|
1872
|
-
OPTIONS extends never | '$
|
|
1862
|
+
OPTIONS extends never | '$rid' = never,
|
|
1873
1863
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
1874
1864
|
> = $Osdk.Instance<SomeInterface, OPTIONS, K>;
|
|
1875
1865
|
|
|
1876
1866
|
/** @deprecated use OsdkInstance */
|
|
1877
1867
|
export type OsdkObject<
|
|
1878
|
-
OPTIONS extends never | '$
|
|
1868
|
+
OPTIONS extends never | '$rid' = never,
|
|
1879
1869
|
K extends keyof SomeInterface.Props = keyof SomeInterface.Props,
|
|
1880
1870
|
> = OsdkInstance<OPTIONS, K>;
|
|
1881
1871
|
}
|
|
@@ -1912,21 +1902,21 @@ describe("generator", () => {
|
|
|
1912
1902
|
",
|
|
1913
1903
|
"/foo/ontology/objects.ts": "export { Task } from './objects/Task.js';
|
|
1914
1904
|
",
|
|
1915
|
-
"/foo/ontology/objects/Task.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/
|
|
1905
|
+
"/foo/ontology/objects/Task.ts": "import type { PropertyDef as $PropertyDef } from '@osdk/client';
|
|
1916
1906
|
import { $osdkMetadata } from '../../OntologyMetadata.js';
|
|
1917
1907
|
import type { $ExpectedClientVersion } from '../../OntologyMetadata.js';
|
|
1918
1908
|
import type {
|
|
1919
1909
|
PropertyKeys as $PropertyKeys,
|
|
1920
1910
|
ObjectTypeDefinition as $ObjectTypeDefinition,
|
|
1921
1911
|
ObjectMetadata as $ObjectMetadata,
|
|
1922
|
-
} from '@osdk/
|
|
1912
|
+
} from '@osdk/client';
|
|
1923
1913
|
import type {
|
|
1924
1914
|
ObjectSet as $ObjectSet,
|
|
1925
1915
|
Osdk as $Osdk,
|
|
1926
1916
|
OsdkObject as $OsdkObject,
|
|
1927
1917
|
PropertyValueWireToClient as $PropType,
|
|
1928
1918
|
SingleLinkAccessor as $SingleLinkAccessor,
|
|
1929
|
-
} from '@osdk/
|
|
1919
|
+
} from '@osdk/client';
|
|
1930
1920
|
|
|
1931
1921
|
export namespace Task {
|
|
1932
1922
|
export type PropertyKeys = 'taskId' | 'body';
|
|
@@ -1934,24 +1924,21 @@ describe("generator", () => {
|
|
|
1934
1924
|
export type Links = {};
|
|
1935
1925
|
|
|
1936
1926
|
export interface Props {
|
|
1937
|
-
readonly body: $PropType['string'] | undefined;
|
|
1938
|
-
readonly taskId: $PropType['string'] | undefined;
|
|
1939
|
-
}
|
|
1940
|
-
export interface StrictProps {
|
|
1941
1927
|
readonly body: $PropType['string'] | undefined;
|
|
1942
1928
|
readonly taskId: $PropType['string'];
|
|
1943
1929
|
}
|
|
1930
|
+
export type StrictProps = Props;
|
|
1944
1931
|
|
|
1945
1932
|
export interface ObjectSet extends $ObjectSet<Task, Task.ObjectSet> {}
|
|
1946
1933
|
|
|
1947
1934
|
export type OsdkInstance<
|
|
1948
|
-
OPTIONS extends never | '$
|
|
1935
|
+
OPTIONS extends never | '$rid' = never,
|
|
1949
1936
|
K extends keyof Task.Props = keyof Task.Props,
|
|
1950
1937
|
> = $Osdk.Instance<Task, OPTIONS, K>;
|
|
1951
1938
|
|
|
1952
1939
|
/** @deprecated use OsdkInstance */
|
|
1953
1940
|
export type OsdkObject<
|
|
1954
|
-
OPTIONS extends never | '$
|
|
1941
|
+
OPTIONS extends never | '$rid' = never,
|
|
1955
1942
|
K extends keyof Task.Props = keyof Task.Props,
|
|
1956
1943
|
> = OsdkInstance<OPTIONS, K>;
|
|
1957
1944
|
}
|