@sprucelabs/spruce-cli 14.20.2 → 14.21.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/CHANGELOG.md +11 -0
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.d.ts +3 -2
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js +174 -31
- package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +1 -1
- package/build/features/event/actions/SetRemoteAction.js +1 -1
- package/build/features/event/actions/SetRemoteAction.js.map +1 -1
- package/build/features/schema/writers/SchemaWriter.js +4 -4
- package/build/features/schema/writers/SchemaWriter.js.map +1 -1
- package/package.json +3 -3
- package/src/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.ts +110 -5
- package/src/features/event/actions/SetRemoteAction.ts +1 -1
- package/src/features/schema/writers/SchemaWriter.ts +3 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [14.21.0](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.20.2...v14.21.0) (2021-09-20)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Features
|
|
10
|
+
|
|
11
|
+
* remote as last var ([5bb1539](https://github.com/sprucelabsai/spruce-cli-workspace/commit/5bb1539))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [14.20.2](https://github.com/sprucelabsai/spruce-cli-workspace/compare/v14.20.1...v14.20.2) (2021-09-15)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @sprucelabs/spruce-cli
|
|
@@ -9,13 +9,14 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
9
9
|
protected static templateItemGeneratorHonorsModuleToImportWhenRemoteWhenInRemoteNamespace(): Promise<void>;
|
|
10
10
|
protected static moduleToImportWhenRemoteIgnoredWhenInSameNamespace(): Promise<void>;
|
|
11
11
|
protected static asksIfModuleShouldBeInstalled(schemaNames: ('schema1' | 'schema2')[], expectedModules: string[], shouldConfirmInstall: boolean): Promise<void>;
|
|
12
|
-
protected static
|
|
12
|
+
protected static schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace(schemaNames: ('schema1' | 'schema2')[]): Promise<void>;
|
|
13
13
|
protected static canReferenceSchemaImportedFromAnotherModule(importsWhenRemote: string[]): Promise<void>;
|
|
14
14
|
protected static canSetImportFromModuleWithNestedSchemasWhenRemoteWhenSyncing(): Promise<void>;
|
|
15
15
|
protected static canHandleFormBuilderImportExportObject(): Promise<void>;
|
|
16
|
+
protected static importedSchemasDoNotShowUpInSchemaTypes(): Promise<void>;
|
|
16
17
|
private static SyncAction;
|
|
17
18
|
private static importGeneratedFile;
|
|
18
19
|
private static assertCalendarEventSchemaIsImported;
|
|
19
20
|
private static generateTemplateItems;
|
|
20
|
-
private static
|
|
21
|
+
private static assertValidTypesFileWhenAddingRemoteImport;
|
|
21
22
|
}
|
|
@@ -37,7 +37,7 @@ var _AbstractSkillTest2 = _interopRequireDefault(require("../../tests/AbstractSk
|
|
|
37
37
|
|
|
38
38
|
var _test2 = _interopRequireDefault(require("../../tests/utilities/test.utility"));
|
|
39
39
|
|
|
40
|
-
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _class, _class2, _temp;
|
|
40
|
+
var _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _dec9, _dec10, _dec11, _dec12, _dec13, _dec14, _dec15, _class, _class2, _temp;
|
|
41
41
|
|
|
42
42
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
43
43
|
|
|
@@ -57,7 +57,7 @@ var LOCAL_NAMESPACE = 'TestingSchemas';
|
|
|
57
57
|
var REMOTE_NAMESPACE = 'RemoteSchemas';
|
|
58
58
|
var REMOTE_MODULE = '@sprucelabs/spruce-calendar-utils';
|
|
59
59
|
var REMOTE_MODULE2 = '@sprucelabs/spruce-templates';
|
|
60
|
-
var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can specify importFromModuleWhenRemote 1', 'CalendarEvent', REMOTE_MODULE, '1'), _dec2 = (0, _test.test)('can specify importFromModuleWhenRemote 2', 'CalendarEvent2', REMOTE_MODULE2, '2'), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)('should ask about missing module and cancel install', ['schema1'], [REMOTE_MODULE], false), _dec6 = (0, _test.test)('should ask about missing module and do install', ['schema1'], [REMOTE_MODULE], true), _dec7 = (0, _test.test)('should ask about missing module and do install', ['schema1', 'schema2'], [REMOTE_MODULE, REMOTE_MODULE2], true), _dec8 = (0, _test.test)('does not return the same module twice', ['schema1', 'schema1b', 'schema2'], [REMOTE_MODULE, REMOTE_MODULE2], true), _dec9 = (0, _test.test)('schemas are imported from one module', ['schema1']), _dec10 = (0, _test.test)('schemas are imported from two modules', ['schema1', 'schema2']), _dec11 = (0, _test.test)('can reference impored from another module', ["import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'"]), _dec12 = (0, _test.test)('can reference impored from another module with two importsWhenLocal', ["import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'", "import * as HeartwoodTypesLocal2 from '@sprucelabs/heartwood-view-controllers'"]), _dec13 = (0, _test.test)(), _dec14 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
60
|
+
var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can specify importFromModuleWhenRemote 1', 'CalendarEvent', REMOTE_MODULE, '1'), _dec2 = (0, _test.test)('can specify importFromModuleWhenRemote 2', 'CalendarEvent2', REMOTE_MODULE2, '2'), _dec3 = (0, _test.test)(), _dec4 = (0, _test.test)(), _dec5 = (0, _test.test)('should ask about missing module and cancel install', ['schema1'], [REMOTE_MODULE], false), _dec6 = (0, _test.test)('should ask about missing module and do install', ['schema1'], [REMOTE_MODULE], true), _dec7 = (0, _test.test)('should ask about missing module and do install', ['schema1', 'schema2'], [REMOTE_MODULE, REMOTE_MODULE2], true), _dec8 = (0, _test.test)('does not return the same module twice', ['schema1', 'schema1b', 'schema2'], [REMOTE_MODULE, REMOTE_MODULE2], true), _dec9 = (0, _test.test)('schemas are imported from one module', ['schema1']), _dec10 = (0, _test.test)('schemas are imported from two modules', ['schema1', 'schema2']), _dec11 = (0, _test.test)('can reference impored from another module', ["import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'"]), _dec12 = (0, _test.test)('can reference impored from another module with two importsWhenLocal', ["import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'", "import * as HeartwoodTypesLocal2 from '@sprucelabs/heartwood-view-controllers'"]), _dec13 = (0, _test.test)(), _dec14 = (0, _test.test)(), _dec15 = (0, _test.test)(), (_class = (_temp = _class2 = /*#__PURE__*/function (_AbstractSkillTest) {
|
|
61
61
|
(0, _inherits2["default"])(SettingUpSchemasForModuleDistributionTest, _AbstractSkillTest);
|
|
62
62
|
|
|
63
63
|
var _super = _createSuper(SettingUpSchemasForModuleDistributionTest);
|
|
@@ -341,9 +341,9 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
341
341
|
return asksIfModuleShouldBeInstalled;
|
|
342
342
|
}()
|
|
343
343
|
}, {
|
|
344
|
-
key: "
|
|
344
|
+
key: "schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace",
|
|
345
345
|
value: function () {
|
|
346
|
-
var
|
|
346
|
+
var _schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee7(schemaNames) {
|
|
347
347
|
var schemas, _iterator5, _step5, name, results;
|
|
348
348
|
|
|
349
349
|
return _regenerator["default"].wrap(function _callee7$(_context7) {
|
|
@@ -414,11 +414,11 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
414
414
|
}, _callee7, this);
|
|
415
415
|
}));
|
|
416
416
|
|
|
417
|
-
function
|
|
418
|
-
return
|
|
417
|
+
function schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace(_x7) {
|
|
418
|
+
return _schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace.apply(this, arguments);
|
|
419
419
|
}
|
|
420
420
|
|
|
421
|
-
return
|
|
421
|
+
return schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace;
|
|
422
422
|
}()
|
|
423
423
|
}, {
|
|
424
424
|
key: "canReferenceSchemaImportedFromAnotherModule",
|
|
@@ -492,7 +492,7 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
492
492
|
|
|
493
493
|
case 17:
|
|
494
494
|
_context9.next = 19;
|
|
495
|
-
return this.
|
|
495
|
+
return this.assertValidTypesFileWhenAddingRemoteImport(results);
|
|
496
496
|
|
|
497
497
|
case 19:
|
|
498
498
|
case "end":
|
|
@@ -639,6 +639,111 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
639
639
|
|
|
640
640
|
return canHandleFormBuilderImportExportObject;
|
|
641
641
|
}()
|
|
642
|
+
}, {
|
|
643
|
+
key: "importedSchemasDoNotShowUpInSchemaTypes",
|
|
644
|
+
value: function () {
|
|
645
|
+
var _importedSchemasDoNotShowUpInSchemaTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee13() {
|
|
646
|
+
var schema1, schema2, results, schemaTypesFile;
|
|
647
|
+
return _regenerator["default"].wrap(function _callee13$(_context13) {
|
|
648
|
+
while (1) {
|
|
649
|
+
switch (_context13.prev = _context13.next) {
|
|
650
|
+
case 0:
|
|
651
|
+
_context13.next = 2;
|
|
652
|
+
return this.Store('skill').setCurrentSkillsNamespace('TestingTwo');
|
|
653
|
+
|
|
654
|
+
case 2:
|
|
655
|
+
schema1 = {
|
|
656
|
+
id: 'fullCompletedForm',
|
|
657
|
+
namespace: 'Heartwood',
|
|
658
|
+
version: _spruceSkillUtils.versionUtil.generateVersion().dirValue,
|
|
659
|
+
moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',
|
|
660
|
+
importsWhenRemote: ['import * from bananarama'],
|
|
661
|
+
fields: {
|
|
662
|
+
id: {
|
|
663
|
+
type: 'id',
|
|
664
|
+
isRequired: true
|
|
665
|
+
},
|
|
666
|
+
personId: {
|
|
667
|
+
type: 'id',
|
|
668
|
+
isRequired: true
|
|
669
|
+
},
|
|
670
|
+
values: {
|
|
671
|
+
type: 'raw',
|
|
672
|
+
isArray: true,
|
|
673
|
+
options: {
|
|
674
|
+
valueType: 'Record<string, any>'
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
schema2 = {
|
|
680
|
+
id: 'localCompleted',
|
|
681
|
+
version: _spruceSkillUtils.versionUtil.generateVersion().dirValue,
|
|
682
|
+
fields: {
|
|
683
|
+
id: {
|
|
684
|
+
type: 'id',
|
|
685
|
+
isRequired: true
|
|
686
|
+
},
|
|
687
|
+
personId: {
|
|
688
|
+
type: 'id',
|
|
689
|
+
isRequired: true
|
|
690
|
+
},
|
|
691
|
+
values: {
|
|
692
|
+
type: 'raw',
|
|
693
|
+
isArray: true,
|
|
694
|
+
options: {
|
|
695
|
+
valueType: 'Record<string, any>'
|
|
696
|
+
}
|
|
697
|
+
}
|
|
698
|
+
}
|
|
699
|
+
};
|
|
700
|
+
_context13.next = 6;
|
|
701
|
+
return this.getEmitter().on('schema.did-fetch-schemas', /*#__PURE__*/(0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee12() {
|
|
702
|
+
return _regenerator["default"].wrap(function _callee12$(_context12) {
|
|
703
|
+
while (1) {
|
|
704
|
+
switch (_context12.prev = _context12.next) {
|
|
705
|
+
case 0:
|
|
706
|
+
return _context12.abrupt("return", {
|
|
707
|
+
schemas: [schema1, schema2]
|
|
708
|
+
});
|
|
709
|
+
|
|
710
|
+
case 1:
|
|
711
|
+
case "end":
|
|
712
|
+
return _context12.stop();
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
}, _callee12);
|
|
716
|
+
})));
|
|
717
|
+
|
|
718
|
+
case 6:
|
|
719
|
+
_context13.next = 8;
|
|
720
|
+
return this.SyncAction().execute({
|
|
721
|
+
shouldInstallMissingDependencies: true
|
|
722
|
+
});
|
|
723
|
+
|
|
724
|
+
case 8:
|
|
725
|
+
results = _context13.sent;
|
|
726
|
+
|
|
727
|
+
_test.assert.isFalsy(results.errors);
|
|
728
|
+
|
|
729
|
+
schemaTypesFile = _test2["default"].assertFileByNameInGeneratedFiles('schemas.types.ts', results.files);
|
|
730
|
+
_context13.next = 13;
|
|
731
|
+
return this.Service('typeChecker').check(schemaTypesFile);
|
|
732
|
+
|
|
733
|
+
case 13:
|
|
734
|
+
case "end":
|
|
735
|
+
return _context13.stop();
|
|
736
|
+
}
|
|
737
|
+
}
|
|
738
|
+
}, _callee13, this);
|
|
739
|
+
}));
|
|
740
|
+
|
|
741
|
+
function importedSchemasDoNotShowUpInSchemaTypes() {
|
|
742
|
+
return _importedSchemasDoNotShowUpInSchemaTypes.apply(this, arguments);
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
return importedSchemasDoNotShowUpInSchemaTypes;
|
|
746
|
+
}()
|
|
642
747
|
}, {
|
|
643
748
|
key: "SyncAction",
|
|
644
749
|
value: function SyncAction() {
|
|
@@ -651,25 +756,25 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
651
756
|
}, {
|
|
652
757
|
key: "importGeneratedFile",
|
|
653
758
|
value: function () {
|
|
654
|
-
var _importGeneratedFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
759
|
+
var _importGeneratedFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee14(results, fileName) {
|
|
655
760
|
var schemaFile;
|
|
656
|
-
return _regenerator["default"].wrap(function
|
|
761
|
+
return _regenerator["default"].wrap(function _callee14$(_context14) {
|
|
657
762
|
while (1) {
|
|
658
|
-
switch (
|
|
763
|
+
switch (_context14.prev = _context14.next) {
|
|
659
764
|
case 0:
|
|
660
765
|
schemaFile = _test2["default"].assertFileByNameInGeneratedFiles(fileName, results.files);
|
|
661
|
-
|
|
766
|
+
_context14.next = 3;
|
|
662
767
|
return this.Service('import').importDefault(schemaFile);
|
|
663
768
|
|
|
664
769
|
case 3:
|
|
665
|
-
return
|
|
770
|
+
return _context14.abrupt("return", _context14.sent);
|
|
666
771
|
|
|
667
772
|
case 4:
|
|
668
773
|
case "end":
|
|
669
|
-
return
|
|
774
|
+
return _context14.stop();
|
|
670
775
|
}
|
|
671
776
|
}
|
|
672
|
-
},
|
|
777
|
+
}, _callee14, this);
|
|
673
778
|
}));
|
|
674
779
|
|
|
675
780
|
function importGeneratedFile(_x9, _x10) {
|
|
@@ -681,11 +786,11 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
681
786
|
}, {
|
|
682
787
|
key: "assertCalendarEventSchemaIsImported",
|
|
683
788
|
value: function () {
|
|
684
|
-
var _assertCalendarEventSchemaIsImported = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function
|
|
789
|
+
var _assertCalendarEventSchemaIsImported = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee15(results) {
|
|
685
790
|
var imported, calendarEventContents;
|
|
686
|
-
return _regenerator["default"].wrap(function
|
|
791
|
+
return _regenerator["default"].wrap(function _callee15$(_context15) {
|
|
687
792
|
while (1) {
|
|
688
|
-
switch (
|
|
793
|
+
switch (_context15.prev = _context15.next) {
|
|
689
794
|
case 0:
|
|
690
795
|
_test.assert.isFalsy(results.errors);
|
|
691
796
|
|
|
@@ -696,10 +801,10 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
696
801
|
|
|
697
802
|
case 4:
|
|
698
803
|
case "end":
|
|
699
|
-
return
|
|
804
|
+
return _context15.stop();
|
|
700
805
|
}
|
|
701
806
|
}
|
|
702
|
-
},
|
|
807
|
+
}, _callee15);
|
|
703
808
|
}));
|
|
704
809
|
|
|
705
810
|
function assertCalendarEventSchemaIsImported(_x11) {
|
|
@@ -732,38 +837,76 @@ var SettingUpSchemasForModuleDistributionTest = (_dec = (0, _test.test)('can spe
|
|
|
732
837
|
return templateItems;
|
|
733
838
|
}
|
|
734
839
|
}, {
|
|
735
|
-
key: "
|
|
840
|
+
key: "assertValidTypesFileWhenAddingRemoteImport",
|
|
736
841
|
value: function () {
|
|
737
|
-
var
|
|
842
|
+
var _assertValidTypesFileWhenAddingRemoteImport = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee16(results) {
|
|
738
843
|
var schemaTypesFile, typesContent;
|
|
739
|
-
return _regenerator["default"].wrap(function
|
|
844
|
+
return _regenerator["default"].wrap(function _callee16$(_context16) {
|
|
740
845
|
while (1) {
|
|
741
|
-
switch (
|
|
846
|
+
switch (_context16.prev = _context16.next) {
|
|
742
847
|
case 0:
|
|
743
848
|
schemaTypesFile = _test2["default"].assertFileByNameInGeneratedFiles('schemas.types.ts', results.files);
|
|
744
849
|
typesContent = "import '".concat(REMOTE_MODULE, "'\n\n").concat(_spruceSkillUtils.diskUtil.readFile(schemaTypesFile));
|
|
745
850
|
|
|
746
851
|
_spruceSkillUtils.diskUtil.writeFile(schemaTypesFile, typesContent);
|
|
747
852
|
|
|
748
|
-
|
|
853
|
+
_context16.next = 5;
|
|
749
854
|
return this.Service('typeChecker').check(schemaTypesFile);
|
|
750
855
|
|
|
751
856
|
case 5:
|
|
752
857
|
case "end":
|
|
753
|
-
return
|
|
858
|
+
return _context16.stop();
|
|
754
859
|
}
|
|
755
860
|
}
|
|
756
|
-
},
|
|
861
|
+
}, _callee16, this);
|
|
757
862
|
}));
|
|
758
863
|
|
|
759
|
-
function
|
|
760
|
-
return
|
|
864
|
+
function assertValidTypesFileWhenAddingRemoteImport(_x12) {
|
|
865
|
+
return _assertValidTypesFileWhenAddingRemoteImport.apply(this, arguments);
|
|
761
866
|
}
|
|
762
867
|
|
|
763
|
-
return
|
|
868
|
+
return assertValidTypesFileWhenAddingRemoteImport;
|
|
764
869
|
}()
|
|
765
870
|
}]);
|
|
766
871
|
return SettingUpSchemasForModuleDistributionTest;
|
|
767
|
-
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'schemas'), (0, _defineProperty2["default"])(_class2, "builder1", void 0), (0, _defineProperty2["default"])(_class2, "schema1",
|
|
872
|
+
}(_AbstractSkillTest2["default"]), (0, _defineProperty2["default"])(_class2, "skillCacheKey", 'schemas'), (0, _defineProperty2["default"])(_class2, "builder1", void 0), (0, _defineProperty2["default"])(_class2, "schema1", {
|
|
873
|
+
id: 'calendarEvent',
|
|
874
|
+
version: 'v2021_09_20',
|
|
875
|
+
namespace: 'TestingSchemas',
|
|
876
|
+
name: 'Schema imported as module',
|
|
877
|
+
moduleToImportFromWhenRemote: '@sprucelabs/spruce-calendar-utils',
|
|
878
|
+
fields: {
|
|
879
|
+
fieldName1: {
|
|
880
|
+
label: 'First Field',
|
|
881
|
+
type: 'text',
|
|
882
|
+
isRequired: true
|
|
883
|
+
},
|
|
884
|
+
fieldName2: {
|
|
885
|
+
label: 'Second Field',
|
|
886
|
+
type: 'number',
|
|
887
|
+
isRequired: true,
|
|
888
|
+
hint: 'A hint'
|
|
889
|
+
}
|
|
890
|
+
}
|
|
891
|
+
}), (0, _defineProperty2["default"])(_class2, "schema1b", void 0), (0, _defineProperty2["default"])(_class2, "schema2", {
|
|
892
|
+
id: 'calendarEvent2',
|
|
893
|
+
version: 'v2021_09_20',
|
|
894
|
+
namespace: 'TestingSchemas',
|
|
895
|
+
name: 'Schema imported as module',
|
|
896
|
+
moduleToImportFromWhenRemote: '@sprucelabs/spruce-templates',
|
|
897
|
+
fields: {
|
|
898
|
+
fieldName1: {
|
|
899
|
+
label: 'First Field',
|
|
900
|
+
type: 'text',
|
|
901
|
+
isRequired: true
|
|
902
|
+
},
|
|
903
|
+
fieldName2: {
|
|
904
|
+
label: 'Second Field',
|
|
905
|
+
type: 'number',
|
|
906
|
+
isRequired: true,
|
|
907
|
+
hint: 'A hint'
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}), _temp), ((0, _applyDecoratedDescriptor2["default"])(_class, "canSpecifyModuleToImportFromWhenRemote", [_dec, _dec2], Object.getOwnPropertyDescriptor(_class, "canSpecifyModuleToImportFromWhenRemote"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "templateItemGeneratorHonorsModuleToImportWhenRemoteWhenInRemoteNamespace", [_dec3], Object.getOwnPropertyDescriptor(_class, "templateItemGeneratorHonorsModuleToImportWhenRemoteWhenInRemoteNamespace"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "moduleToImportWhenRemoteIgnoredWhenInSameNamespace", [_dec4], Object.getOwnPropertyDescriptor(_class, "moduleToImportWhenRemoteIgnoredWhenInSameNamespace"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "asksIfModuleShouldBeInstalled", [_dec5, _dec6, _dec7, _dec8], Object.getOwnPropertyDescriptor(_class, "asksIfModuleShouldBeInstalled"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace", [_dec9, _dec10], Object.getOwnPropertyDescriptor(_class, "schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canReferenceSchemaImportedFromAnotherModule", [_dec11, _dec12], Object.getOwnPropertyDescriptor(_class, "canReferenceSchemaImportedFromAnotherModule"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canSetImportFromModuleWithNestedSchemasWhenRemoteWhenSyncing", [_dec13], Object.getOwnPropertyDescriptor(_class, "canSetImportFromModuleWithNestedSchemasWhenRemoteWhenSyncing"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "canHandleFormBuilderImportExportObject", [_dec14], Object.getOwnPropertyDescriptor(_class, "canHandleFormBuilderImportExportObject"), _class), (0, _applyDecoratedDescriptor2["default"])(_class, "importedSchemasDoNotShowUpInSchemaTypes", [_dec15], Object.getOwnPropertyDescriptor(_class, "importedSchemasDoNotShowUpInSchemaTypes"), _class)), _class));
|
|
768
911
|
exports["default"] = SettingUpSchemasForModuleDistributionTest;
|
|
769
912
|
//# sourceMappingURL=SettingUpSchemasForModuleDistribution.test.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.ts"],"names":["LOCAL_NAMESPACE","REMOTE_NAMESPACE","REMOTE_MODULE","REMOTE_MODULE2","SettingUpSchemasForModuleDistributionTest","namePascal","remoteModule","count","nameCamel","namesUtil","toCamel","promise","Action","execute","nameReadable","moduleToImportFromWhenRemote","wait","ui","isWaitingForInput","sendInput","versionUtil","generateVersion","constValue","results","assert","isFalsy","errors","builderFile","testUtil","assertFileByNameInGeneratedFiles","files","Service","importDefault","builder","isEqual","schemaFile","schema","id","templateItems","generateTemplateItems","templateItem","importFrom","isFalse","schemaNames","expectedModules","shouldConfirmInstall","reInstallSkill","Store","setCurrentSkillsNamespace","schemas","map","name","getEmitter","on","SyncAction","waitForInput","secondToLast","invocations","length","options","headline","expected","doesInclude","lines","pkg","isTrue","isInstalled","isTruthy","errorAssertUtil","assertError","push","shouldInstallMissingDependencies","assertCalendarEventSchemaIsImported","doesThrow","importsWhenRemote","mySchema","fields","calendarEvent","type","schema1","namespace","version","localSchemaFile","localSchema","isEqualDeep","assertValidTypesFile","importGeneratedFile","completedFormBuilder","isRequired","personId","values","isArray","valueType","builderForm","dateDeleted","schemaId","itemBuilder","SchemaTemplateItemBuilder","buildTemplateItems","TestSkill","find","r","schemaIds","optionOverrides","fileName","imported","calendarEventContents","diskUtil","readFile","trim","builder1","nestedSchema","firstName","resolveHashSprucePath","schemaTypesFile","typesContent","writeFile","check","AbstractSkillTest"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;AAEA,IAAMA,eAAe,GAAG,gBAAxB;AACA,IAAMC,gBAAgB,GAAG,eAAzB;AAEA,IAAMC,aAAa,GAAG,mCAAtB;AACA,IAAMC,cAAc,GAAG,8BAAvB;IAEqBC,yC,WAQnB,gBACA,0CADA,EAEA,eAFA,EAGAF,aAHA,EAIA,GAJA,C,UAMA,gBACA,0CADA,EAEA,gBAFA,EAGAC,cAHA,EAIA,GAJA,C,UAsDA,iB,UAaA,iB,UAYA,gBACA,oDADA,EAEA,CAAC,SAAD,CAFA,EAGA,CAACD,aAAD,CAHA,EAIA,KAJA,C,UAMA,gBACA,gDADA,EAEA,CAAC,SAAD,CAFA,EAGA,CAACA,aAAD,CAHA,EAIA,IAJA,C,UAMA,gBACA,gDADA,EAEA,CAAC,SAAD,EAA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AAA;AACO2F,gBAAAA,eADP,GACyBtF,kBAASC,gCAAT,CACvB,kBADuB,EAEvBN,OAAO,CAACO,KAFe,CADzB;AAMOqF,gBAAAA,YANP,qBAMiCjH,aANjC,kBAMsDyG,2BAASC,QAAT,CACpDM,eADoD,CANtD;;AASCP,2CAASS,SAAT,CAAmBF,eAAnB,EAAoCC,YAApC;;AATD;AAAA,uBAWO,KAAKpF,OAAL,CAAa,aAAb,EAA4BsF,KAA5B,CAAkCH,eAAlC,CAXP;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EA5ZsEI,8B,8DACrC,S","sourcesContent":["import { Schema, SchemaTemplateItem } from '@sprucelabs/schema'\nimport {\n\tdiskUtil,\n\tnamesUtil,\n\tversionUtil,\n} from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport { FeatureActionResponse } from '../../features/features.types'\nimport SchemaTemplateItemBuilder from '../../templateItemBuilders/SchemaTemplateItemBuilder'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\nimport testUtil from '../../tests/utilities/test.utility'\n\nconst LOCAL_NAMESPACE = 'TestingSchemas'\nconst REMOTE_NAMESPACE = 'RemoteSchemas'\n\nconst REMOTE_MODULE = '@sprucelabs/spruce-calendar-utils'\nconst REMOTE_MODULE2 = '@sprucelabs/spruce-templates'\n\nexport default class SettingUpSchemasForModuleDistributionTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'schemas'\n\tprivate static builder1: Schema\n\tprivate static schema1: Schema\n\t//@ts-ignore\n\tprivate static schema1b: Schema\n\tprivate static schema2: Schema\n\n\t@test(\n\t\t'can specify importFromModuleWhenRemote 1',\n\t\t'CalendarEvent',\n\t\tREMOTE_MODULE,\n\t\t'1'\n\t)\n\t@test(\n\t\t'can specify importFromModuleWhenRemote 2',\n\t\t'CalendarEvent2',\n\t\tREMOTE_MODULE2,\n\t\t'2'\n\t)\n\tprotected static async canSpecifyModuleToImportFromWhenRemote(\n\t\tnamePascal: string,\n\t\tremoteModule: string,\n\t\tcount: '1' | '2'\n\t) {\n\t\tconst nameCamel = namesUtil.toCamel(namePascal)\n\t\tconst promise = this.Action('schema', 'create').execute({\n\t\t\tnameReadable: 'Schema imported as module',\n\t\t\tnamePascal,\n\t\t\tnameCamel,\n\t\t\tmoduleToImportFromWhenRemote: remoteModule,\n\t\t})\n\n\t\tawait this.wait(10)\n\n\t\tif (this.ui.isWaitingForInput()) {\n\t\t\tawait this.ui.sendInput(versionUtil.generateVersion().constValue)\n\t\t}\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst builderFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${nameCamel}.builder.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tconst builder = await this.Service('import').importDefault(builderFile)\n\t\tassert.isEqual(builder.moduleToImportFromWhenRemote, remoteModule)\n\n\t\t//@ts-ignore\n\t\tthis[`builder${count}`] = builder\n\n\t\tconst schemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${nameCamel}.schema.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tconst schema = await this.Service('import').importDefault(schemaFile)\n\t\tassert.isEqual(schema.moduleToImportFromWhenRemote, remoteModule)\n\n\t\t//@ts-ignore\n\t\tthis[`schema${count}`] = schema\n\t\t//@ts-ignore\n\t\tthis[`schema${count}b`] = { ...schema, id: `schema${count}B` }\n\t}\n\n\t@test()\n\tprotected static async templateItemGeneratorHonorsModuleToImportWhenRemoteWhenInRemoteNamespace() {\n\t\tconst templateItems = this.generateTemplateItems(REMOTE_NAMESPACE)\n\n\t\tfor (const templateItem of templateItems) {\n\t\t\tassert.isEqual(\n\t\t\t\ttemplateItem.schema.moduleToImportFromWhenRemote,\n\t\t\t\tREMOTE_MODULE\n\t\t\t)\n\t\t\tassert.isEqual(templateItem.importFrom, REMOTE_MODULE)\n\t\t}\n\t}\n\n\t@test()\n\tprotected static async moduleToImportWhenRemoteIgnoredWhenInSameNamespace() {\n\t\tconst templateItems = this.generateTemplateItems(LOCAL_NAMESPACE)\n\t\tfor (const templateItem of templateItems) {\n\t\t\tassert.isEqual(\n\t\t\t\ttemplateItem.schema.moduleToImportFromWhenRemote,\n\t\t\t\tREMOTE_MODULE\n\t\t\t)\n\t\t\tassert.isFalse('importFrom' in templateItem)\n\t\t}\n\t}\n\n\t@test(\n\t\t'should ask about missing module and cancel install',\n\t\t['schema1'],\n\t\t[REMOTE_MODULE],\n\t\tfalse\n\t)\n\t@test(\n\t\t'should ask about missing module and do install',\n\t\t['schema1'],\n\t\t[REMOTE_MODULE],\n\t\ttrue\n\t)\n\t@test(\n\t\t'should ask about missing module and do install',\n\t\t['schema1', 'schema2'],\n\t\t[REMOTE_MODULE, REMOTE_MODULE2],\n\t\ttrue\n\t)\n\t@test(\n\t\t'does not return the same module twice',\n\t\t['schema1', 'schema1b', 'schema2'],\n\t\t[REMOTE_MODULE, REMOTE_MODULE2],\n\t\ttrue\n\t)\n\tprotected static async asksIfModuleShouldBeInstalled(\n\t\tschemaNames: ('schema1' | 'schema2')[],\n\t\texpectedModules: string[],\n\t\tshouldConfirmInstall: boolean\n\t) {\n\t\tawait this.reInstallSkill()\n\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst schemas = schemaNames.map((name) => this[name])\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas,\n\t\t\t}\n\t\t})\n\n\t\tconst promise = this.SyncAction().execute({})\n\n\t\tawait this.waitForInput()\n\n\t\tconst secondToLast = this.ui.invocations[this.ui.invocations.length - 2]\n\n\t\tassert.isEqual(\n\t\t\tsecondToLast.options.headline,\n\t\t\t`Missing ${expectedModules.length} module${\n\t\t\t\texpectedModules.length === 1 ? '' : 's'\n\t\t\t}`\n\t\t)\n\n\t\tfor (const expected of expectedModules) {\n\t\t\tassert.doesInclude(secondToLast.options.lines, expected)\n\t\t}\n\n\t\tawait this.ui.sendInput(shouldConfirmInstall ? 'y' : 'n')\n\n\t\tconst results = await promise\n\n\t\tif (shouldConfirmInstall) {\n\t\t\tassert.isFalsy(results.errors)\n\t\t\tconst pkg = this.Service('pkg')\n\t\t\tfor (const expected of expectedModules) {\n\t\t\t\tassert.isTrue(pkg.isInstalled(expected))\n\t\t\t}\n\t\t} else {\n\t\t\tassert.isTruthy(results.errors)\n\t\t\terrorAssertUtil.assertError(results.errors[0], 'ACTION_CANCELLED')\n\t\t}\n\t}\n\n\t@test('schemas are imported from one module', ['schema1'])\n\t@test('schemas are imported from two modules', ['schema1', 'schema2'])\n\tprotected static async schemasAreImportedFromModuleWhenSyncedFormDifferentNamespace(\n\t\tschemaNames: ('schema1' | 'schema2')[]\n\t) {\n\t\tawait this.reInstallSkill()\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst schemas: Schema[] = []\n\n\t\tfor (const name of schemaNames) {\n\t\t\tschemas.push(this[name])\n\t\t}\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas,\n\t\t\t}\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tshouldInstallMissingDependencies: true,\n\t\t})\n\n\t\tawait this.assertCalendarEventSchemaIsImported(results)\n\t\tassert.doesThrow(() =>\n\t\t\ttestUtil.assertFileByNameInGeneratedFiles(\n\t\t\t\t'schemas.types.ts',\n\t\t\t\tresults.files\n\t\t\t)\n\t\t)\n\t}\n\n\t@test('can reference impored from another module', [\n\t\t`import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'`,\n\t])\n\t@test('can reference impored from another module with two importsWhenLocal', [\n\t\t`import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'`,\n\t\t`import * as HeartwoodTypesLocal2 from '@sprucelabs/heartwood-view-controllers'`,\n\t])\n\tprotected static async canReferenceSchemaImportedFromAnotherModule(\n\t\timportsWhenRemote: string[]\n\t) {\n\t\tawait this.reInstallSkill()\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst mySchema = {\n\t\t\tid: 'localSchema',\n\t\t\timportsWhenRemote,\n\t\t\tfields: {\n\t\t\t\tcalendarEvent: {\n\t\t\t\t\ttype: 'schema',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t...this.schema1,\n\t\t\t\t\t\t\tnamespace: 'CalendarUtils',\n\t\t\t\t\t\t\tversion: 'v2021_05_19',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas: [mySchema],\n\t\t\t}\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tshouldInstallMissingDependencies: true,\n\t\t})\n\n\t\tconst localSchemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'localSchema.schema.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst localSchema = await this.Service('import').importDefault(\n\t\t\tlocalSchemaFile\n\t\t)\n\n\t\tassert.isEqualDeep(localSchema.importsWhenRemote, importsWhenRemote)\n\n\t\tawait this.assertCalendarEventSchemaIsImported(results)\n\t\tawait this.assertValidTypesFile(results)\n\t}\n\n\t@test()\n\tprotected static async canSetImportFromModuleWithNestedSchemasWhenRemoteWhenSyncing() {\n\t\tawait this.reInstallSkill()\n\n\t\tawait this.Action('schema', 'create').execute({\n\t\t\tnameReadable: 'Schema imported as module',\n\t\t\tnamePascal: 'CalandarEvent',\n\t\t\tnameCamel: 'calendarEvent',\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tmoduleToImportFromWhenRemote: REMOTE_MODULE,\n\t\t})\n\n\t\tthis.schema1 = (await this.importGeneratedFile(\n\t\t\tresults,\n\t\t\t`calendarEvent.schema.ts`\n\t\t)) as Schema\n\n\t\tassert.isEqual(this.schema1.moduleToImportFromWhenRemote, REMOTE_MODULE)\n\t}\n\n\t@test()\n\tprotected static async canHandleFormBuilderImportExportObject() {\n\t\tconst version = versionUtil.generateVersion().constValue\n\n\t\tconst completedFormBuilder = {\n\t\t\tid: 'fullCompletedForm',\n\t\t\tversion,\n\t\t\tmoduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tpersonId: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tvalues: {\n\t\t\t\t\ttype: 'raw',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tvalueType: 'Record<string, any>',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tconst builderForm = {\n\t\t\tid: 'builtForm',\n\t\t\tversion,\n\t\t\tmoduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tdateDeleted: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\tcompletedFormBuilder: {\n\t\t\t\t\ttype: 'schema',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tschemaId: {\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\tid: 'fullCompletedForm',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tconst itemBuilder = new SchemaTemplateItemBuilder('TestSkill')\n\n\t\tconst results = itemBuilder.buildTemplateItems({\n\t\t\t//@ts-ignore\n\t\t\tTestSkill: [completedFormBuilder, builderForm],\n\t\t})\n\n\t\tassert.isFalsy(\n\t\t\t(\n\t\t\t\tresults.find((r) => r.id === 'builtForm')?.schema.fields\n\t\t\t\t\t?.completedFormBuilder?.options as any\n\t\t\t)?.schemaIds?.[0]?.moduleToImportFromWhenRemote\n\t\t)\n\t}\n\n\tprivate static SyncAction() {\n\t\treturn this.Action('schema', 'sync', {\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {},\n\t\t\t},\n\t\t})\n\t}\n\n\tprivate static async importGeneratedFile(\n\t\tresults: FeatureActionResponse,\n\t\tfileName: string\n\t) {\n\t\tconst schemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\tfileName,\n\t\t\tresults.files\n\t\t)\n\n\t\treturn await this.Service('import').importDefault(schemaFile)\n\t}\n\n\tprivate static async assertCalendarEventSchemaIsImported(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst imported = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'calendarEvent.schema.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst calendarEventContents = diskUtil.readFile(imported)\n\n\t\tassert.isEqual(\n\t\t\tcalendarEventContents.trim(),\n\t\t\t`export { calendarEventSchema as default } from '@sprucelabs/spruce-calendar-utils'`\n\t\t)\n\t}\n\n\tprivate static generateTemplateItems(namespace: string) {\n\t\tconst itemBuilder = new SchemaTemplateItemBuilder(namespace)\n\t\tconst templateItems = itemBuilder.buildTemplateItems(\n\t\t\t{\n\t\t\t\t[LOCAL_NAMESPACE]: [\n\t\t\t\t\t{\n\t\t\t\t\t\t...this.builder1,\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t...this.builder1.fields,\n\t\t\t\t\t\t\tnestedSchema: {\n\t\t\t\t\t\t\t\ttype: 'schema',\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t\tid: 'nested',\n\t\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\t\tfirstName: {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\tthis.resolveHashSprucePath('schemas')\n\t\t)\n\t\treturn templateItems as SchemaTemplateItem[]\n\t}\n\n\tprivate static async assertValidTypesFile(results: FeatureActionResponse) {\n\t\tconst schemaTypesFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'schemas.types.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst typesContent = `import '${REMOTE_MODULE}'\\n\\n${diskUtil.readFile(\n\t\t\tschemaTypesFile\n\t\t)}`\n\t\tdiskUtil.writeFile(schemaTypesFile, typesContent)\n\n\t\tawait this.Service('typeChecker').check(schemaTypesFile)\n\t}\n}\n"],"file":"SettingUpSchemasForModuleDistribution.test.js"}
|
|
1
|
+
{"version":3,"sources":["../../../src/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.ts"],"names":["LOCAL_NAMESPACE","REMOTE_NAMESPACE","REMOTE_MODULE","REMOTE_MODULE2","SettingUpSchemasForModuleDistributionTest","namePascal","remoteModule","count","nameCamel","namesUtil","toCamel","promise","Action","execute","nameReadable","moduleToImportFromWhenRemote","wait","ui","isWaitingForInput","sendInput","versionUtil","generateVersion","constValue","results","assert","isFalsy","errors","builderFile","testUtil","assertFileByNameInGeneratedFiles","files","Service","importDefault","builder","isEqual","schemaFile","schema","id","templateItems","generateTemplateItems","templateItem","importFrom","isFalse","schemaNames","expectedModules","shouldConfirmInstall","reInstallSkill","Store","setCurrentSkillsNamespace","schemas","map","name","getEmitter","on","SyncAction","waitForInput","secondToLast","invocations","length","options","headline","expected","doesInclude","lines","pkg","isTrue","isInstalled","isTruthy","errorAssertUtil","assertError","push","shouldInstallMissingDependencies","assertCalendarEventSchemaIsImported","doesThrow","importsWhenRemote","mySchema","fields","calendarEvent","type","schema1","namespace","version","localSchemaFile","localSchema","isEqualDeep","assertValidTypesFileWhenAddingRemoteImport","importGeneratedFile","completedFormBuilder","isRequired","personId","values","isArray","valueType","builderForm","dateDeleted","schemaId","itemBuilder","SchemaTemplateItemBuilder","buildTemplateItems","TestSkill","find","r","schemaIds","dirValue","schema2","schemaTypesFile","check","optionOverrides","fileName","imported","calendarEventContents","diskUtil","readFile","trim","builder1","nestedSchema","firstName","resolveHashSprucePath","typesContent","writeFile","AbstractSkillTest","fieldName1","label","fieldName2","hint"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AACA;;AAKA;;AACA;;AAEA;;AACA;;AACA;;;;;;;;;;;;;;;;;;AAEA,IAAMA,eAAe,GAAG,gBAAxB;AACA,IAAMC,gBAAgB,GAAG,eAAzB;AAEA,IAAMC,aAAa,GAAG,mCAAtB;AACA,IAAMC,cAAc,GAAG,8BAAvB;IAEqBC,yC,WAsCnB,gBACA,0CADA,EAEA,eAFA,EAGAF,aAHA,EAIA,GAJA,C,UAMA,gBACA,0CADA,EAEA,gBAFA,EAGAC,cAHA,EAIA,GAJA,C,UAsDA,iB,UAaA,iB,UAYA,gBACA,oDADA,EAEA,CAAC,SAAD,CAFA,EAGA,CAACD,aAAD,CAHA,EAIA,KAJA,C,UAMA,gBACA,gDADA,EAEA,CAAC,SAAD,CAFA,EAGA,CAACA,aAAD,CAHA,EAIA,IAJA,C,UAMA,gBACA,gDADA,EAEA,CAAC,SAAD,EAAY,SAAZ,CAFA,EAGA,CAACA,aAAD,EAAgBC,cAAhB,CAHA,EAIA,IAJA,C,UAMA,gBACA,uCADA,EAEA,CAAC,SAAD,EAAY,UAAZ,EAAwB,SAAxB,CAFA,EAGA,CAACD,aAAD,EAAgBC,cAAhB,CAHA,EAIA,IAJA,C,UAwDA,gBAAK,sCAAL,EAA6C,CAAC,SAAD,CAA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IAAI,EAAE,MAA9B;AAAsCU,MAAAA,UAAU,EAAE;AAAlD,KADL;AAEPmC,IAAAA,UAAU,EAAE;AACXD,MAAAA,KAAK,EAAE,cADI;AAEX5C,MAAAA,IAAI,EAAE,QAFK;AAGXU,MAAAA,UAAU,EAAE,IAHD;AAIXoC,MAAAA,IAAI,EAAE;AAJK;AAFL;AANwB,C,uHAkBA;AAChCvF,EAAAA,EAAE,EAAE,gBAD4B;AAEhC4C,EAAAA,OAAO,EAAE,aAFuB;AAGhCD,EAAAA,SAAS,EAAE,gBAHqB;AAIhC7B,EAAAA,IAAI,EAAE,2BAJ0B;AAKhCpC,EAAAA,4BAA4B,EAAE,8BALE;AAMhC6D,EAAAA,MAAM,EAAE;AACP6C,IAAAA,UAAU,EAAE;AAAEC,MAAAA,KAAK,EAAE,aAAT;AAAwB5C,MAAAA,IAAI,EAAE,MAA9B;AAAsCU,MAAAA,UAAU,EAAE;AAAlD,KADL;AAEPmC,IAAAA,UAAU,EAAE;AACXD,MAAAA,KAAK,EAAE,cADI;AAEX5C,MAAAA,IAAI,EAAE,QAFK;AAGXU,MAAAA,UAAU,EAAE,IAHD;AAIXoC,MAAAA,IAAI,EAAE;AAJK;AAFL;AANwB,C","sourcesContent":["import { Schema, SchemaTemplateItem } from '@sprucelabs/schema'\nimport {\n\tdiskUtil,\n\tnamesUtil,\n\tversionUtil,\n} from '@sprucelabs/spruce-skill-utils'\nimport { test, assert } from '@sprucelabs/test'\nimport { errorAssertUtil } from '@sprucelabs/test-utils'\nimport { FeatureActionResponse } from '../../features/features.types'\nimport SchemaTemplateItemBuilder from '../../templateItemBuilders/SchemaTemplateItemBuilder'\nimport AbstractSkillTest from '../../tests/AbstractSkillTest'\nimport testUtil from '../../tests/utilities/test.utility'\n\nconst LOCAL_NAMESPACE = 'TestingSchemas'\nconst REMOTE_NAMESPACE = 'RemoteSchemas'\n\nconst REMOTE_MODULE = '@sprucelabs/spruce-calendar-utils'\nconst REMOTE_MODULE2 = '@sprucelabs/spruce-templates'\n\nexport default class SettingUpSchemasForModuleDistributionTest extends AbstractSkillTest {\n\tprotected static skillCacheKey = 'schemas'\n\tprivate static builder1: Schema\n\tprivate static schema1: Schema = {\n\t\tid: 'calendarEvent',\n\t\tversion: 'v2021_09_20',\n\t\tnamespace: 'TestingSchemas',\n\t\tname: 'Schema imported as module',\n\t\tmoduleToImportFromWhenRemote: '@sprucelabs/spruce-calendar-utils',\n\t\tfields: {\n\t\t\tfieldName1: { label: 'First Field', type: 'text', isRequired: true },\n\t\t\tfieldName2: {\n\t\t\t\tlabel: 'Second Field',\n\t\t\t\ttype: 'number',\n\t\t\t\tisRequired: true,\n\t\t\t\thint: 'A hint',\n\t\t\t},\n\t\t},\n\t}\n\t//@ts-ignore\n\tprivate static schema1b: Schema\n\tprivate static schema2: Schema = {\n\t\tid: 'calendarEvent2',\n\t\tversion: 'v2021_09_20',\n\t\tnamespace: 'TestingSchemas',\n\t\tname: 'Schema imported as module',\n\t\tmoduleToImportFromWhenRemote: '@sprucelabs/spruce-templates',\n\t\tfields: {\n\t\t\tfieldName1: { label: 'First Field', type: 'text', isRequired: true },\n\t\t\tfieldName2: {\n\t\t\t\tlabel: 'Second Field',\n\t\t\t\ttype: 'number',\n\t\t\t\tisRequired: true,\n\t\t\t\thint: 'A hint',\n\t\t\t},\n\t\t},\n\t}\n\n\t@test(\n\t\t'can specify importFromModuleWhenRemote 1',\n\t\t'CalendarEvent',\n\t\tREMOTE_MODULE,\n\t\t'1'\n\t)\n\t@test(\n\t\t'can specify importFromModuleWhenRemote 2',\n\t\t'CalendarEvent2',\n\t\tREMOTE_MODULE2,\n\t\t'2'\n\t)\n\tprotected static async canSpecifyModuleToImportFromWhenRemote(\n\t\tnamePascal: string,\n\t\tremoteModule: string,\n\t\tcount: '1' | '2'\n\t) {\n\t\tconst nameCamel = namesUtil.toCamel(namePascal)\n\t\tconst promise = this.Action('schema', 'create').execute({\n\t\t\tnameReadable: 'Schema imported as module',\n\t\t\tnamePascal,\n\t\t\tnameCamel,\n\t\t\tmoduleToImportFromWhenRemote: remoteModule,\n\t\t})\n\n\t\tawait this.wait(10)\n\n\t\tif (this.ui.isWaitingForInput()) {\n\t\t\tawait this.ui.sendInput(versionUtil.generateVersion().constValue)\n\t\t}\n\n\t\tconst results = await promise\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst builderFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${nameCamel}.builder.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tconst builder = await this.Service('import').importDefault(builderFile)\n\t\tassert.isEqual(builder.moduleToImportFromWhenRemote, remoteModule)\n\n\t\t//@ts-ignore\n\t\tthis[`builder${count}`] = builder\n\n\t\tconst schemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t`${nameCamel}.schema.ts`,\n\t\t\tresults.files\n\t\t)\n\n\t\tconst schema = await this.Service('import').importDefault(schemaFile)\n\t\tassert.isEqual(schema.moduleToImportFromWhenRemote, remoteModule)\n\n\t\t//@ts-ignore\n\t\tthis[`schema${count}`] = schema\n\t\t//@ts-ignore\n\t\tthis[`schema${count}b`] = { ...schema, id: `schema${count}B` }\n\t}\n\n\t@test()\n\tprotected static async templateItemGeneratorHonorsModuleToImportWhenRemoteWhenInRemoteNamespace() {\n\t\tconst templateItems = this.generateTemplateItems(REMOTE_NAMESPACE)\n\n\t\tfor (const templateItem of templateItems) {\n\t\t\tassert.isEqual(\n\t\t\t\ttemplateItem.schema.moduleToImportFromWhenRemote,\n\t\t\t\tREMOTE_MODULE\n\t\t\t)\n\t\t\tassert.isEqual(templateItem.importFrom, REMOTE_MODULE)\n\t\t}\n\t}\n\n\t@test()\n\tprotected static async moduleToImportWhenRemoteIgnoredWhenInSameNamespace() {\n\t\tconst templateItems = this.generateTemplateItems(LOCAL_NAMESPACE)\n\t\tfor (const templateItem of templateItems) {\n\t\t\tassert.isEqual(\n\t\t\t\ttemplateItem.schema.moduleToImportFromWhenRemote,\n\t\t\t\tREMOTE_MODULE\n\t\t\t)\n\t\t\tassert.isFalse('importFrom' in templateItem)\n\t\t}\n\t}\n\n\t@test(\n\t\t'should ask about missing module and cancel install',\n\t\t['schema1'],\n\t\t[REMOTE_MODULE],\n\t\tfalse\n\t)\n\t@test(\n\t\t'should ask about missing module and do install',\n\t\t['schema1'],\n\t\t[REMOTE_MODULE],\n\t\ttrue\n\t)\n\t@test(\n\t\t'should ask about missing module and do install',\n\t\t['schema1', 'schema2'],\n\t\t[REMOTE_MODULE, REMOTE_MODULE2],\n\t\ttrue\n\t)\n\t@test(\n\t\t'does not return the same module twice',\n\t\t['schema1', 'schema1b', 'schema2'],\n\t\t[REMOTE_MODULE, REMOTE_MODULE2],\n\t\ttrue\n\t)\n\tprotected static async asksIfModuleShouldBeInstalled(\n\t\tschemaNames: ('schema1' | 'schema2')[],\n\t\texpectedModules: string[],\n\t\tshouldConfirmInstall: boolean\n\t) {\n\t\tawait this.reInstallSkill()\n\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst schemas = schemaNames.map((name) => this[name])\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas,\n\t\t\t}\n\t\t})\n\n\t\tconst promise = this.SyncAction().execute({})\n\n\t\tawait this.waitForInput()\n\n\t\tconst secondToLast = this.ui.invocations[this.ui.invocations.length - 2]\n\n\t\tassert.isEqual(\n\t\t\tsecondToLast.options.headline,\n\t\t\t`Missing ${expectedModules.length} module${\n\t\t\t\texpectedModules.length === 1 ? '' : 's'\n\t\t\t}`\n\t\t)\n\n\t\tfor (const expected of expectedModules) {\n\t\t\tassert.doesInclude(secondToLast.options.lines, expected)\n\t\t}\n\n\t\tawait this.ui.sendInput(shouldConfirmInstall ? 'y' : 'n')\n\n\t\tconst results = await promise\n\n\t\tif (shouldConfirmInstall) {\n\t\t\tassert.isFalsy(results.errors)\n\t\t\tconst pkg = this.Service('pkg')\n\t\t\tfor (const expected of expectedModules) {\n\t\t\t\tassert.isTrue(pkg.isInstalled(expected))\n\t\t\t}\n\t\t} else {\n\t\t\tassert.isTruthy(results.errors)\n\t\t\terrorAssertUtil.assertError(results.errors[0], 'ACTION_CANCELLED')\n\t\t}\n\t}\n\n\t@test('schemas are imported from one module', ['schema1'])\n\t@test('schemas are imported from two modules', ['schema1', 'schema2'])\n\tprotected static async schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace(\n\t\tschemaNames: ('schema1' | 'schema2')[]\n\t) {\n\t\tawait this.reInstallSkill()\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst schemas: Schema[] = []\n\n\t\tfor (const name of schemaNames) {\n\t\t\tschemas.push(this[name])\n\t\t}\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas,\n\t\t\t}\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tshouldInstallMissingDependencies: true,\n\t\t})\n\n\t\tawait this.assertCalendarEventSchemaIsImported(results)\n\n\t\tassert.doesThrow(() =>\n\t\t\ttestUtil.assertFileByNameInGeneratedFiles(\n\t\t\t\t'schemas.types.ts',\n\t\t\t\tresults.files\n\t\t\t)\n\t\t)\n\t}\n\n\t@test('can reference impored from another module', [\n\t\t`import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'`,\n\t])\n\t@test('can reference impored from another module with two importsWhenLocal', [\n\t\t`import * as HeartwoodTypesLocal from '@sprucelabs/heartwood-view-controllers'`,\n\t\t`import * as HeartwoodTypesLocal2 from '@sprucelabs/heartwood-view-controllers'`,\n\t])\n\tprotected static async canReferenceSchemaImportedFromAnotherModule(\n\t\timportsWhenRemote: string[]\n\t) {\n\t\tawait this.reInstallSkill()\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst mySchema = {\n\t\t\tid: 'localSchema',\n\t\t\timportsWhenRemote,\n\t\t\tfields: {\n\t\t\t\tcalendarEvent: {\n\t\t\t\t\ttype: 'schema',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t...this.schema1,\n\t\t\t\t\t\t\tnamespace: 'CalendarUtils',\n\t\t\t\t\t\t\tversion: 'v2021_05_19',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas: [mySchema],\n\t\t\t}\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tshouldInstallMissingDependencies: true,\n\t\t})\n\n\t\tconst localSchemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'localSchema.schema.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst localSchema = await this.Service('import').importDefault(\n\t\t\tlocalSchemaFile\n\t\t)\n\n\t\tassert.isEqualDeep(localSchema.importsWhenRemote, importsWhenRemote)\n\n\t\tawait this.assertCalendarEventSchemaIsImported(results)\n\t\tawait this.assertValidTypesFileWhenAddingRemoteImport(results)\n\t}\n\n\t@test()\n\tprotected static async canSetImportFromModuleWithNestedSchemasWhenRemoteWhenSyncing() {\n\t\tawait this.reInstallSkill()\n\n\t\tawait this.Action('schema', 'create').execute({\n\t\t\tnameReadable: 'Schema imported as module',\n\t\t\tnamePascal: 'CalandarEvent',\n\t\t\tnameCamel: 'calendarEvent',\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tmoduleToImportFromWhenRemote: REMOTE_MODULE,\n\t\t})\n\n\t\tthis.schema1 = (await this.importGeneratedFile(\n\t\t\tresults,\n\t\t\t`calendarEvent.schema.ts`\n\t\t)) as Schema\n\n\t\tassert.isEqual(this.schema1.moduleToImportFromWhenRemote, REMOTE_MODULE)\n\t}\n\n\t@test()\n\tprotected static async canHandleFormBuilderImportExportObject() {\n\t\tconst version = versionUtil.generateVersion().constValue\n\n\t\tconst completedFormBuilder = {\n\t\t\tid: 'fullCompletedForm',\n\t\t\tversion,\n\t\t\tmoduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tpersonId: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tvalues: {\n\t\t\t\t\ttype: 'raw',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tvalueType: 'Record<string, any>',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tconst builderForm = {\n\t\t\tid: 'builtForm',\n\t\t\tversion,\n\t\t\tmoduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tdateDeleted: {\n\t\t\t\t\ttype: 'number',\n\t\t\t\t},\n\t\t\t\tcompletedFormBuilder: {\n\t\t\t\t\ttype: 'schema',\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tschemaId: {\n\t\t\t\t\t\t\tversion,\n\t\t\t\t\t\t\tid: 'fullCompletedForm',\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tconst itemBuilder = new SchemaTemplateItemBuilder('TestSkill')\n\n\t\tconst results = itemBuilder.buildTemplateItems({\n\t\t\t//@ts-ignore\n\t\t\tTestSkill: [completedFormBuilder, builderForm],\n\t\t})\n\n\t\tassert.isFalsy(\n\t\t\t(\n\t\t\t\tresults.find((r) => r.id === 'builtForm')?.schema.fields\n\t\t\t\t\t?.completedFormBuilder?.options as any\n\t\t\t)?.schemaIds?.[0]?.moduleToImportFromWhenRemote\n\t\t)\n\t}\n\n\t@test()\n\tprotected static async importedSchemasDoNotShowUpInSchemaTypes() {\n\t\t// await this.reInstallSkill()\n\t\tawait this.Store('skill').setCurrentSkillsNamespace('TestingTwo')\n\n\t\tconst schema1 = {\n\t\t\tid: 'fullCompletedForm',\n\t\t\tnamespace: 'Heartwood',\n\t\t\tversion: versionUtil.generateVersion().dirValue,\n\t\t\tmoduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',\n\t\t\timportsWhenRemote: ['import * from bananarama'],\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tpersonId: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tvalues: {\n\t\t\t\t\ttype: 'raw',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tvalueType: 'Record<string, any>',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tconst schema2 = {\n\t\t\tid: 'localCompleted',\n\t\t\tversion: versionUtil.generateVersion().dirValue,\n\t\t\tfields: {\n\t\t\t\tid: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tpersonId: {\n\t\t\t\t\ttype: 'id',\n\t\t\t\t\tisRequired: true,\n\t\t\t\t},\n\t\t\t\tvalues: {\n\t\t\t\t\ttype: 'raw',\n\t\t\t\t\tisArray: true,\n\t\t\t\t\toptions: {\n\t\t\t\t\t\tvalueType: 'Record<string, any>',\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t}\n\n\t\tawait this.getEmitter().on('schema.did-fetch-schemas', async () => {\n\t\t\treturn {\n\t\t\t\tschemas: [schema1, schema2],\n\t\t\t}\n\t\t})\n\n\t\tconst results = await this.SyncAction().execute({\n\t\t\tshouldInstallMissingDependencies: true,\n\t\t})\n\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst schemaTypesFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'schemas.types.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tawait this.Service('typeChecker').check(schemaTypesFile)\n\t}\n\n\tprivate static SyncAction() {\n\t\treturn this.Action('schema', 'sync', {\n\t\t\toptionOverrides: {\n\t\t\t\t'sync.schemas': {},\n\t\t\t},\n\t\t})\n\t}\n\n\tprivate static async importGeneratedFile(\n\t\tresults: FeatureActionResponse,\n\t\tfileName: string\n\t) {\n\t\tconst schemaFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\tfileName,\n\t\t\tresults.files\n\t\t)\n\n\t\treturn await this.Service('import').importDefault(schemaFile)\n\t}\n\n\tprivate static async assertCalendarEventSchemaIsImported(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tassert.isFalsy(results.errors)\n\n\t\tconst imported = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'calendarEvent.schema.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst calendarEventContents = diskUtil.readFile(imported)\n\n\t\tassert.isEqual(\n\t\t\tcalendarEventContents.trim(),\n\t\t\t`export { calendarEventSchema as default } from '@sprucelabs/spruce-calendar-utils'`\n\t\t)\n\t}\n\n\tprivate static generateTemplateItems(namespace: string) {\n\t\tconst itemBuilder = new SchemaTemplateItemBuilder(namespace)\n\t\tconst templateItems = itemBuilder.buildTemplateItems(\n\t\t\t{\n\t\t\t\t[LOCAL_NAMESPACE]: [\n\t\t\t\t\t{\n\t\t\t\t\t\t...this.builder1,\n\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t...this.builder1.fields,\n\t\t\t\t\t\t\tnestedSchema: {\n\t\t\t\t\t\t\t\ttype: 'schema',\n\t\t\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\t\t\tschema: {\n\t\t\t\t\t\t\t\t\t\tid: 'nested',\n\t\t\t\t\t\t\t\t\t\tfields: {\n\t\t\t\t\t\t\t\t\t\t\tfirstName: {\n\t\t\t\t\t\t\t\t\t\t\t\ttype: 'text',\n\t\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\tthis.resolveHashSprucePath('schemas')\n\t\t)\n\t\treturn templateItems as SchemaTemplateItem[]\n\t}\n\n\tprivate static async assertValidTypesFileWhenAddingRemoteImport(\n\t\tresults: FeatureActionResponse\n\t) {\n\t\tconst schemaTypesFile = testUtil.assertFileByNameInGeneratedFiles(\n\t\t\t'schemas.types.ts',\n\t\t\tresults.files\n\t\t)\n\n\t\tconst typesContent = `import '${REMOTE_MODULE}'\\n\\n${diskUtil.readFile(\n\t\t\tschemaTypesFile\n\t\t)}`\n\t\tdiskUtil.writeFile(schemaTypesFile, typesContent)\n\n\t\tawait this.Service('typeChecker').check(schemaTypesFile)\n\t}\n}\n"],"file":"SettingUpSchemasForModuleDistribution.test.js"}
|
|
@@ -75,7 +75,7 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
_this = _super.call.apply(_super, [this].concat(args));
|
|
78
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "commandAliases", ['set.remote']);
|
|
78
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "commandAliases", ['set.remote [remote]']);
|
|
79
79
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "optionsSchema", optionsSchema);
|
|
80
80
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "invocationMessage", 'Set remote... 🜒');
|
|
81
81
|
return _this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/event/actions/SetRemoteAction.ts"],"names":["optionsSchema","id","description","fields","remote","label","type","isRequired","options","choices","value","SyncAction","validateAndNormalizeOptions","r","Service","set","summaryLines","getHost","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;AAGA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,kBAD6B;AAEjCC,EAAAA,WAAW,EAAE,qDAFoB;AAGjCC,EAAAA,MAAM,EAAE;AACPC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,4BADA;AAEPC,MAAAA,IAAI,EAAE,QAFC;AAGPC,MAAAA,UAAU,EAAE,IAHL;AAIPC,MAAAA,OAAO,EAAE;AACRC,QAAAA,OAAO,EAAE,CACR;AACCC,UAAAA,KAAK,EAAE,OADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SADQ,EAKR;AACCK,UAAAA,KAAK,EAAE,WADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SALQ,EASR;AACCK,UAAAA,KAAK,EAAE,SADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SATQ,EAaR;AACCK,UAAAA,KAAK,EAAE,YADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SAbQ;AADD;AAJF;AADD;AAHyB,CAAZ,CAAtB;;IAmCqBM,U;;;;;;;;;;;;;;;uGACI,CAAC,
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/event/actions/SetRemoteAction.ts"],"names":["optionsSchema","id","description","fields","remote","label","type","isRequired","options","choices","value","SyncAction","validateAndNormalizeOptions","r","Service","set","summaryLines","getHost","AbstractAction"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;;;;;AAGA,IAAMA,aAAa,GAAG,yBAAY;AACjCC,EAAAA,EAAE,EAAE,kBAD6B;AAEjCC,EAAAA,WAAW,EAAE,qDAFoB;AAGjCC,EAAAA,MAAM,EAAE;AACPC,IAAAA,MAAM,EAAE;AACPC,MAAAA,KAAK,EAAE,4BADA;AAEPC,MAAAA,IAAI,EAAE,QAFC;AAGPC,MAAAA,UAAU,EAAE,IAHL;AAIPC,MAAAA,OAAO,EAAE;AACRC,QAAAA,OAAO,EAAE,CACR;AACCC,UAAAA,KAAK,EAAE,OADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SADQ,EAKR;AACCK,UAAAA,KAAK,EAAE,WADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SALQ,EASR;AACCK,UAAAA,KAAK,EAAE,SADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SATQ,EAaR;AACCK,UAAAA,KAAK,EAAE,YADR;AAECL,UAAAA,KAAK,EAAE;AAFR,SAbQ;AADD;AAJF;AADD;AAHyB,CAAZ,CAAtB;;IAmCqBM,U;;;;;;;;;;;;;;;uGACI,CAAC,qBAAD,C;sGACcX,a;0GACX,kB;;;;;;;mGAE3B,iBAAqBQ,OAArB;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA,wCACoB,KAAKI,2BAAL,CAAiCJ,OAAjC,CADpB,EACSJ,MADT,yBACSA,MADT;AAGOS,gBAAAA,CAHP,GAGW,KAAKC,OAAL,CAAa,QAAb,CAHX;AAICD,gBAAAA,CAAC,CAACE,GAAF,CAAMX,MAAN;AAJD,iDAMQ;AACNY,kBAAAA,YAAY,EAAE,mBAAYZ,MAAZ,mBAA+BS,CAAC,CAACI,OAAF,EAA/B;AADR,iBANR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;EALuCC,2B","sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport { Remote } from '@sprucelabs/spruce-event-utils'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'setRemoteOptions',\n\tdescription: 'Point your skill to different Mercury environments.',\n\tfields: {\n\t\tremote: {\n\t\t\tlabel: 'Where should remote point?',\n\t\t\ttype: 'select',\n\t\t\tisRequired: true,\n\t\t\toptions: {\n\t\t\t\tchoices: [\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: 'local',\n\t\t\t\t\t\tlabel: 'Local',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: 'developer',\n\t\t\t\t\t\tlabel: 'Development',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: 'sandbox',\n\t\t\t\t\t\tlabel: 'Sandbox',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tvalue: 'production',\n\t\t\t\t\t\tlabel: 'Production',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t},\n\t},\n})\n\ntype OptionsSchema = typeof optionsSchema\ntype Options = SchemaValues<OptionsSchema>\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic commandAliases = ['set.remote [remote]']\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic invocationMessage = 'Set remote... 🜒'\n\n\tpublic async execute(options: Options): Promise<FeatureActionResponse> {\n\t\tconst { remote } = this.validateAndNormalizeOptions(options)\n\n\t\tconst r = this.Service('remote')\n\t\tr.set(remote as Remote)\n\n\t\treturn {\n\t\t\tsummaryLines: [`Remote: ${remote}`, `Host: ${r.getHost()}`],\n\t\t}\n\t}\n}\n"],"file":"SetRemoteAction.js"}
|
|
@@ -215,7 +215,7 @@ var SchemaWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
|
215
215
|
var _writeSchemasAndTypes = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee3(destinationDirOrFilename, options) {
|
|
216
216
|
var _results;
|
|
217
217
|
|
|
218
|
-
var fieldTemplateItems, schemaTemplateItems, valueTypes, typesTemplate, resolvedTypesDestination, results,
|
|
218
|
+
var fieldTemplateItems, schemaTemplateItems, valueTypes, typesTemplate, resolvedTypesDestination, results, localItems, schemaTypesContents, allSchemaResults;
|
|
219
219
|
return _regenerator["default"].wrap(function _callee3$(_context3) {
|
|
220
220
|
while (1) {
|
|
221
221
|
switch (_context3.prev = _context3.next) {
|
|
@@ -224,17 +224,17 @@ var SchemaWriter = /*#__PURE__*/function (_AbstractWriter) {
|
|
|
224
224
|
resolvedTypesDestination = this.resolveFilenameWithFallback(destinationDirOrFilename, _spruceSkillUtils.DEFAULT_SCHEMA_TYPES_FILENAME);
|
|
225
225
|
results = [];
|
|
226
226
|
this.ui.startLoading('Generating schema types...');
|
|
227
|
-
|
|
227
|
+
localItems = schemaTemplateItems.filter(function (i) {
|
|
228
228
|
return !i.importFrom;
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
if (!
|
|
231
|
+
if (!(localItems.length > 0)) {
|
|
232
232
|
_context3.next = 12;
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
235
|
|
|
236
236
|
schemaTypesContents = this.templates.schemasTypes({
|
|
237
|
-
schemaTemplateItems:
|
|
237
|
+
schemaTemplateItems: localItems,
|
|
238
238
|
fieldTemplateItems: fieldTemplateItems,
|
|
239
239
|
valueTypes: valueTypes,
|
|
240
240
|
globalSchemaNamespace: options.globalSchemaNamespace,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/features/schema/writers/SchemaWriter.ts"],"names":["SchemaWriter","filename","templateFuncName","description","destinationDir","options","ui","startLoading","nameCamel","resolvedBuilderDestination","shouldEnableVersioning","pathUtil","resolve","versionUtil","resolveNewLatestPath","version","LATEST_HANDLEBARS","diskUtil","doesFileExist","SpruceError","code","schemaId","destination","builderContent","templates","schemaBuilder","writeFileIfChangedMixinResults","results","lint","fieldTemplateItems","fieldTemplates","fileAndFunc","resolvedDestination","path","join","contents","destinationDirOrFilename","schemaTemplateItems","valueTypes","typesTemplate","resolvedTypesDestination","resolveFilenameWithFallback","DEFAULT_SCHEMA_TYPES_FILENAME","firstMatchWithoutImportFrom","find","i","importFrom","schemaTypesContents","schemasTypes","globalSchemaNamespace","length","writeAllSchemas","dirname","typesFile","allSchemaResults","push","item","writeSchema","schemaResults","registerBuiltSchemas","schemaDiskUtil","resolvePath","schema","relative","undefined","replace","extname","schemaContents","schemaFile","shouldImportCoreSchemas","id","cwd","resolveHashSprucePath","pluginContents","schemaPlugin","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAUA;;AACA;;AACA;;;;;;;;;;;;;;;;;;IAiBqBA,Y;;;;;;;;;;;;;;;uGAKd,CACL;AACCC,MAAAA,QAAQ,EAAE,iBADX;AAECC,MAAAA,gBAAgB,EAAE,aAFnB;AAGCC,MAAAA,WAAW,EACV;AAJF,KADK,EAOL;AACCF,MAAAA,QAAQ,EAAE,kBADX;AAECC,MAAAA,gBAAgB,EAAE,eAFnB;AAGCC,MAAAA,WAAW,EACV;AAJF,KAPK,C;;;;;;;wGAeN,iBACCC,cADD,EAECC,OAFD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOC,qBAAKC,EAAL,CAAQC,YAAR,CAAqB,oBAArB;AAEMN,gBAAAA,QATP,aASqBI,OAAO,CAACG,SAT7B;AAWOC,gBAAAA,0BAXP,GAYEJ,OAAO,CAACK,sBAAR,KAAmC,KAAnC,GACGC,iBAASC,OAAT,CAAiBR,cAAjB,EAAiCH,QAAjC,CADH,GAEGY,8BAAYC,oBAAZ,CACAV,cADA,sBAEAC,OAAO,CAACU,OAFR,+DAEmBC,mCAFnB,EAGAf,QAHA,CAdL;;AAAA,qBAoBKgB,2BAASC,aAAT,CAAuBT,0BAAvB,CApBL;AAAA;AAAA;AAAA;;AAAA,sBAqBQ,IAAIU,uBAAJ,CAAgB;AACrBC,kBAAAA,IAAI,EAAE,eADe;AAErBC,kBAAAA,QAAQ,EAAEhB,OAAO,CAACG,SAFG;AAGrBc,kBAAAA,WAAW,EAAElB;AAHQ,iBAAhB,CArBR;;AAAA;AA4BOmB,gBAAAA,cA5BP,GA4BwB,KAAKC,SAAL,CAAeC,aAAf,CAA6BpB,OAA7B,CA5BxB;AAAA;AAAA,uBA8BuB,KAAKqB,8BAAL,CACrBjB,0BAD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a,QAFM,EAGN,wFAHM,CAXR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAkBA,qBAAmBoC,GAAnB,EAAgC;AAC/B,UAAMjD,WAAW,GAAGL,2BAASuD,qBAAT,CACnBD,GADmB,EAEnB,UAFmB,EAGnB,kBAHmB,CAApB;;AAMA,UAAME,cAAc,GAAG,KAAKjD,SAAL,CAAekD,YAAf,EAAvB;AAEA,UAAM/C,OAAO,GAAG,KAAKD,8BAAL,CACfJ,WADe,EAEfmD,cAFe,EAGf,sCAHe,CAAhB;AAMA,aAAO9C,OAAP;AACA;;;EAnQwCgD,2B","sourcesContent":["import path from 'path'\nimport pathUtil from 'path'\nimport { FieldTemplateItem, SchemaTemplateItem } from '@sprucelabs/schema'\nimport { versionUtil } from '@sprucelabs/spruce-skill-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tLATEST_HANDLEBARS,\n\tDEFAULT_SCHEMA_TYPES_FILENAME,\n} from '@sprucelabs/spruce-skill-utils'\nimport {\n\tSchemaBuilderTemplateItem,\n\tValueTypes,\n} from '@sprucelabs/spruce-templates'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractWriter, { WriteResults } from '../../../writers/AbstractWriter'\nimport schemaDiskUtil from '../utilities/schemaDisk.utility'\n\ninterface WriteFieldTypesOptions {\n\tfieldTemplateItems: FieldTemplateItem[]\n}\n\n// eslint-disable-next-line no-redeclare\nexport interface GenerateSchemaTypesOptions {\n\tfieldTemplateItems: FieldTemplateItem[]\n\tschemaTemplateItems: SchemaTemplateItem[]\n\tvalueTypes: ValueTypes\n\tglobalSchemaNamespace?: string\n\ttypesTemplate?: string\n\tregisterBuiltSchemas?: boolean\n\tshouldImportCoreSchemas: boolean\n}\n\nexport default class SchemaWriter extends AbstractWriter {\n\tprivate readonly fieldTemplates: {\n\t\tfilename: string\n\t\ttemplateFuncName: 'fieldsTypes' | 'fieldClassMap'\n\t\tdescription: string\n\t}[] = [\n\t\t{\n\t\t\tfilename: 'fields.types.ts',\n\t\t\ttemplateFuncName: 'fieldsTypes',\n\t\t\tdescription:\n\t\t\t\t'All the interfaces generated for every type of schema field (text, number, address, etc).',\n\t\t},\n\t\t{\n\t\t\tfilename: 'fieldClassMap.ts',\n\t\t\ttemplateFuncName: 'fieldClassMap',\n\t\t\tdescription:\n\t\t\t\t'An object that is injected into the FieldFactory and ensures 3rd party fields are integrated.',\n\t\t},\n\t]\n\n\tpublic async writeBuilder(\n\t\tdestinationDir: string,\n\t\toptions: SchemaBuilderTemplateItem & {\n\t\t\tshouldEnableVersioning?: boolean\n\t\t\tversion?: string\n\t\t}\n\t): Promise<WriteResults> {\n\t\tthis.ui.startLoading('Writing builder...')\n\n\t\tconst filename = `${options.nameCamel}.builder.ts`\n\n\t\tconst resolvedBuilderDestination =\n\t\t\toptions.shouldEnableVersioning === false\n\t\t\t\t? pathUtil.resolve(destinationDir, filename)\n\t\t\t\t: versionUtil.resolveNewLatestPath(\n\t\t\t\t\t\tdestinationDir,\n\t\t\t\t\t\toptions.version ?? LATEST_HANDLEBARS,\n\t\t\t\t\t\tfilename\n\t\t\t\t )\n\n\t\tif (diskUtil.doesFileExist(resolvedBuilderDestination)) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'SCHEMA_EXISTS',\n\t\t\t\tschemaId: options.nameCamel,\n\t\t\t\tdestination: destinationDir,\n\t\t\t})\n\t\t}\n\n\t\tconst builderContent = this.templates.schemaBuilder(options)\n\n\t\tconst results = await this.writeFileIfChangedMixinResults(\n\t\t\tresolvedBuilderDestination,\n\t\t\tbuilderContent,\n\t\t\t'The source of truth for building your schemas and their types. Run spruce sync.errors when you change this.'\n\t\t)\n\n\t\tawait this.lint(resolvedBuilderDestination)\n\n\t\treturn results\n\t}\n\n\tpublic async writeFieldTypes(\n\t\tdestinationDir: string,\n\t\toptions: WriteFieldTypesOptions\n\t): Promise<WriteResults> {\n\t\tthis.ui.startLoading('Checking schema field types...')\n\n\t\tconst { fieldTemplateItems } = options\n\n\t\tlet results: WriteResults = []\n\n\t\tfor (const fileAndFunc of this.fieldTemplates) {\n\t\t\tconst { filename, templateFuncName, description } = fileAndFunc\n\n\t\t\tconst resolvedDestination = path.join(destinationDir, 'fields', filename)\n\n\t\t\tconst contents = this.templates[templateFuncName]({\n\t\t\t\tfieldTemplateItems,\n\t\t\t})\n\n\t\t\tresults = await this.writeFileIfChangedMixinResults(\n\t\t\t\tresolvedDestination,\n\t\t\t\tcontents,\n\t\t\t\tdescription,\n\t\t\t\tresults\n\t\t\t)\n\t\t}\n\n\t\treturn results\n\t}\n\n\tpublic async writeSchemasAndTypes(\n\t\tdestinationDirOrFilename: string,\n\t\toptions: GenerateSchemaTypesOptions\n\t): Promise<WriteResults> {\n\t\tconst {\n\t\t\tfieldTemplateItems,\n\t\t\tschemaTemplateItems,\n\t\t\tvalueTypes,\n\t\t\ttypesTemplate,\n\t\t} = options\n\n\t\tconst resolvedTypesDestination = this.resolveFilenameWithFallback(\n\t\t\tdestinationDirOrFilename,\n\t\t\tDEFAULT_SCHEMA_TYPES_FILENAME\n\t\t)\n\n\t\tlet results: WriteResults = []\n\t\tthis.ui.startLoading('Generating schema types...')\n\n\t\tconst firstMatchWithoutImportFrom = schemaTemplateItems.find(\n\t\t\t(i) => !i.importFrom\n\t\t)\n\n\t\tif (firstMatchWithoutImportFrom) {\n\t\t\tconst schemaTypesContents = this.templates.schemasTypes({\n\t\t\t\tschemaTemplateItems,\n\t\t\t\tfieldTemplateItems,\n\t\t\t\tvalueTypes,\n\t\t\t\tglobalSchemaNamespace: options.globalSchemaNamespace,\n\t\t\t\ttypesTemplate,\n\t\t\t})\n\n\t\t\tresults = await this.writeFileIfChangedMixinResults(\n\t\t\t\tresolvedTypesDestination,\n\t\t\t\tschemaTypesContents,\n\t\t\t\t'Namespace for accessing all your schemas. Type `SpruceSchemas` in your IDE to get started. ⚡️'\n\t\t\t)\n\n\t\t\tawait this.lint(resolvedTypesDestination)\n\t\t}\n\n\t\tthis.ui.startLoading(\n\t\t\t`Checking ${schemaTemplateItems.length} schemas for changes...`\n\t\t)\n\n\t\tconst allSchemaResults = await this.writeAllSchemas(\n\t\t\tpathUtil.dirname(resolvedTypesDestination),\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\ttypesFile: resolvedTypesDestination,\n\t\t\t}\n\t\t)\n\n\t\tresults.push(...allSchemaResults)\n\n\t\treturn results\n\t}\n\n\tprivate async writeAllSchemas(\n\t\tdestinationDir: string,\n\t\toptions: GenerateSchemaTypesOptions & { typesFile?: string }\n\t): Promise<WriteResults> {\n\t\tconst results: WriteResults = []\n\n\t\tfor (const item of options.schemaTemplateItems) {\n\t\t\tconst schemaResults = await this.writeSchema(destinationDir, {\n\t\t\t\t...options,\n\t\t\t\t...item,\n\t\t\t})\n\t\t\tresults.push(...schemaResults)\n\t\t}\n\n\t\treturn results\n\t}\n\n\tpublic async writeSchema(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tschemaTemplateItems: SchemaTemplateItem[]\n\t\t\tfieldTemplateItems: FieldTemplateItem[]\n\t\t\tvalueTypes: ValueTypes\n\t\t\ttypesFile?: string\n\t\t\tregisterBuiltSchemas?: boolean\n\t\t\tshouldImportCoreSchemas: boolean\n\t\t} & SchemaTemplateItem\n\t) {\n\t\tconst {\n\t\t\tschemaTemplateItems,\n\t\t\tfieldTemplateItems,\n\t\t\tvalueTypes,\n\t\t\tregisterBuiltSchemas = true,\n\t\t\t...item\n\t\t} = options\n\n\t\tconst resolvedDestination = schemaDiskUtil.resolvePath({\n\t\t\tdestination: destinationDir,\n\t\t\tschema: options.schema,\n\t\t})\n\n\t\tlet typesFile = options.typesFile\n\t\t\t? pathUtil.relative(\n\t\t\t\t\tpathUtil.dirname(resolvedDestination),\n\t\t\t\t\toptions.typesFile\n\t\t\t )\n\t\t\t: undefined\n\n\t\tif (typesFile) {\n\t\t\ttypesFile = typesFile.replace(pathUtil.extname(typesFile), '')\n\t\t}\n\n\t\tconst schemaContents = this.templates.schema({\n\t\t\t...item,\n\t\t\tregisterBuiltSchemas,\n\t\t\tschemaTemplateItems,\n\t\t\tfieldTemplateItems,\n\t\t\tvalueTypes,\n\t\t\ttypesFile,\n\t\t\tschemaFile:\n\t\t\t\titem.importFrom && options.shouldImportCoreSchemas\n\t\t\t\t\t? `schema/imported.schema.ts.hbs`\n\t\t\t\t\t: undefined,\n\t\t})\n\n\t\treturn this.writeFileIfChangedMixinResults(\n\t\t\tresolvedDestination,\n\t\t\tschemaContents,\n\t\t\t`${\n\t\t\t\titem.schema.description ? `${item.schema.description} ` : ''\n\t\t\t}This is the schema generated by ${\n\t\t\t\titem.id\n\t\t\t}.builder.ts. AUTOGENERATED. DO NOT EDIT.`\n\t\t)\n\t}\n\n\tpublic async writeValueTypes(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tschemaTemplateItems: SchemaTemplateItem[]\n\t\t\tfieldTemplateItems: FieldTemplateItem[]\n\t\t\tglobalSchemaNamespace?: string\n\t\t}\n\t): Promise<WriteResults> {\n\t\tconst contents = this.templates.valueTypes(options)\n\t\tconst destination = pathUtil.join(destinationDir, 'tmp', 'valueType.tmp.ts')\n\n\t\treturn this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontents,\n\t\t\t'For constructing what goes to the right of the : after each property in the interface.'\n\t\t)\n\t}\n\n\tpublic writePlugin(cwd: string) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'features',\n\t\t\t'schema.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.schemaPlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Enable schema support in your skill.'\n\t\t)\n\n\t\treturn results\n\t}\n}\n"],"file":"SchemaWriter.js"}
|
|
1
|
+
{"version":3,"sources":["../../../../src/features/schema/writers/SchemaWriter.ts"],"names":["SchemaWriter","filename","templateFuncName","description","destinationDir","options","ui","startLoading","nameCamel","resolvedBuilderDestination","shouldEnableVersioning","pathUtil","resolve","versionUtil","resolveNewLatestPath","version","LATEST_HANDLEBARS","diskUtil","doesFileExist","SpruceError","code","schemaId","destination","builderContent","templates","schemaBuilder","writeFileIfChangedMixinResults","results","lint","fieldTemplateItems","fieldTemplates","fileAndFunc","resolvedDestination","path","join","contents","destinationDirOrFilename","schemaTemplateItems","valueTypes","typesTemplate","resolvedTypesDestination","resolveFilenameWithFallback","DEFAULT_SCHEMA_TYPES_FILENAME","localItems","filter","i","importFrom","length","schemaTypesContents","schemasTypes","globalSchemaNamespace","writeAllSchemas","dirname","typesFile","allSchemaResults","push","item","writeSchema","schemaResults","registerBuiltSchemas","schemaDiskUtil","resolvePath","schema","relative","undefined","replace","extname","schemaContents","schemaFile","shouldImportCoreSchemas","id","cwd","resolveHashSprucePath","pluginContents","schemaPlugin","AbstractWriter"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAGA;;AAUA;;AACA;;AACA;;;;;;;;;;;;;;;;;;IAiBqBA,Y;;;;;;;;;;;;;;;uGAKd,CACL;AACCC,MAAAA,QAAQ,EAAE,iBADX;AAECC,MAAAA,gBAAgB,EAAE,aAFnB;AAGCC,MAAAA,WAAW,EACV;AAJF,KADK,EAOL;AACCF,MAAAA,QAAQ,EAAE,kBADX;AAECC,MAAAA,gBAAgB,EAAE,eAFnB;AAGCC,MAAAA,WAAW,EACV;AAJF,KAPK,C;;;;;;;wGAeN,iBACCC,cADD,EAECC,OAFD;AAAA;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOC,qBAAKC,EAAL,CAAQC,YAAR,CAAqB,oBAArB;AAEMN,gBAAAA,QATP,aASqBI,OAAO,CAACG,SAT7B;AAWOC,gBAAAA,0BAXP,GAYEJ,OAAO,CAACK,sBAAR,KAAmC,KAAnC,GACGC,iBAASC,OAAT,CAAiBR,cAAjB,EAAiCH,QAAjC,CADH,GAEGY,8BAAYC,oBAAZ,C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mBADM,EAENmC,cAFM,YAILX,IAAI,CAACM,MAAL,CAAY3D,WAAZ,aAA6BqD,IAAI,CAACM,MAAL,CAAY3D,WAAzC,SAA0D,EAJrD,6CAMLqD,IAAI,CAACc,EANA,8CAhDR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;;2GA2DA,kBACClE,cADD,EAECC,OAFD;AAAA;AAAA;AAAA;AAAA;AAAA;AAQO8B,gBAAAA,QARP,GAQkB,KAAKX,SAAL,CAAec,UAAf,CAA0BjC,OAA1B,CARlB;AASOiB,gBAAAA,WATP,GASqBX,iBAASuB,IAAT,CAAc9B,cAAd,EAA8B,KAA9B,EAAqC,kBAArC,CATrB;AAAA,kDAWQ,KAAKsB,8BAAL,CACNJ,WADM,EAENa,QAFM,EAGN,wFAHM,CAXR;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,O;;;;;;;;;;WAkBA,qBAAmBoC,GAAnB,EAAgC;AAC/B,UAAMjD,WAAW,GAAGL,2BAASuD,qBAAT,CACnBD,GADmB,EAEnB,UAFmB,EAGnB,kBAHmB,CAApB;;AAMA,UAAME,cAAc,GAAG,KAAKjD,SAAL,CAAekD,YAAf,EAAvB;AAEA,UAAM/C,OAAO,GAAG,KAAKD,8BAAL,CACfJ,WADe,EAEfmD,cAFe,EAGf,sCAHe,CAAhB;AAMA,aAAO9C,OAAP;AACA;;;EAjQwCgD,2B","sourcesContent":["import path from 'path'\nimport pathUtil from 'path'\nimport { FieldTemplateItem, SchemaTemplateItem } from '@sprucelabs/schema'\nimport { versionUtil } from '@sprucelabs/spruce-skill-utils'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport {\n\tLATEST_HANDLEBARS,\n\tDEFAULT_SCHEMA_TYPES_FILENAME,\n} from '@sprucelabs/spruce-skill-utils'\nimport {\n\tSchemaBuilderTemplateItem,\n\tValueTypes,\n} from '@sprucelabs/spruce-templates'\nimport SpruceError from '../../../errors/SpruceError'\nimport AbstractWriter, { WriteResults } from '../../../writers/AbstractWriter'\nimport schemaDiskUtil from '../utilities/schemaDisk.utility'\n\ninterface WriteFieldTypesOptions {\n\tfieldTemplateItems: FieldTemplateItem[]\n}\n\n// eslint-disable-next-line no-redeclare\nexport interface GenerateSchemaTypesOptions {\n\tfieldTemplateItems: FieldTemplateItem[]\n\tschemaTemplateItems: SchemaTemplateItem[]\n\tvalueTypes: ValueTypes\n\tglobalSchemaNamespace?: string\n\ttypesTemplate?: string\n\tregisterBuiltSchemas?: boolean\n\tshouldImportCoreSchemas: boolean\n}\n\nexport default class SchemaWriter extends AbstractWriter {\n\tprivate readonly fieldTemplates: {\n\t\tfilename: string\n\t\ttemplateFuncName: 'fieldsTypes' | 'fieldClassMap'\n\t\tdescription: string\n\t}[] = [\n\t\t{\n\t\t\tfilename: 'fields.types.ts',\n\t\t\ttemplateFuncName: 'fieldsTypes',\n\t\t\tdescription:\n\t\t\t\t'All the interfaces generated for every type of schema field (text, number, address, etc).',\n\t\t},\n\t\t{\n\t\t\tfilename: 'fieldClassMap.ts',\n\t\t\ttemplateFuncName: 'fieldClassMap',\n\t\t\tdescription:\n\t\t\t\t'An object that is injected into the FieldFactory and ensures 3rd party fields are integrated.',\n\t\t},\n\t]\n\n\tpublic async writeBuilder(\n\t\tdestinationDir: string,\n\t\toptions: SchemaBuilderTemplateItem & {\n\t\t\tshouldEnableVersioning?: boolean\n\t\t\tversion?: string\n\t\t}\n\t): Promise<WriteResults> {\n\t\tthis.ui.startLoading('Writing builder...')\n\n\t\tconst filename = `${options.nameCamel}.builder.ts`\n\n\t\tconst resolvedBuilderDestination =\n\t\t\toptions.shouldEnableVersioning === false\n\t\t\t\t? pathUtil.resolve(destinationDir, filename)\n\t\t\t\t: versionUtil.resolveNewLatestPath(\n\t\t\t\t\t\tdestinationDir,\n\t\t\t\t\t\toptions.version ?? LATEST_HANDLEBARS,\n\t\t\t\t\t\tfilename\n\t\t\t\t )\n\n\t\tif (diskUtil.doesFileExist(resolvedBuilderDestination)) {\n\t\t\tthrow new SpruceError({\n\t\t\t\tcode: 'SCHEMA_EXISTS',\n\t\t\t\tschemaId: options.nameCamel,\n\t\t\t\tdestination: destinationDir,\n\t\t\t})\n\t\t}\n\n\t\tconst builderContent = this.templates.schemaBuilder(options)\n\n\t\tconst results = await this.writeFileIfChangedMixinResults(\n\t\t\tresolvedBuilderDestination,\n\t\t\tbuilderContent,\n\t\t\t'The source of truth for building your schemas and their types. Run spruce sync.errors when you change this.'\n\t\t)\n\n\t\tawait this.lint(resolvedBuilderDestination)\n\n\t\treturn results\n\t}\n\n\tpublic async writeFieldTypes(\n\t\tdestinationDir: string,\n\t\toptions: WriteFieldTypesOptions\n\t): Promise<WriteResults> {\n\t\tthis.ui.startLoading('Checking schema field types...')\n\n\t\tconst { fieldTemplateItems } = options\n\n\t\tlet results: WriteResults = []\n\n\t\tfor (const fileAndFunc of this.fieldTemplates) {\n\t\t\tconst { filename, templateFuncName, description } = fileAndFunc\n\n\t\t\tconst resolvedDestination = path.join(destinationDir, 'fields', filename)\n\n\t\t\tconst contents = this.templates[templateFuncName]({\n\t\t\t\tfieldTemplateItems,\n\t\t\t})\n\n\t\t\tresults = await this.writeFileIfChangedMixinResults(\n\t\t\t\tresolvedDestination,\n\t\t\t\tcontents,\n\t\t\t\tdescription,\n\t\t\t\tresults\n\t\t\t)\n\t\t}\n\n\t\treturn results\n\t}\n\n\tpublic async writeSchemasAndTypes(\n\t\tdestinationDirOrFilename: string,\n\t\toptions: GenerateSchemaTypesOptions\n\t): Promise<WriteResults> {\n\t\tconst {\n\t\t\tfieldTemplateItems,\n\t\t\tschemaTemplateItems,\n\t\t\tvalueTypes,\n\t\t\ttypesTemplate,\n\t\t} = options\n\n\t\tconst resolvedTypesDestination = this.resolveFilenameWithFallback(\n\t\t\tdestinationDirOrFilename,\n\t\t\tDEFAULT_SCHEMA_TYPES_FILENAME\n\t\t)\n\n\t\tlet results: WriteResults = []\n\t\tthis.ui.startLoading('Generating schema types...')\n\n\t\tconst localItems = schemaTemplateItems.filter((i) => !i.importFrom)\n\n\t\tif (localItems.length > 0) {\n\t\t\tconst schemaTypesContents = this.templates.schemasTypes({\n\t\t\t\tschemaTemplateItems: localItems,\n\t\t\t\tfieldTemplateItems,\n\t\t\t\tvalueTypes,\n\t\t\t\tglobalSchemaNamespace: options.globalSchemaNamespace,\n\t\t\t\ttypesTemplate,\n\t\t\t})\n\n\t\t\tresults = await this.writeFileIfChangedMixinResults(\n\t\t\t\tresolvedTypesDestination,\n\t\t\t\tschemaTypesContents,\n\t\t\t\t'Namespace for accessing all your schemas. Type `SpruceSchemas` in your IDE to get started. ⚡️'\n\t\t\t)\n\n\t\t\tawait this.lint(resolvedTypesDestination)\n\t\t}\n\n\t\tthis.ui.startLoading(\n\t\t\t`Checking ${schemaTemplateItems.length} schemas for changes...`\n\t\t)\n\n\t\tconst allSchemaResults = await this.writeAllSchemas(\n\t\t\tpathUtil.dirname(resolvedTypesDestination),\n\t\t\t{\n\t\t\t\t...options,\n\t\t\t\ttypesFile: resolvedTypesDestination,\n\t\t\t}\n\t\t)\n\n\t\tresults.push(...allSchemaResults)\n\n\t\treturn results\n\t}\n\n\tprivate async writeAllSchemas(\n\t\tdestinationDir: string,\n\t\toptions: GenerateSchemaTypesOptions & { typesFile?: string }\n\t): Promise<WriteResults> {\n\t\tconst results: WriteResults = []\n\n\t\tfor (const item of options.schemaTemplateItems) {\n\t\t\tconst schemaResults = await this.writeSchema(destinationDir, {\n\t\t\t\t...options,\n\t\t\t\t...item,\n\t\t\t})\n\t\t\tresults.push(...schemaResults)\n\t\t}\n\n\t\treturn results\n\t}\n\n\tpublic async writeSchema(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tschemaTemplateItems: SchemaTemplateItem[]\n\t\t\tfieldTemplateItems: FieldTemplateItem[]\n\t\t\tvalueTypes: ValueTypes\n\t\t\ttypesFile?: string\n\t\t\tregisterBuiltSchemas?: boolean\n\t\t\tshouldImportCoreSchemas: boolean\n\t\t} & SchemaTemplateItem\n\t) {\n\t\tconst {\n\t\t\tschemaTemplateItems,\n\t\t\tfieldTemplateItems,\n\t\t\tvalueTypes,\n\t\t\tregisterBuiltSchemas = true,\n\t\t\t...item\n\t\t} = options\n\n\t\tconst resolvedDestination = schemaDiskUtil.resolvePath({\n\t\t\tdestination: destinationDir,\n\t\t\tschema: options.schema,\n\t\t})\n\n\t\tlet typesFile = options.typesFile\n\t\t\t? pathUtil.relative(\n\t\t\t\t\tpathUtil.dirname(resolvedDestination),\n\t\t\t\t\toptions.typesFile\n\t\t\t )\n\t\t\t: undefined\n\n\t\tif (typesFile) {\n\t\t\ttypesFile = typesFile.replace(pathUtil.extname(typesFile), '')\n\t\t}\n\n\t\tconst schemaContents = this.templates.schema({\n\t\t\t...item,\n\t\t\tregisterBuiltSchemas,\n\t\t\tschemaTemplateItems,\n\t\t\tfieldTemplateItems,\n\t\t\tvalueTypes,\n\t\t\ttypesFile,\n\t\t\tschemaFile:\n\t\t\t\titem.importFrom && options.shouldImportCoreSchemas\n\t\t\t\t\t? `schema/imported.schema.ts.hbs`\n\t\t\t\t\t: undefined,\n\t\t})\n\n\t\treturn this.writeFileIfChangedMixinResults(\n\t\t\tresolvedDestination,\n\t\t\tschemaContents,\n\t\t\t`${\n\t\t\t\titem.schema.description ? `${item.schema.description} ` : ''\n\t\t\t}This is the schema generated by ${\n\t\t\t\titem.id\n\t\t\t}.builder.ts. AUTOGENERATED. DO NOT EDIT.`\n\t\t)\n\t}\n\n\tpublic async writeValueTypes(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tschemaTemplateItems: SchemaTemplateItem[]\n\t\t\tfieldTemplateItems: FieldTemplateItem[]\n\t\t\tglobalSchemaNamespace?: string\n\t\t}\n\t): Promise<WriteResults> {\n\t\tconst contents = this.templates.valueTypes(options)\n\t\tconst destination = pathUtil.join(destinationDir, 'tmp', 'valueType.tmp.ts')\n\n\t\treturn this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontents,\n\t\t\t'For constructing what goes to the right of the : after each property in the interface.'\n\t\t)\n\t}\n\n\tpublic writePlugin(cwd: string) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'features',\n\t\t\t'schema.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.schemaPlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Enable schema support in your skill.'\n\t\t)\n\n\t\treturn results\n\t}\n}\n"],"file":"SchemaWriter.js"}
|
package/package.json
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"namespace": "spruce-cli"
|
|
9
9
|
},
|
|
10
10
|
"license": "MIT",
|
|
11
|
-
"version": "14.
|
|
11
|
+
"version": "14.21.0",
|
|
12
12
|
"bin": {
|
|
13
13
|
"spruce": "./build/index.js"
|
|
14
14
|
},
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"@sprucelabs/spruce-event-utils": "latest",
|
|
77
77
|
"@sprucelabs/spruce-skill-booter": "latest",
|
|
78
78
|
"@sprucelabs/spruce-skill-utils": "latest",
|
|
79
|
-
"@sprucelabs/spruce-templates": "^14.
|
|
79
|
+
"@sprucelabs/spruce-templates": "^14.21.0",
|
|
80
80
|
"cfonts": "^2.9.3",
|
|
81
81
|
"chalk": "^4.1.2",
|
|
82
82
|
"chokidar": "^3.5.2",
|
|
@@ -599,5 +599,5 @@
|
|
|
599
599
|
"@sprucelabs/heartwood-view-controllers"
|
|
600
600
|
]
|
|
601
601
|
},
|
|
602
|
-
"gitHead": "
|
|
602
|
+
"gitHead": "cd3a926900dcc97ec4e13512f2c1c7186ad2a14c"
|
|
603
603
|
}
|
|
@@ -20,10 +20,40 @@ const REMOTE_MODULE2 = '@sprucelabs/spruce-templates'
|
|
|
20
20
|
export default class SettingUpSchemasForModuleDistributionTest extends AbstractSkillTest {
|
|
21
21
|
protected static skillCacheKey = 'schemas'
|
|
22
22
|
private static builder1: Schema
|
|
23
|
-
private static schema1: Schema
|
|
23
|
+
private static schema1: Schema = {
|
|
24
|
+
id: 'calendarEvent',
|
|
25
|
+
version: 'v2021_09_20',
|
|
26
|
+
namespace: 'TestingSchemas',
|
|
27
|
+
name: 'Schema imported as module',
|
|
28
|
+
moduleToImportFromWhenRemote: '@sprucelabs/spruce-calendar-utils',
|
|
29
|
+
fields: {
|
|
30
|
+
fieldName1: { label: 'First Field', type: 'text', isRequired: true },
|
|
31
|
+
fieldName2: {
|
|
32
|
+
label: 'Second Field',
|
|
33
|
+
type: 'number',
|
|
34
|
+
isRequired: true,
|
|
35
|
+
hint: 'A hint',
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
}
|
|
24
39
|
//@ts-ignore
|
|
25
40
|
private static schema1b: Schema
|
|
26
|
-
private static schema2: Schema
|
|
41
|
+
private static schema2: Schema = {
|
|
42
|
+
id: 'calendarEvent2',
|
|
43
|
+
version: 'v2021_09_20',
|
|
44
|
+
namespace: 'TestingSchemas',
|
|
45
|
+
name: 'Schema imported as module',
|
|
46
|
+
moduleToImportFromWhenRemote: '@sprucelabs/spruce-templates',
|
|
47
|
+
fields: {
|
|
48
|
+
fieldName1: { label: 'First Field', type: 'text', isRequired: true },
|
|
49
|
+
fieldName2: {
|
|
50
|
+
label: 'Second Field',
|
|
51
|
+
type: 'number',
|
|
52
|
+
isRequired: true,
|
|
53
|
+
hint: 'A hint',
|
|
54
|
+
},
|
|
55
|
+
},
|
|
56
|
+
}
|
|
27
57
|
|
|
28
58
|
@test(
|
|
29
59
|
'can specify importFromModuleWhenRemote 1',
|
|
@@ -186,7 +216,7 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
186
216
|
|
|
187
217
|
@test('schemas are imported from one module', ['schema1'])
|
|
188
218
|
@test('schemas are imported from two modules', ['schema1', 'schema2'])
|
|
189
|
-
protected static async
|
|
219
|
+
protected static async schemasAreImportedFromModuleWhenSyncedFromDifferentNamespace(
|
|
190
220
|
schemaNames: ('schema1' | 'schema2')[]
|
|
191
221
|
) {
|
|
192
222
|
await this.reInstallSkill()
|
|
@@ -209,6 +239,7 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
209
239
|
})
|
|
210
240
|
|
|
211
241
|
await this.assertCalendarEventSchemaIsImported(results)
|
|
242
|
+
|
|
212
243
|
assert.doesThrow(() =>
|
|
213
244
|
testUtil.assertFileByNameInGeneratedFiles(
|
|
214
245
|
'schemas.types.ts',
|
|
@@ -269,7 +300,7 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
269
300
|
assert.isEqualDeep(localSchema.importsWhenRemote, importsWhenRemote)
|
|
270
301
|
|
|
271
302
|
await this.assertCalendarEventSchemaIsImported(results)
|
|
272
|
-
await this.
|
|
303
|
+
await this.assertValidTypesFileWhenAddingRemoteImport(results)
|
|
273
304
|
}
|
|
274
305
|
|
|
275
306
|
@test()
|
|
@@ -360,6 +391,78 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
360
391
|
)
|
|
361
392
|
}
|
|
362
393
|
|
|
394
|
+
@test()
|
|
395
|
+
protected static async importedSchemasDoNotShowUpInSchemaTypes() {
|
|
396
|
+
// await this.reInstallSkill()
|
|
397
|
+
await this.Store('skill').setCurrentSkillsNamespace('TestingTwo')
|
|
398
|
+
|
|
399
|
+
const schema1 = {
|
|
400
|
+
id: 'fullCompletedForm',
|
|
401
|
+
namespace: 'Heartwood',
|
|
402
|
+
version: versionUtil.generateVersion().dirValue,
|
|
403
|
+
moduleToImportFromWhenRemote: '@sprucelabs/heartwood-view-controllers',
|
|
404
|
+
importsWhenRemote: ['import * from bananarama'],
|
|
405
|
+
fields: {
|
|
406
|
+
id: {
|
|
407
|
+
type: 'id',
|
|
408
|
+
isRequired: true,
|
|
409
|
+
},
|
|
410
|
+
personId: {
|
|
411
|
+
type: 'id',
|
|
412
|
+
isRequired: true,
|
|
413
|
+
},
|
|
414
|
+
values: {
|
|
415
|
+
type: 'raw',
|
|
416
|
+
isArray: true,
|
|
417
|
+
options: {
|
|
418
|
+
valueType: 'Record<string, any>',
|
|
419
|
+
},
|
|
420
|
+
},
|
|
421
|
+
},
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
const schema2 = {
|
|
425
|
+
id: 'localCompleted',
|
|
426
|
+
version: versionUtil.generateVersion().dirValue,
|
|
427
|
+
fields: {
|
|
428
|
+
id: {
|
|
429
|
+
type: 'id',
|
|
430
|
+
isRequired: true,
|
|
431
|
+
},
|
|
432
|
+
personId: {
|
|
433
|
+
type: 'id',
|
|
434
|
+
isRequired: true,
|
|
435
|
+
},
|
|
436
|
+
values: {
|
|
437
|
+
type: 'raw',
|
|
438
|
+
isArray: true,
|
|
439
|
+
options: {
|
|
440
|
+
valueType: 'Record<string, any>',
|
|
441
|
+
},
|
|
442
|
+
},
|
|
443
|
+
},
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
await this.getEmitter().on('schema.did-fetch-schemas', async () => {
|
|
447
|
+
return {
|
|
448
|
+
schemas: [schema1, schema2],
|
|
449
|
+
}
|
|
450
|
+
})
|
|
451
|
+
|
|
452
|
+
const results = await this.SyncAction().execute({
|
|
453
|
+
shouldInstallMissingDependencies: true,
|
|
454
|
+
})
|
|
455
|
+
|
|
456
|
+
assert.isFalsy(results.errors)
|
|
457
|
+
|
|
458
|
+
const schemaTypesFile = testUtil.assertFileByNameInGeneratedFiles(
|
|
459
|
+
'schemas.types.ts',
|
|
460
|
+
results.files
|
|
461
|
+
)
|
|
462
|
+
|
|
463
|
+
await this.Service('typeChecker').check(schemaTypesFile)
|
|
464
|
+
}
|
|
465
|
+
|
|
363
466
|
private static SyncAction() {
|
|
364
467
|
return this.Action('schema', 'sync', {
|
|
365
468
|
optionOverrides: {
|
|
@@ -429,7 +532,9 @@ export default class SettingUpSchemasForModuleDistributionTest extends AbstractS
|
|
|
429
532
|
return templateItems as SchemaTemplateItem[]
|
|
430
533
|
}
|
|
431
534
|
|
|
432
|
-
private static async
|
|
535
|
+
private static async assertValidTypesFileWhenAddingRemoteImport(
|
|
536
|
+
results: FeatureActionResponse
|
|
537
|
+
) {
|
|
433
538
|
const schemaTypesFile = testUtil.assertFileByNameInGeneratedFiles(
|
|
434
539
|
'schemas.types.ts',
|
|
435
540
|
results.files
|
|
@@ -39,7 +39,7 @@ type OptionsSchema = typeof optionsSchema
|
|
|
39
39
|
type Options = SchemaValues<OptionsSchema>
|
|
40
40
|
|
|
41
41
|
export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
42
|
-
public commandAliases = ['set.remote']
|
|
42
|
+
public commandAliases = ['set.remote [remote]']
|
|
43
43
|
public optionsSchema: OptionsSchema = optionsSchema
|
|
44
44
|
public invocationMessage = 'Set remote... 🜒'
|
|
45
45
|
|
|
@@ -140,13 +140,11 @@ export default class SchemaWriter extends AbstractWriter {
|
|
|
140
140
|
let results: WriteResults = []
|
|
141
141
|
this.ui.startLoading('Generating schema types...')
|
|
142
142
|
|
|
143
|
-
const
|
|
144
|
-
(i) => !i.importFrom
|
|
145
|
-
)
|
|
143
|
+
const localItems = schemaTemplateItems.filter((i) => !i.importFrom)
|
|
146
144
|
|
|
147
|
-
if (
|
|
145
|
+
if (localItems.length > 0) {
|
|
148
146
|
const schemaTypesContents = this.templates.schemasTypes({
|
|
149
|
-
schemaTemplateItems,
|
|
147
|
+
schemaTemplateItems: localItems,
|
|
150
148
|
fieldTemplateItems,
|
|
151
149
|
valueTypes,
|
|
152
150
|
globalSchemaNamespace: options.globalSchemaNamespace,
|