@sprucelabs/spruce-cli 18.3.0 → 18.4.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.
Files changed (145) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +2 -14
  3. package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
  4. package/build/__tests__/behavioral/events/EventWriter.test.d.ts +4 -0
  5. package/build/__tests__/behavioral/events/EventWriter.test.js +116 -0
  6. package/build/__tests__/behavioral/events/EventWriter.test.js.map +1 -0
  7. package/build/__tests__/behavioral/{ListeningToCoreEvents.test.d.ts → events/ListeningToCoreEvents.test.d.ts} +1 -1
  8. package/build/__tests__/behavioral/{ListeningToCoreEvents.test.js → events/ListeningToCoreEvents.test.js} +1 -1
  9. package/build/__tests__/behavioral/events/ListeningToCoreEvents.test.js.map +1 -0
  10. package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.d.ts → events/RegisteringEventsOnBoot.test.d.ts} +1 -1
  11. package/build/__tests__/behavioral/{RegisteringEventsOnBoot.test.js → events/RegisteringEventsOnBoot.test.js} +2 -2
  12. package/build/__tests__/behavioral/events/RegisteringEventsOnBoot.test.js.map +1 -0
  13. package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.d.ts → events/RegisteringGlobalEvents.test.d.ts} +2 -3
  14. package/build/__tests__/behavioral/{RegisteringGlobalEvents.test.js → events/RegisteringGlobalEvents.test.js} +45 -70
  15. package/build/__tests__/behavioral/events/RegisteringGlobalEvents.test.js.map +1 -0
  16. package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.d.ts → events/SyncingEventsOnlyFromDependencies.test.d.ts} +1 -1
  17. package/build/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.js → events/SyncingEventsOnlyFromDependencies.test.js} +1 -1
  18. package/build/__tests__/behavioral/events/SyncingEventsOnlyFromDependencies.test.js.map +1 -0
  19. package/build/__tests__/behavioral/permissions/PermissionStore.test.js +1 -0
  20. package/build/__tests__/behavioral/permissions/PermissionStore.test.js.map +1 -1
  21. package/build/__tests__/behavioral/permissions/PermissionWriter.test.js +1 -1
  22. package/build/__tests__/behavioral/permissions/PermissionWriter.test.js.map +1 -1
  23. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.d.ts +1 -0
  24. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js +53 -18
  25. package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js.map +1 -1
  26. package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.d.ts → schemas/CreatingSchemasWithGenerics.test.d.ts} +1 -1
  27. package/build/__tests__/behavioral/{CreatingSchemasWithGenerics.test.js → schemas/CreatingSchemasWithGenerics.test.js} +2 -2
  28. package/build/__tests__/behavioral/schemas/CreatingSchemasWithGenerics.test.js.map +1 -0
  29. package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.d.ts → schemas/SettingUpSchemasForModuleDistribution.test.d.ts} +1 -1
  30. package/build/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.js → schemas/SettingUpSchemasForModuleDistribution.test.js} +3 -3
  31. package/build/__tests__/behavioral/schemas/SettingUpSchemasForModuleDistribution.test.js.map +1 -0
  32. package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.d.ts → skill/InstallingASkillAtAnOrg.test.d.ts} +1 -1
  33. package/build/__tests__/behavioral/{InstallingASkillAtAnOrg.test.js → skill/InstallingASkillAtAnOrg.test.js} +2 -2
  34. package/build/__tests__/behavioral/skill/InstallingASkillAtAnOrg.test.js.map +1 -0
  35. package/build/__tests__/behavioral/{LoggingInAsASkill.test.d.ts → skill/LoggingInAsASkill.test.d.ts} +1 -1
  36. package/build/__tests__/behavioral/{LoggingInAsASkill.test.js → skill/LoggingInAsASkill.test.js} +2 -2
  37. package/build/__tests__/behavioral/skill/LoggingInAsASkill.test.js.map +1 -0
  38. package/build/__tests__/behavioral/{RebuildingASkill.test.d.ts → skill/RebuildingASkill.test.d.ts} +1 -1
  39. package/build/__tests__/behavioral/{RebuildingASkill.test.js → skill/RebuildingASkill.test.js} +2 -2
  40. package/build/__tests__/behavioral/skill/RebuildingASkill.test.js.map +1 -0
  41. package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.d.ts → tests/SettingUpASkillForTesting.test.d.ts} +1 -1
  42. package/build/__tests__/behavioral/{SettingUpASkillForTesting.test.js → tests/SettingUpASkillForTesting.test.js} +2 -2
  43. package/build/__tests__/behavioral/tests/SettingUpASkillForTesting.test.js.map +1 -0
  44. package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.d.ts → tests/TestReporterSettingsRemembered.test.d.ts} +1 -1
  45. package/build/__tests__/behavioral/{TestReporterSettingsRemembered.test.js → tests/TestReporterSettingsRemembered.test.js} +1 -1
  46. package/build/__tests__/behavioral/tests/TestReporterSettingsRemembered.test.js.map +1 -0
  47. package/build/__tests__/behavioral/{TestingDataStores.test.d.ts → tests/TestingDataStores.test.d.ts} +1 -1
  48. package/build/__tests__/behavioral/{TestingDataStores.test.js → tests/TestingDataStores.test.js} +3 -3
  49. package/build/__tests__/behavioral/tests/TestingDataStores.test.js.map +1 -0
  50. package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.d.ts → views/RegisteringSkillViewOnBoot.test.d.ts} +4 -4
  51. package/build/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.js → views/RegisteringSkillViewOnBoot.test.js} +2 -2
  52. package/build/__tests__/behavioral/views/RegisteringSkillViewOnBoot.test.js.map +1 -0
  53. package/build/__tests__/behavioral/{WatchingSkillViews.test.d.ts → views/WatchingSkillViews.test.d.ts} +1 -1
  54. package/build/__tests__/behavioral/{WatchingSkillViews.test.js → views/WatchingSkillViews.test.js} +3 -3
  55. package/build/__tests__/behavioral/views/WatchingSkillViews.test.js.map +1 -0
  56. package/build/__tests__/support/EventFaker.d.ts +1 -1
  57. package/build/__tests__/support/EventFaker.js.map +1 -1
  58. package/build/features/eventContract/EventContractFeature.js +1 -4
  59. package/build/features/eventContract/EventContractFeature.js.map +1 -1
  60. package/build/features/eventContract/actions/PullAction.d.ts +1 -0
  61. package/build/features/eventContract/actions/PullAction.js +49 -8
  62. package/build/features/eventContract/actions/PullAction.js.map +1 -1
  63. package/build/features/permission/PermissionFeature.js +20 -12
  64. package/build/features/permission/PermissionFeature.js.map +1 -1
  65. package/build/features/permission/actions/SyncAction.d.ts +22 -3
  66. package/build/features/permission/actions/SyncAction.js +58 -16
  67. package/build/features/permission/actions/SyncAction.js.map +1 -1
  68. package/build/features/permission/stores/PermissionStore.d.ts +6 -2
  69. package/build/features/permission/stores/PermissionStore.js +25 -21
  70. package/build/features/permission/stores/PermissionStore.js.map +1 -1
  71. package/build/features/permission/writers/PermissionWriter.d.ts +1 -1
  72. package/build/features/permission/writers/PermissionWriter.js +2 -2
  73. package/build/features/permission/writers/PermissionWriter.js.map +1 -1
  74. package/build/features/view/actions/WatchAction.js +1 -1
  75. package/build/features/view/actions/WatchAction.js.map +1 -1
  76. package/node_modules/@typescript-eslint/parser/README.md +6 -300
  77. package/node_modules/@typescript-eslint/parser/dist/parser.d.ts.map +1 -1
  78. package/node_modules/@typescript-eslint/parser/dist/parser.js +15 -17
  79. package/node_modules/@typescript-eslint/parser/dist/parser.js.map +1 -1
  80. package/node_modules/@typescript-eslint/parser/package.json +5 -5
  81. package/node_modules/@typescript-eslint/scope-manager/README.md +5 -117
  82. package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
  83. package/node_modules/@typescript-eslint/types/README.md +6 -11
  84. package/node_modules/@typescript-eslint/types/package.json +2 -2
  85. package/node_modules/@typescript-eslint/typescript-estree/README.md +6 -379
  86. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/{createWatchProgram.d.ts → getWatchProgramsForProjects.d.ts} +3 -4
  87. package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +1 -1
  88. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js +3 -3
  89. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js.map +1 -1
  90. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/{createWatchProgram.d.ts → getWatchProgramsForProjects.d.ts} +3 -4
  91. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/getWatchProgramsForProjects.d.ts.map +1 -0
  92. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/{createWatchProgram.js → getWatchProgramsForProjects.js} +4 -5
  93. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/getWatchProgramsForProjects.js.map +1 -0
  94. package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts +1 -1
  95. package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts.map +1 -1
  96. package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +2 -2
  97. package/node_modules/@typescript-eslint/typescript-estree/dist/index.js.map +1 -1
  98. package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +2 -2
  99. package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
  100. package/node_modules/@typescript-eslint/visitor-keys/README.md +6 -9
  101. package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
  102. package/package.json +22 -22
  103. package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +0 -5
  104. package/src/__tests__/behavioral/events/EventWriter.test.ts +75 -0
  105. package/src/__tests__/behavioral/{ListeningToCoreEvents.test.ts → events/ListeningToCoreEvents.test.ts} +1 -1
  106. package/src/__tests__/behavioral/{RegisteringEventsOnBoot.test.ts → events/RegisteringEventsOnBoot.test.ts} +2 -2
  107. package/src/__tests__/behavioral/{RegisteringGlobalEvents.test.ts → events/RegisteringGlobalEvents.test.ts} +4 -12
  108. package/src/__tests__/behavioral/{SyncingEventsOnlyFromDependencies.test.ts → events/SyncingEventsOnlyFromDependencies.test.ts} +2 -2
  109. package/src/__tests__/behavioral/permissions/PermissionStore.test.ts +2 -1
  110. package/src/__tests__/behavioral/permissions/PermissionWriter.test.ts +1 -0
  111. package/src/__tests__/behavioral/permissions/SyncingPermissions.test.ts +21 -3
  112. package/src/__tests__/behavioral/{CreatingSchemasWithGenerics.test.ts → schemas/CreatingSchemasWithGenerics.test.ts} +2 -2
  113. package/src/__tests__/behavioral/{SettingUpSchemasForModuleDistribution.test.ts → schemas/SettingUpSchemasForModuleDistribution.test.ts} +4 -4
  114. package/src/__tests__/behavioral/{InstallingASkillAtAnOrg.test.ts → skill/InstallingASkillAtAnOrg.test.ts} +2 -2
  115. package/src/__tests__/behavioral/{LoggingInAsASkill.test.ts → skill/LoggingInAsASkill.test.ts} +3 -3
  116. package/src/__tests__/behavioral/{RebuildingASkill.test.ts → skill/RebuildingASkill.test.ts} +2 -2
  117. package/src/__tests__/behavioral/{SettingUpASkillForTesting.test.ts → tests/SettingUpASkillForTesting.test.ts} +2 -2
  118. package/src/__tests__/behavioral/{TestReporterSettingsRemembered.test.ts → tests/TestReporterSettingsRemembered.test.ts} +2 -2
  119. package/src/__tests__/behavioral/{TestingDataStores.test.ts → tests/TestingDataStores.test.ts} +3 -3
  120. package/src/__tests__/behavioral/{RegisteringSkillViewOnBoot.test.ts → views/RegisteringSkillViewOnBoot.test.ts} +2 -2
  121. package/src/__tests__/behavioral/{WatchingSkillViews.test.ts → views/WatchingSkillViews.test.ts} +4 -4
  122. package/src/__tests__/support/EventFaker.ts +1 -2
  123. package/src/features/eventContract/EventContractFeature.ts +1 -6
  124. package/src/features/eventContract/actions/PullAction.ts +21 -3
  125. package/src/features/permission/PermissionFeature.ts +7 -10
  126. package/src/features/permission/actions/SyncAction.ts +42 -5
  127. package/src/features/permission/stores/PermissionStore.ts +26 -12
  128. package/src/features/permission/writers/PermissionWriter.ts +2 -5
  129. package/src/features/view/actions/WatchAction.ts +1 -1
  130. package/build/__tests__/behavioral/CreatingSchemasWithGenerics.test.js.map +0 -1
  131. package/build/__tests__/behavioral/InstallingASkillAtAnOrg.test.js.map +0 -1
  132. package/build/__tests__/behavioral/ListeningToCoreEvents.test.js.map +0 -1
  133. package/build/__tests__/behavioral/LoggingInAsASkill.test.js.map +0 -1
  134. package/build/__tests__/behavioral/RebuildingASkill.test.js.map +0 -1
  135. package/build/__tests__/behavioral/RegisteringEventsOnBoot.test.js.map +0 -1
  136. package/build/__tests__/behavioral/RegisteringGlobalEvents.test.js.map +0 -1
  137. package/build/__tests__/behavioral/RegisteringSkillViewOnBoot.test.js.map +0 -1
  138. package/build/__tests__/behavioral/SettingUpASkillForTesting.test.js.map +0 -1
  139. package/build/__tests__/behavioral/SettingUpSchemasForModuleDistribution.test.js.map +0 -1
  140. package/build/__tests__/behavioral/SyncingEventsOnlyFromDependencies.test.js.map +0 -1
  141. package/build/__tests__/behavioral/TestReporterSettingsRemembered.test.js.map +0 -1
  142. package/build/__tests__/behavioral/TestingDataStores.test.js.map +0 -1
  143. package/build/__tests__/behavioral/WatchingSkillViews.test.js.map +0 -1
  144. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +0 -1
  145. package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +0 -1
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
5
5
  value: true
6
6
  });
7
7
  exports["default"] = void 0;
8
+ exports.writePermissionTypesFile = writePermissionTypesFile;
8
9
  var _regenerator = _interopRequireDefault(require("@babel/runtime/regenerator"));
9
10
  var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
11
  var _asyncToGenerator2 = _interopRequireDefault(require("@babel/runtime/helpers/asyncToGenerator"));
@@ -38,42 +39,47 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
38
39
  (0, _createClass2["default"])(SyncAction, [{
39
40
  key: "execute",
40
41
  value: function () {
41
- var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee() {
42
- var map, typesFiles, local, combinedFiles;
42
+ var _execute = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(options) {
43
+ var _this$validateAndNorm, shouldSyncCorePermissions, permissions, writer, cwd, typesFiles, local, combinedFiles;
43
44
  return _regenerator["default"].wrap(function _callee$(_context) {
44
45
  while (1) {
45
46
  switch (_context.prev = _context.next) {
46
47
  case 0:
47
- _context.next = 2;
48
- return this.permissions.fetchContracts();
49
- case 2:
50
- map = _context.sent;
51
- _context.next = 5;
52
- return this.writer.writeTypesFile(this.cwd, map);
53
- case 5:
48
+ _this$validateAndNorm = this.validateAndNormalizeOptions(options !== null && options !== void 0 ? options : {}), shouldSyncCorePermissions = _this$validateAndNorm.shouldSyncCorePermissions;
49
+ permissions = this.permissions;
50
+ writer = this.writer;
51
+ cwd = this.cwd;
52
+ _context.next = 6;
53
+ return writePermissionTypesFile({
54
+ permissions: permissions,
55
+ shouldSyncCorePermissions: shouldSyncCorePermissions,
56
+ writer: writer,
57
+ cwd: cwd
58
+ });
59
+ case 6:
54
60
  typesFiles = _context.sent;
55
- _context.next = 8;
61
+ _context.next = 9;
56
62
  return this.permissions.loadLocalPermissions();
57
- case 8:
63
+ case 9:
58
64
  local = _context.sent;
59
- _context.next = 11;
65
+ _context.next = 12;
60
66
  return this.writer.writeCombinedFile(this.cwd, {
61
67
  contracts: local
62
68
  });
63
- case 11:
69
+ case 12:
64
70
  combinedFiles = _context.sent;
65
71
  return _context.abrupt("return", {
66
72
  files: [].concat((0, _toConsumableArray2["default"])(typesFiles), (0, _toConsumableArray2["default"])(combinedFiles)),
67
73
  summaryLines: ['Permissions synced']
68
74
  });
69
- case 13:
75
+ case 14:
70
76
  case "end":
71
77
  return _context.stop();
72
78
  }
73
79
  }
74
80
  }, _callee, this);
75
81
  }));
76
- function execute() {
82
+ function execute(_x) {
77
83
  return _execute.apply(this, arguments);
78
84
  }
79
85
  return execute;
@@ -84,6 +90,42 @@ var SyncAction = /*#__PURE__*/function (_AbstractAction) {
84
90
  exports["default"] = SyncAction;
85
91
  var schema = (0, _schema.buildSchema)({
86
92
  id: 'syncPermissions',
87
- fields: {}
93
+ fields: {
94
+ shouldSyncCorePermissions: {
95
+ type: 'boolean'
96
+ }
97
+ }
88
98
  });
99
+ function writePermissionTypesFile(_x2) {
100
+ return _writePermissionTypesFile.apply(this, arguments);
101
+ }
102
+ function _writePermissionTypesFile() {
103
+ _writePermissionTypesFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(options) {
104
+ var permissions, shouldSyncCorePermissions, writer, cwd, namespaces, map, typesFiles;
105
+ return _regenerator["default"].wrap(function _callee2$(_context2) {
106
+ while (1) {
107
+ switch (_context2.prev = _context2.next) {
108
+ case 0:
109
+ permissions = options.permissions, shouldSyncCorePermissions = options.shouldSyncCorePermissions, writer = options.writer, cwd = options.cwd, namespaces = options.namespaces;
110
+ _context2.next = 3;
111
+ return permissions.fetchContracts({
112
+ namespaces: namespaces,
113
+ shouldSyncCorePermissions: shouldSyncCorePermissions
114
+ });
115
+ case 3:
116
+ map = _context2.sent;
117
+ _context2.next = 6;
118
+ return writer.writeTypesFile(cwd, map);
119
+ case 6:
120
+ typesFiles = _context2.sent;
121
+ return _context2.abrupt("return", typesFiles);
122
+ case 8:
123
+ case "end":
124
+ return _context2.stop();
125
+ }
126
+ }
127
+ }, _callee2);
128
+ }));
129
+ return _writePermissionTypesFile.apply(this, arguments);
130
+ }
89
131
  //# sourceMappingURL=SyncAction.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SyncAction.js","names":["SyncAction","options","schema","permissions","Store","writer","Writer","fetchContracts","map","writeTypesFile","cwd","typesFiles","loadLocalPermissions","local","writeCombinedFile","contracts","combinedFiles","files","summaryLines","AbstractAction","buildSchema","id","fields"],"sources":["../../../../src/features/permission/actions/SyncAction.ts"],"sourcesContent":["import { buildSchema } from '@sprucelabs/schema'\nimport AbstractAction from '../../AbstractAction'\nimport { ActionOptions, FeatureActionResponse } from '../../features.types'\nimport PermissionStore from '../stores/PermissionStore'\nimport PermissionWriter from '../writers/PermissionWriter'\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Syncing permissions... 🛡'\n\tpublic optionsSchema = schema\n\tpublic readonly commandAliases: string[] = ['sync.permissions']\n\n\tprivate permissions: PermissionStore\n\tprivate writer: PermissionWriter\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\t\tthis.permissions = this.Store('permission')\n\t\tthis.writer = this.Writer('permission')\n\t}\n\n\tpublic async execute(): Promise<FeatureActionResponse> {\n\t\tconst map = await this.permissions.fetchContracts()\n\t\tconst typesFiles = await this.writer.writeTypesFile(this.cwd, map)\n\n\t\tconst local = await this.permissions.loadLocalPermissions()\n\t\tconst combinedFiles = await this.writer.writeCombinedFile(this.cwd, {\n\t\t\tcontracts: local,\n\t\t})\n\n\t\treturn {\n\t\t\tfiles: [...typesFiles, ...combinedFiles],\n\t\t\tsummaryLines: ['Permissions synced'],\n\t\t}\n\t}\n}\n\nconst schema = buildSchema({\n\tid: 'syncPermissions',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof schema\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AACA;AAAiD;AAAA;AAAA,IAK5BA,UAAU;EAAA;EAAA;EAQ9B,oBAAmBC,OAAsB,EAAE;IAAA;IAAA;IAC1C,0BAAMA,OAAO;IAAC,sGARY,2BAA2B;IAAA,kGAC/BC,MAAM;IAAA,mGACc,CAAC,kBAAkB,CAAC;IAAA;IAAA;IAO9D,MAAKC,WAAW,GAAG,MAAKC,KAAK,CAAC,YAAY,CAAC;IAC3C,MAAKC,MAAM,GAAG,MAAKC,MAAM,CAAC,YAAY,CAAC;IAAA;EACxC;EAAC;IAAA;IAAA;MAAA,6FAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACmB,IAAI,CAACH,WAAW,CAACI,cAAc,EAAE;cAAA;gBAA7CC,GAAG;gBAAA;gBAAA,OACgB,IAAI,CAACH,MAAM,CAACI,cAAc,CAAC,IAAI,CAACC,GAAG,EAAEF,GAAG,CAAC;cAAA;gBAA5DG,UAAU;gBAAA;gBAAA,OAEI,IAAI,CAACR,WAAW,CAACS,oBAAoB,EAAE;cAAA;gBAArDC,KAAK;gBAAA;gBAAA,OACiB,IAAI,CAACR,MAAM,CAACS,iBAAiB,CAAC,IAAI,CAACJ,GAAG,EAAE;kBACnEK,SAAS,EAAEF;gBACZ,CAAC,CAAC;cAAA;gBAFIG,aAAa;gBAAA,iCAIZ;kBACNC,KAAK,gDAAMN,UAAU,uCAAKK,aAAa,EAAC;kBACxCE,YAAY,EAAE,CAAC,oBAAoB;gBACpC,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACD;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EA3BsCC,2BAAc;AAAA;AA8BtD,IAAMjB,MAAM,GAAG,IAAAkB,mBAAW,EAAC;EAC1BC,EAAE,EAAE,iBAAiB;EACrBC,MAAM,EAAE,CAAC;AACV,CAAC,CAAC"}
1
+ {"version":3,"file":"SyncAction.js","names":["SyncAction","options","schema","permissions","Store","writer","Writer","validateAndNormalizeOptions","shouldSyncCorePermissions","cwd","writePermissionTypesFile","typesFiles","loadLocalPermissions","local","writeCombinedFile","contracts","combinedFiles","files","summaryLines","AbstractAction","buildSchema","id","fields","type","namespaces","fetchContracts","map","writeTypesFile"],"sources":["../../../../src/features/permission/actions/SyncAction.ts"],"sourcesContent":["import { buildSchema, SchemaValues } from '@sprucelabs/schema'\nimport AbstractAction from '../../AbstractAction'\nimport { ActionOptions, FeatureActionResponse } from '../../features.types'\nimport PermissionStore from '../stores/PermissionStore'\nimport PermissionWriter from '../writers/PermissionWriter'\n\nexport default class SyncAction extends AbstractAction<OptionsSchema> {\n\tpublic invocationMessage = 'Syncing permissions... 🛡'\n\tpublic optionsSchema = schema\n\tpublic readonly commandAliases: string[] = ['sync.permissions']\n\n\tprivate permissions: PermissionStore\n\tprivate writer: PermissionWriter\n\n\tpublic constructor(options: ActionOptions) {\n\t\tsuper(options)\n\t\tthis.permissions = this.Store('permission')\n\t\tthis.writer = this.Writer('permission')\n\t}\n\n\tpublic async execute(\n\t\toptions?: SyncPermissionsOptions\n\t): Promise<FeatureActionResponse> {\n\t\tconst { shouldSyncCorePermissions } = this.validateAndNormalizeOptions(\n\t\t\toptions ?? {}\n\t\t)\n\n\t\tconst permissions = this.permissions\n\t\tconst writer = this.writer\n\t\tconst cwd = this.cwd\n\n\t\tconst typesFiles = await writePermissionTypesFile({\n\t\t\tpermissions,\n\t\t\tshouldSyncCorePermissions,\n\t\t\twriter,\n\t\t\tcwd,\n\t\t})\n\n\t\tconst local = await this.permissions.loadLocalPermissions()\n\t\tconst combinedFiles = await this.writer.writeCombinedFile(this.cwd, {\n\t\t\tcontracts: local,\n\t\t})\n\n\t\treturn {\n\t\t\tfiles: [...typesFiles, ...combinedFiles],\n\t\t\tsummaryLines: ['Permissions synced'],\n\t\t}\n\t}\n}\n\nconst schema = buildSchema({\n\tid: 'syncPermissions',\n\tfields: {\n\t\tshouldSyncCorePermissions: {\n\t\t\ttype: 'boolean',\n\t\t},\n\t},\n})\n\ntype OptionsSchema = typeof schema\nexport type SyncPermissionsOptions = SchemaValues<OptionsSchema>\n\nexport async function writePermissionTypesFile(options: {\n\tpermissions: PermissionStore\n\tshouldSyncCorePermissions: boolean | undefined\n\tnamespaces?: string[]\n\twriter: PermissionWriter\n\tcwd: string\n}) {\n\tconst { permissions, shouldSyncCorePermissions, writer, cwd, namespaces } =\n\t\toptions\n\n\tconst map = await permissions.fetchContracts({\n\t\tnamespaces,\n\t\tshouldSyncCorePermissions,\n\t})\n\tconst typesFiles = await writer.writeTypesFile(cwd, map)\n\treturn typesFiles\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AACA;AAAiD;AAAA;AAAA,IAK5BA,UAAU;EAAA;EAAA;EAQ9B,oBAAmBC,OAAsB,EAAE;IAAA;I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AkB,mBAAW,EAAC;EAC1BC,EAAE,EAAE,iBAAiB;EACrBC,MAAM,EAAE;IACPd,yBAAyB,EAAE;MAC1Be,IAAI,EAAE;IACP;EACD;AACD,CAAC,CAAC;AAAA,SAKoBb,wBAAwB;EAAA;AAAA;AAAA;EAAA,0GAAvC,kBAAwCT,OAM9C;IAAA;IAAA;MAAA;QAAA;UAAA;YACQE,WAAW,GAClBF,OAAO,CADAE,WAAW,EAAEK,yBAAyB,GAC7CP,OAAO,CADaO,yBAAyB,EAAEH,MAAM,GACrDJ,OAAO,CADwCI,MAAM,EAAEI,GAAG,GAC1DR,OAAO,CADgDQ,GAAG,EAAEe,UAAU,GACtEvB,OAAO,CADqDuB,UAAU;YAAA;YAAA,OAGrDrB,WAAW,CAACsB,cAAc,CAAC;cAC5CD,UAAU,EAAVA,UAAU;cACVhB,yBAAyB,EAAzBA;YACD,CAAC,CAAC;UAAA;YAHIkB,GAAG;YAAA;YAAA,OAIgBrB,MAAM,CAACsB,cAAc,CAAClB,GAAG,EAAEiB,GAAG,CAAC;UAAA;YAAlDf,UAAU;YAAA,kCACTA,UAAU;UAAA;UAAA;YAAA;QAAA;MAAA;IAAA;EAAA,CACjB;EAAA;AAAA"}
@@ -1,12 +1,16 @@
1
- import { PermissionContractMap } from '@sprucelabs/mercury-types';
1
+ import { PermissionContractMap, SpruceSchemas } from '@sprucelabs/mercury-types';
2
2
  import AbstractStore from '../../../stores/AbstractStore';
3
3
  export default class PermissionStore extends AbstractStore {
4
4
  name: string;
5
5
  loadLocalPermissions(): Promise<ImportedPermission[]>;
6
- fetchContracts(): Promise<PermissionContractMap>;
6
+ fetchContracts(options?: {
7
+ shouldSyncCorePermissions?: boolean;
8
+ namespaces?: string[];
9
+ }): Promise<PermissionContractMap>;
7
10
  }
8
11
  export interface ImportedPermission {
9
12
  id: string;
10
13
  permissions: string[];
11
14
  path: string;
12
15
  }
16
+ export declare type ListPermContractsTargetAndPayload = SpruceSchemas.Mercury.v2020_12_25.ListPermissionContractsEmitTargetAndPayload;
@@ -105,39 +105,43 @@ var PermissionStore = /*#__PURE__*/function (_AbstractStore) {
105
105
  }, {
106
106
  key: "fetchContracts",
107
107
  value: function () {
108
- var _fetchContracts = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2() {
109
- var client, deps, local, map, _yield$client$emitAnd, _yield$client$emitAnd2, permissionContracts, _iterator2, _step2, result;
108
+ var _fetchContracts = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee2(options) {
109
+ var _ref, shouldSyncCorePermissions, namespaces, target, client, deps, _yield$client$emitAnd, _yield$client$emitAnd2, permissionContracts, local, map, _iterator2, _step2, result;
110
110
  return _regenerator["default"].wrap(function _callee2$(_context2) {
111
111
  while (1) {
112
112
  switch (_context2.prev = _context2.next) {
113
113
  case 0:
114
- _context2.next = 2;
114
+ _ref = options !== null && options !== void 0 ? options : {}, shouldSyncCorePermissions = _ref.shouldSyncCorePermissions, namespaces = _ref.namespaces;
115
+ _context2.next = 3;
115
116
  return this.connectToApi({
116
117
  shouldAuthAsCurrentSkill: true
117
118
  });
118
- case 2:
119
+ case 3:
119
120
  client = _context2.sent;
120
- deps = this.Service('dependency').get();
121
- _context2.next = 6;
122
- return this.loadLocalPermissions();
123
- case 6:
124
- local = _context2.sent;
125
- map = local.reduce(function (map, local) {
126
- map[local.id] = local.permissions;
127
- return map;
128
- }, {});
129
- _context2.next = 10;
130
- return client.emitAndFlattenResponses('list-permission-contracts::v2020_12_25', {
131
- target: {
132
- namespaces: deps.map(function (d) {
121
+ if (!shouldSyncCorePermissions) {
122
+ deps = this.Service('dependency').get();
123
+ target = {
124
+ namespaces: namespaces !== null && namespaces !== void 0 ? namespaces : deps.map(function (d) {
133
125
  return d.namespace;
134
126
  })
135
- }
127
+ };
128
+ }
129
+ _context2.next = 7;
130
+ return client.emitAndFlattenResponses('list-permission-contracts::v2020_12_25', {
131
+ target: target
136
132
  });
137
- case 10:
133
+ case 7:
138
134
  _yield$client$emitAnd = _context2.sent;
139
135
  _yield$client$emitAnd2 = (0, _slicedToArray2["default"])(_yield$client$emitAnd, 1);
140
136
  permissionContracts = _yield$client$emitAnd2[0].permissionContracts;
137
+ _context2.next = 12;
138
+ return this.loadLocalPermissions();
139
+ case 12:
140
+ local = _context2.sent;
141
+ map = local.reduce(function (map, local) {
142
+ map[local.id] = local.permissions;
143
+ return map;
144
+ }, {});
141
145
  _iterator2 = _createForOfIteratorHelper(permissionContracts);
142
146
  try {
143
147
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
@@ -152,14 +156,14 @@ var PermissionStore = /*#__PURE__*/function (_AbstractStore) {
152
156
  _iterator2.f();
153
157
  }
154
158
  return _context2.abrupt("return", map);
155
- case 16:
159
+ case 17:
156
160
  case "end":
157
161
  return _context2.stop();
158
162
  }
159
163
  }
160
164
  }, _callee2, this);
161
165
  }));
162
- function fetchContracts() {
166
+ function fetchContracts(_x) {
163
167
  return _fetchContracts.apply(this, arguments);
164
168
  }
165
169
  return fetchContracts;
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionStore.js","names":["PermissionStore","globby","cwd","matches","namespace","Service","getSkillNamespace","imported","file","path","diskUtil","resolvePath","importDefault","contract","push","id","permissions","map","p","connectToApi","shouldAuthAsCurrentSkill","client","deps","get","loadLocalPermissions","local","reduce","emitAndFlattenResponses","target","namespaces","d","permissionContracts","result","AbstractStore"],"sources":["../../../../src/features/permission/stores/PermissionStore.ts"],"sourcesContent":["import {\n\tPermissionContract,\n\tPermissionContractMap,\n} from '@sprucelabs/mercury-types'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport globby from 'globby'\nimport AbstractStore from '../../../stores/AbstractStore'\n\nexport default class PermissionStore extends AbstractStore {\n\tpublic name = 'permission'\n\n\tpublic async loadLocalPermissions() {\n\t\tconst matches = await globby('**/*.permissions.ts', {\n\t\t\tcwd: this.cwd,\n\t\t})\n\n\t\tconst namespace = this.Service('pkg').getSkillNamespace()\n\t\tconst imported: ImportedPermission[] = []\n\n\t\tfor (const file of matches) {\n\t\t\tconst path = diskUtil.resolvePath(this.cwd, file)\n\t\t\tconst contract = (await this.Service('import').importDefault(\n\t\t\t\tpath\n\t\t\t)) as PermissionContract\n\n\t\t\timported.push({\n\t\t\t\tid: `${namespace}.${contract.id}`,\n\t\t\t\tpermissions: contract.permissions.map((p) => p.id),\n\t\t\t\tpath,\n\t\t\t})\n\t\t}\n\n\t\treturn imported\n\t}\n\n\tpublic async fetchContracts() {\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\t\tconst deps = this.Service('dependency').get()\n\n\t\tconst local = await this.loadLocalPermissions()\n\t\tconst map: PermissionContractMap = local.reduce<PermissionContractMap>(\n\t\t\t(map, local) => {\n\t\t\t\tmap[local.id] = local.permissions\n\t\t\t\treturn map\n\t\t\t},\n\t\t\t{}\n\t\t)\n\n\t\tconst [{ permissionContracts }] = await client.emitAndFlattenResponses(\n\t\t\t'list-permission-contracts::v2020_12_25',\n\t\t\t{\n\t\t\t\ttarget: {\n\t\t\t\t\tnamespaces: deps.map((d) => d.namespace),\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\n\t\tfor (const result of permissionContracts) {\n\t\t\tmap[result.contract.id] = result.contract.permissions.map((p) => p.id)\n\t\t}\n\n\t\treturn map\n\t}\n}\n\nexport interface ImportedPermission {\n\tid: string\n\tpermissions: string[]\n\tpath: string\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AAIA;AACA;AACA;AAAyD;AAAA;AAAA;AAAA;AAAA;AAAA,IAEpCA,eAAe;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,yFACrB,YAAY;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,0GAE1B;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACuB,IAAAC,kBAAM,EAAC,qBAAqB,EAAE;kBACnDC,GAAG,EAAE,IAAI,CAACA;gBACX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9C,UAACT,GAAG,EAAEQ,KAAK,EAAK;kBACfR,GAAG,CAACQ,KAAK,CAACV,EAAE,CAAC,GAAGU,KAAK,CAACT,WAAW;kBACjC,OAAOC,GAAG;gBACX,CAAC,EACD,CAAC,CAAC,CACF;gBAAA;gBAAA,OAEuCI,MAAM,CAACM,uBAAuB,CACrE,wCAAwC,EACxC;kBACCC,MAAM,EAAE;oBACPC,UAAU,EAAEP,IAAI,CAACL,GAAG,CAAC,UAACa,CAAC;sBAAA,OAAKA,CAAC,CAAC1B,SAAS;oBAAA;kBACxC;gBACD,CAAC,CACD;cAAA;gBAAA;gBAAA;gBAPQ2B,mBAAmB,6BAAnBA,mBAAmB;gBAAA,wCASPA,mBAAmB;gBAAA;kBAAxC,uDAA0C;oBAA/BC,MAAM;oBAChBf,GAAG,CAACe,MAAM,CAACnB,QAAQ,CAACE,EAAE,CAAC,GAAGiB,MAAM,CAACnB,QAAQ,CAACG,WAAW,CAACC,GAAG,CAAC,UAACC,CAAC;sBAAA,OAAKA,CAAC,CAACH,EAAE;oBAAA,EAAC;kBACvE;gBAAC;kBAAA;gBAAA;kBAAA;gBAAA;gBAAA,kCAEME,GAAG;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACV;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EAtD2CgB,0BAAa;AAAA"}
1
+ {"version":3,"file":"PermissionStore.js","names":["PermissionStore","globby","cwd","matches","namespace","Service","getSkillNamespace","imported","file","path","diskUtil","resolvePath","importDefault","contract","push","id","permissions","map","p","options","shouldSyncCorePermissions","namespaces","connectToApi","shouldAuthAsCurrentSkill","client","deps","get","target","d","emitAndFlattenResponses","permissionContracts","loadLocalPermissions","local","reduce","result","AbstractStore"],"sources":["../../../../src/features/permission/stores/PermissionStore.ts"],"sourcesContent":["import {\n\tPermissionContract,\n\tPermissionContractMap,\n\tSpruceSchemas,\n} from '@sprucelabs/mercury-types'\nimport { diskUtil } from '@sprucelabs/spruce-skill-utils'\nimport globby from 'globby'\nimport AbstractStore from '../../../stores/AbstractStore'\n\nexport default class PermissionStore extends AbstractStore {\n\tpublic name = 'permission'\n\n\tpublic async loadLocalPermissions() {\n\t\tconst matches = await globby('**/*.permissions.ts', {\n\t\t\tcwd: this.cwd,\n\t\t})\n\n\t\tconst namespace = this.Service('pkg').getSkillNamespace()\n\t\tconst imported: ImportedPermission[] = []\n\n\t\tfor (const file of matches) {\n\t\t\tconst path = diskUtil.resolvePath(this.cwd, file)\n\t\t\tconst contract = (await this.Service('import').importDefault(\n\t\t\t\tpath\n\t\t\t)) as PermissionContract\n\n\t\t\timported.push({\n\t\t\t\tid: `${namespace}.${contract.id}`,\n\t\t\t\tpermissions: contract.permissions.map((p) => p.id),\n\t\t\t\tpath,\n\t\t\t})\n\t\t}\n\n\t\treturn imported\n\t}\n\n\tpublic async fetchContracts(options?: {\n\t\tshouldSyncCorePermissions?: boolean\n\t\tnamespaces?: string[]\n\t}) {\n\t\tconst { shouldSyncCorePermissions, namespaces } = options ?? {}\n\n\t\tlet target: ListPermContractsTargetAndPayload['target']\n\t\tconst client = await this.connectToApi({ shouldAuthAsCurrentSkill: true })\n\n\t\tif (!shouldSyncCorePermissions) {\n\t\t\tconst deps = this.Service('dependency').get()\n\t\t\ttarget = {\n\t\t\t\tnamespaces: namespaces ?? deps.map((d) => d.namespace),\n\t\t\t}\n\t\t}\n\n\t\tconst [{ permissionContracts }] = await client.emitAndFlattenResponses(\n\t\t\t'list-permission-contracts::v2020_12_25',\n\t\t\t{\n\t\t\t\ttarget,\n\t\t\t}\n\t\t)\n\n\t\tconst local = await this.loadLocalPermissions()\n\t\tconst map: PermissionContractMap = local.reduce<PermissionContractMap>(\n\t\t\t(map, local) => {\n\t\t\t\tmap[local.id] = local.permissions\n\t\t\t\treturn map\n\t\t\t},\n\t\t\t{} as any\n\t\t)\n\n\t\tfor (const result of permissionContracts) {\n\t\t\tmap[result.contract.id] = result.contract.permissions.map((p) => p.id)\n\t\t}\n\n\t\treturn map\n\t}\n}\n\nexport interface ImportedPermission {\n\tid: string\n\tpermissions: string[]\n\tpath: string\n}\n\nexport type ListPermContractsTargetAndPayload =\n\tSpruceSchemas.Mercury.v2020_12_25.ListPermissionContractsEmitTargetAndPayload\n"],"mappings":";;;;;;;;;;;;;;;;;AAKA;AACA;AACA;AAAyD;AAAA;AAAA;AAAA;AAAA;AAAA,IAEpCA,eAAe;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,yFACrB,YAAY;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,0GAE1B;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACuB,IAAAC,kBAAM,EAAC,qBAAqB,EAAE;kBACnDC,GAAG,EAAE,IAAI,CAACA;gBACX,CAAC,CAAC;cAAA;gBAFIC,OAAO;gBAIPC,SAAS,GAAG,IAAI,CAACC,OAAO,CAAC,KAAK,CAAC,CAACC,iBAAiB,EAAE;gBACnDC,QAA8B,GAAG,EAAE;gBAAA,uCAEtBJ,OAAO;gBAAA;gBAAA;cAAA;gBAAA;kBAAA;kBAAA;gBAAA;gBAAfK,IAAI;gBACRC,IAAI,GAAGC,0BAAQ,CAACC,WAAW,CAAC,IAAI,CAACT,GAAG,EAAEM,IAAI,CAAC;gBAAA;gBAAA,OACzB,IAAI,CAACH,OAAO,CAAC,QAAQ,CAAC,CAACO,aAAa,CAC3DH,IAAI,CACJ;cAAA;gBAFKI,QAAQ;gBAIdN,QAAQ,CAACO,IAAI,CAAC;kBACbC,EAAE,YAAKX,SAAS,cAAIS,QAAQ,CAACE,EAAE,CAAE;kBACjCC,WAAW,EAAEH,QAAQ,CAACG,WAAW,CAACC,GAAG,CAAC,UAACC,CAAC;oBAAA,OAAKA,CAAC,CAACH,EAAE;kBAAA,EAAC;kBAClDN,IAAI,EAAJA;gBACD,CAAC,CAAC;cAAA;gBAAA;gBAAA;cAAA;gBAAA;gBAAA;cAAA;gBAAA;gBAAA;gB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;oBAChBjB,GAAG,CAACiB,MAAM,CAACrB,QAAQ,CAACE,EAAE,CAAC,GAAGmB,MAAM,CAACrB,QAAQ,CAACG,WAAW,CAACC,GAAG,CAAC,UAACC,CAAC;sBAAA,OAAKA,CAAC,CAACH,EAAE;oBAAA,EAAC;kBACvE;gBAAC;kBAAA;gBAAA;kBAAA;gBAAA;gBAAA,kCAEME,GAAG;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACV;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EAhE2CkB,0BAAa;AAAA"}
@@ -2,7 +2,7 @@ import { PermissionContractMap } from '@sprucelabs/mercury-types';
2
2
  import AbstractWriter from '../../../writers/AbstractWriter';
3
3
  import { ImportedPermission } from '../stores/PermissionStore';
4
4
  export default class PermissionWriter extends AbstractWriter {
5
- writeTypesFile(destinationDir: string, map: PermissionContractMap): Promise<import("../../../writers/AbstractWriter").WriteResults>;
5
+ writeTypesFile(cwd: string, map: PermissionContractMap): Promise<import("../../../writers/AbstractWriter").WriteResults>;
6
6
  writeCombinedFile(destinationDir: string, options: {
7
7
  contracts: ImportedPermission[];
8
8
  }): Promise<import("../../../writers/AbstractWriter").WriteResults>;
@@ -26,13 +26,13 @@ var PermissionWriter = /*#__PURE__*/function (_AbstractWriter) {
26
26
  (0, _createClass2["default"])(PermissionWriter, [{
27
27
  key: "writeTypesFile",
28
28
  value: function () {
29
- var _writeTypesFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(destinationDir, map) {
29
+ var _writeTypesFile = (0, _asyncToGenerator2["default"])( /*#__PURE__*/_regenerator["default"].mark(function _callee(cwd, map) {
30
30
  var destination, contents, files;
31
31
  return _regenerator["default"].wrap(function _callee$(_context) {
32
32
  while (1) {
33
33
  switch (_context.prev = _context.next) {
34
34
  case 0:
35
- destination = _spruceSkillUtils.diskUtil.resolveHashSprucePath(destinationDir, 'permissions', 'permissions.types.ts');
35
+ destination = _spruceSkillUtils.diskUtil.resolveHashSprucePath(cwd, 'permissions', 'permissions.types.ts');
36
36
  contents = this.templates.permissionTypes({
37
37
  contracts: map
38
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"PermissionWriter.js","names":["PermissionWriter","destinationDir","map","destination","diskUtil","resolveHashSprucePath","contents","templates","permissionTypes","contracts","writeFileIfChangedMixinResults","files","options","destinationPath","destinationFile","resolvePath","local","c","nameCamel","namesUtil","toCamel","id","path","resolveRelativePath","replace","content","permissions","nameReadable","nameKebab","description","permissionContractBuilder","lint","cwd","pluginContents","permissionPlugin","results","AbstractWriter"],"sources":["../../../../src/features/permission/writers/PermissionWriter.ts"],"sourcesContent":["import { PermissionContractMap } from '@sprucelabs/mercury-types'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport AbstractWriter from '../../../writers/AbstractWriter'\nimport { ImportedPermission } from '../stores/PermissionStore'\n\nexport default class PermissionWriter extends AbstractWriter {\n\tpublic async writeTypesFile(\n\t\tdestinationDir: string,\n\t\tmap: PermissionContractMap\n\t) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tdestinationDir,\n\t\t\t'permissions',\n\t\t\t'permissions.types.ts'\n\t\t)\n\n\t\tconst contents = this.templates.permissionTypes({ contracts: map })\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontents,\n\t\t\t'Types file for any permission contracts you created or depend on.'\n\t\t)\n\n\t\treturn files\n\t}\n\n\tpublic async writeCombinedFile(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tcontracts: ImportedPermission[]\n\t\t}\n\t) {\n\t\tconst { contracts } = options\n\n\t\tconst destinationPath = diskUtil.resolveHashSprucePath(\n\t\t\tdestinationDir,\n\t\t\t'permissions'\n\t\t)\n\t\tconst destinationFile = diskUtil.resolvePath(\n\t\t\tdestinationPath,\n\t\t\t'permissions.ts'\n\t\t)\n\n\t\tconst local = contracts.map((c) => ({\n\t\t\tnameCamel: namesUtil.toCamel(c.id),\n\t\t\tpath: diskUtil.resolveRelativePath(\n\t\t\t\tdestinationPath,\n\t\t\t\tc.path.replace('.ts', '')\n\t\t\t),\n\t\t}))\n\n\t\tconst content = this.templates.permissions({ contracts: local })\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestinationFile,\n\t\t\tcontent,\n\t\t\t'Import of all permission contracts for loading on boot!'\n\t\t)\n\n\t\treturn files\n\t}\n\n\tpublic async writeContract(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tnameReadable: string\n\t\t\tnameKebab: string\n\t\t\tnameCamel: string\n\t\t\tdescription?: string\n\t\t}\n\t) {\n\t\tconst { nameReadable, nameKebab, nameCamel, description } = options\n\n\t\tconst destination = diskUtil.resolvePath(\n\t\t\tdestinationDir,\n\t\t\t`${nameKebab}.permissions.ts`\n\t\t)\n\n\t\tconst content = this.templates.permissionContractBuilder({\n\t\t\tnameCamel,\n\t\t\tnameKebab,\n\t\t\tdescription,\n\t\t\tnameReadable,\n\t\t})\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontent,\n\t\t\t'Your brand new permissions contract!'\n\t\t)\n\n\t\tawait this.lint(destination)\n\n\t\treturn files\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'permission.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.permissionPlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Enable permission support in your skill.'\n\t\t)\n\n\t\treturn results\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;AACA;AAA4D;AAAA;AAAA,IAGvCA,gBAAgB;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,oGACpC,iBACCC,cAAsB,EACtBC,GAA0B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C,2BAAc;AAAA"}
1
+ {"version":3,"file":"PermissionWriter.js","names":["PermissionWriter","cwd","map","destination","diskUtil","resolveHashSprucePath","contents","templates","permissionTypes","contracts","writeFileIfChangedMixinResults","files","destinationDir","options","destinationPath","destinationFile","resolvePath","local","c","nameCamel","namesUtil","toCamel","id","path","resolveRelativePath","replace","content","permissions","nameReadable","nameKebab","description","permissionContractBuilder","lint","pluginContents","permissionPlugin","results","AbstractWriter"],"sources":["../../../../src/features/permission/writers/PermissionWriter.ts"],"sourcesContent":["import { PermissionContractMap } from '@sprucelabs/mercury-types'\nimport { diskUtil, namesUtil } from '@sprucelabs/spruce-skill-utils'\nimport AbstractWriter from '../../../writers/AbstractWriter'\nimport { ImportedPermission } from '../stores/PermissionStore'\n\nexport default class PermissionWriter extends AbstractWriter {\n\tpublic async writeTypesFile(cwd: string, map: PermissionContractMap) {\n\t\tconst destination = diskUtil.resolveHashSprucePath(\n\t\t\tcwd,\n\t\t\t'permissions',\n\t\t\t'permissions.types.ts'\n\t\t)\n\n\t\tconst contents = this.templates.permissionTypes({ contracts: map })\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontents,\n\t\t\t'Types file for any permission contracts you created or depend on.'\n\t\t)\n\n\t\treturn files\n\t}\n\n\tpublic async writeCombinedFile(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tcontracts: ImportedPermission[]\n\t\t}\n\t) {\n\t\tconst { contracts } = options\n\n\t\tconst destinationPath = diskUtil.resolveHashSprucePath(\n\t\t\tdestinationDir,\n\t\t\t'permissions'\n\t\t)\n\t\tconst destinationFile = diskUtil.resolvePath(\n\t\t\tdestinationPath,\n\t\t\t'permissions.ts'\n\t\t)\n\n\t\tconst local = contracts.map((c) => ({\n\t\t\tnameCamel: namesUtil.toCamel(c.id),\n\t\t\tpath: diskUtil.resolveRelativePath(\n\t\t\t\tdestinationPath,\n\t\t\t\tc.path.replace('.ts', '')\n\t\t\t),\n\t\t}))\n\n\t\tconst content = this.templates.permissions({ contracts: local })\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestinationFile,\n\t\t\tcontent,\n\t\t\t'Import of all permission contracts for loading on boot!'\n\t\t)\n\n\t\treturn files\n\t}\n\n\tpublic async writeContract(\n\t\tdestinationDir: string,\n\t\toptions: {\n\t\t\tnameReadable: string\n\t\t\tnameKebab: string\n\t\t\tnameCamel: string\n\t\t\tdescription?: string\n\t\t}\n\t) {\n\t\tconst { nameReadable, nameKebab, nameCamel, description } = options\n\n\t\tconst destination = diskUtil.resolvePath(\n\t\t\tdestinationDir,\n\t\t\t`${nameKebab}.permissions.ts`\n\t\t)\n\n\t\tconst content = this.templates.permissionContractBuilder({\n\t\t\tnameCamel,\n\t\t\tnameKebab,\n\t\t\tdescription,\n\t\t\tnameReadable,\n\t\t})\n\n\t\tconst files = await this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tcontent,\n\t\t\t'Your brand new permissions contract!'\n\t\t)\n\n\t\tawait this.lint(destination)\n\n\t\treturn files\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'permission.plugin.ts'\n\t\t)\n\n\t\tconst pluginContents = this.templates.permissionPlugin()\n\n\t\tconst results = this.writeFileIfChangedMixinResults(\n\t\t\tdestination,\n\t\t\tpluginContents,\n\t\t\t'Enable permission support in your skill.'\n\t\t)\n\n\t\treturn results\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;AACA;AACA;AAA4D;AAAA;AAAA,IAGvCA,gBAAgB;EAAA;EAAA;EAAA;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,oGACpC,iBAA4BC,GAAW,EAAEC,GAA0B;QAAA;QAAA;UAAA;YAAA;cAAA;gBAC5DC,WAAW,GAAGC,0BAAQ,CAACC,qBAAqB,CACjDJ,GAAG,EACH,aAAa,EACb,sBAAsB,CACtB;gB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CC,cAAsB,EACtBC,OAKC;QAAA;QAAA;UAAA;YAAA;cAAA;gBAEOe,YAAY,GAAwCf,OAAO,CAA3De,YAAY,EAAEC,SAAS,GAA6BhB,OAAO,CAA7CgB,SAAS,EAAEV,SAAS,GAAkBN,OAAO,CAAlCM,SAAS,EAAEW,WAAW,GAAKjB,OAAO,CAAvBiB,WAAW;gBAEjD3B,WAAW,GAAGC,0BAAQ,CAACY,WAAW,CACvCJ,cAAc,YACXiB,SAAS,qBACZ;gBAEKH,OAAO,GAAG,IAAI,CAACnB,SAAS,CAACwB,yBAAyB,CAAC;kBACxDZ,SAAS,EAATA,SAAS;kBACTU,SAAS,EAATA,SAAS;kBACTC,WAAW,EAAXA,WAAW;kBACXF,YAAY,EAAZA;gBACD,CAAC,CAAC;gBAAA;gBAAA,OAEkB,IAAI,CAAClB,8BAA8B,CACtDP,WAAW,EACXuB,OAAO,EACP,sCAAsC,CACtC;cAAA;gBAJKf,KAAK;gBAAA;gBAAA,OAML,IAAI,CAACqB,IAAI,CAAC7B,WAAW,CAAC;cAAA;gBAAA,kCAErBQ,KAAK;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACZ;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA,OAED,qBAAmBV,GAAW,EAAE;MAC/B,IAAME,WAAW,GAAGC,0BAAQ,CAACC,qBAAqB,CACjDJ,GAAG,EACH,UAAU,EACV,sBAAsB,CACtB;MAED,IAAMgC,cAAc,GAAG,IAAI,CAAC1B,SAAS,CAAC2B,gBAAgB,EAAE;MAExD,IAAMC,OAAO,GAAG,IAAI,CAACzB,8BAA8B,CAClDP,WAAW,EACX8B,cAAc,EACd,0CAA0C,CAC1C;MAED,OAAOE,OAAO;IACf;EAAC;EAAA;AAAA,EAzG4CC,2BAAc;AAAA"}
@@ -58,7 +58,7 @@ var WatchAction = /*#__PURE__*/function (_AbstractAction) {
58
58
  this.resetUi();
59
59
  commands = this.Service('command');
60
60
  _context.next = 8;
61
- return commands.execute('ENABLED_SKILL_FEATURES=view,event SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot', {
61
+ return commands.execute('SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot', {
62
62
  onData: function onData(data) {
63
63
  var line = _this2.popLastLine(data);
64
64
  _this2.ui.startLoading(line);
@@ -1 +1 @@
1
- {"version":3,"file":"WatchAction.js","names":["optionsSchema","buildSchema","id","description","fields","WatchAction","Store","loadCurrentSkill","skill","skillName","name","resetUi","commands","Service","execute","onData","data","line","popLastLine","ui","startLoading","summaryLines","trim","split","filter","s","pop","length","remote","getRemote","heartwoodRemoteUtil","buildUrl","clear","renderHero","renderDivider","renderLines","getPreviewUrl","renderLine","AbstractAction"],"sources":["../../../../src/features/view/actions/WatchAction.ts"],"sourcesContent":["import { buildSchema } from '@sprucelabs/schema'\nimport { heartwoodRemoteUtil } from '@sprucelabs/spruce-event-utils'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'watchViewsOptions',\n\tdescription: 'Watch for view changes and preview them in real time.',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\n\nexport default class WatchAction extends AbstractAction<OptionsSchema> {\n\tpublic commandAliases = ['watch.views']\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic invocationMessage = 'Watching views... 🤩'\n\tprivate skillName!: string\n\n\tpublic async execute(): Promise<FeatureActionResponse> {\n\t\tconst skill = await this.Store('skill').loadCurrentSkill()\n\t\tthis.skillName = skill.name\n\n\t\tthis.resetUi()\n\t\tconst commands = this.Service('command')\n\t\tawait commands.execute(\n\t\t\t'ENABLED_SKILL_FEATURES=view,event SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot',\n\t\t\t{\n\t\t\t\tonData: (data) => {\n\t\t\t\t\tconst line = this.popLastLine(data)\n\t\t\t\t\tthis.ui.startLoading(line)\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\n\t\treturn {\n\t\t\tsummaryLines: [`Done watching...`],\n\t\t}\n\t}\n\n\tprivate popLastLine(data: string) {\n\t\tconst line = data\n\t\t\t.trim()\n\t\t\t.split('\\n')\n\t\t\t.filter((s) => !!s)\n\t\t\t.pop()\n\n\t\treturn line && line.length > 0 ? line.trim() : 'Waiting for changes'\n\t}\n\n\tprivate getPreviewUrl() {\n\t\tconst remote = this.Service('remote').getRemote() as any\n\t\treturn heartwoodRemoteUtil.buildUrl(remote) + '/#views/heartwood.watch'\n\t}\n\n\tprivate resetUi() {\n\t\tthis.ui.clear()\n\t\tthis.ui.renderHero('Heartwood')\n\t\tthis.ui.renderDivider()\n\t\tthis.ui.renderLines([\n\t\t\t'',\n\t\t\t`Skill: ${this.skillName}`,\n\t\t\t`Preview: ${this.getPreviewUrl()}`,\n\t\t\t'',\n\t\t])\n\t\tthis.ui.renderDivider()\n\t\tthis.ui.renderLine('')\n\t\tthis.ui.startLoading('Watching for changes')\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAAiD;AAAA;AAGjD,IAAMA,aAAa,GAAG,IAAAC,mBAAW,EAAC;EACjCC,EAAE,EAAE,mBAAmB;EACvBC,WAAW,EAAE,uDAAuD;EACpEC,MAAM,EAAE,CAAC;AACV,CAAC,CAAC;AAAA,IAImBC,WAAW;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,mGACP,CAAC,aAAa,CAAC;IAAA,kGACDL,aAAa;IAAA,sGACxB,sBAAsB;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,6FAGjD;QAAA;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACqB,IAAI,CAACM,KAAK,CAAC,OAAO,CAAC,CAACC,gBAAgB,EAAE;cAAA;gBAApDC,KAAK;gBACX,IAAI,CAACC,SAAS,GA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I,CAAC1B,SAAS,sBACZ,IAAI,CAAC2B,aAAa,EAAE,GAChC,EAAE,CACF,CAAC;MACF,IAAI,CAACjB,EAAE,CAACe,aAAa,EAAE;MACvB,IAAI,CAACf,EAAE,CAACkB,UAAU,CAAC,EAAE,CAAC;MACtB,IAAI,CAAClB,EAAE,CAACC,YAAY,CAAC,sBAAsB,CAAC;IAC7C;EAAC;EAAA;AAAA,EAvDuCkB,2BAAc;AAAA"}
1
+ {"version":3,"file":"WatchAction.js","names":["optionsSchema","buildSchema","id","description","fields","WatchAction","Store","loadCurrentSkill","skill","skillName","name","resetUi","commands","Service","execute","onData","data","line","popLastLine","ui","startLoading","summaryLines","trim","split","filter","s","pop","length","remote","getRemote","heartwoodRemoteUtil","buildUrl","clear","renderHero","renderDivider","renderLines","getPreviewUrl","renderLine","AbstractAction"],"sources":["../../../../src/features/view/actions/WatchAction.ts"],"sourcesContent":["import { buildSchema } from '@sprucelabs/schema'\nimport { heartwoodRemoteUtil } from '@sprucelabs/spruce-event-utils'\nimport AbstractAction from '../../AbstractAction'\nimport { FeatureActionResponse } from '../../features.types'\n\nconst optionsSchema = buildSchema({\n\tid: 'watchViewsOptions',\n\tdescription: 'Watch for view changes and preview them in real time.',\n\tfields: {},\n})\n\ntype OptionsSchema = typeof optionsSchema\n\nexport default class WatchAction extends AbstractAction<OptionsSchema> {\n\tpublic commandAliases = ['watch.views']\n\tpublic optionsSchema: OptionsSchema = optionsSchema\n\tpublic invocationMessage = 'Watching views... 🤩'\n\tprivate skillName!: string\n\n\tpublic async execute(): Promise<FeatureActionResponse> {\n\t\tconst skill = await this.Store('skill').loadCurrentSkill()\n\t\tthis.skillName = skill.name\n\n\t\tthis.resetUi()\n\t\tconst commands = this.Service('command')\n\t\tawait commands.execute(\n\t\t\t'SHOULD_WATCH_VIEWS=true MAXIMUM_LOG_PREFIXES_LENGTH=0 yarn boot',\n\t\t\t{\n\t\t\t\tonData: (data) => {\n\t\t\t\t\tconst line = this.popLastLine(data)\n\t\t\t\t\tthis.ui.startLoading(line)\n\t\t\t\t},\n\t\t\t}\n\t\t)\n\n\t\treturn {\n\t\t\tsummaryLines: [`Done watching...`],\n\t\t}\n\t}\n\n\tprivate popLastLine(data: string) {\n\t\tconst line = data\n\t\t\t.trim()\n\t\t\t.split('\\n')\n\t\t\t.filter((s) => !!s)\n\t\t\t.pop()\n\n\t\treturn line && line.length > 0 ? line.trim() : 'Waiting for changes'\n\t}\n\n\tprivate getPreviewUrl() {\n\t\tconst remote = this.Service('remote').getRemote() as any\n\t\treturn heartwoodRemoteUtil.buildUrl(remote) + '/#views/heartwood.watch'\n\t}\n\n\tprivate resetUi() {\n\t\tthis.ui.clear()\n\t\tthis.ui.renderHero('Heartwood')\n\t\tthis.ui.renderDivider()\n\t\tthis.ui.renderLines([\n\t\t\t'',\n\t\t\t`Skill: ${this.skillName}`,\n\t\t\t`Preview: ${this.getPreviewUrl()}`,\n\t\t\t'',\n\t\t])\n\t\tthis.ui.renderDivider()\n\t\tthis.ui.renderLine('')\n\t\tthis.ui.startLoading('Watching for changes')\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AACA;AACA;AAAiD;AAAA;AAGjD,IAAMA,aAAa,GAAG,IAAAC,mBAAW,EAAC;EACjCC,EAAE,EAAE,mBAAmB;EACvBC,WAAW,EAAE,uDAAuD;EACpEC,MAAM,EAAE,CAAC;AACV,CAAC,CAAC;AAAA,IAImBC,WAAW;EAAA;EAAA;EAAA;IAAA;IAAA;IAAA;MAAA;IAAA;IAAA;IAAA,mGACP,CAAC,aAAa,CAAC;IAAA,kGACDL,aAAa;IAAA,sGACxB,sBAAsB;IAAA;IAAA;EAAA;EAAA;IAAA;IAAA;MAAA,6FAGjD;QAAA;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA;gBAAA,OACqB,IAAI,CAACM,KAAK,CAAC,OAAO,CAAC,CAACC,gBAAgB,EAAE;cAAA;gBAApDC,KAAK;gBACX,IAAI,CAACC,SAAS,GAAGD,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