@sprucelabs/spruce-cli 18.3.1 → 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.
- package/CHANGELOG.md +6 -0
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js +2 -14
- package/build/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/PermissionStore.test.js.map +1 -1
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.d.ts +1 -0
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js +53 -18
- package/build/__tests__/behavioral/permissions/SyncingPermissions.test.js.map +1 -1
- package/build/__tests__/behavioral/views/WatchingSkillViews.test.js +1 -1
- package/build/__tests__/behavioral/views/WatchingSkillViews.test.js.map +1 -1
- package/build/__tests__/support/EventFaker.d.ts +1 -1
- package/build/__tests__/support/EventFaker.js.map +1 -1
- package/build/features/eventContract/EventContractFeature.js +1 -4
- package/build/features/eventContract/EventContractFeature.js.map +1 -1
- package/build/features/eventContract/actions/PullAction.d.ts +1 -0
- package/build/features/eventContract/actions/PullAction.js +49 -8
- package/build/features/eventContract/actions/PullAction.js.map +1 -1
- package/build/features/permission/PermissionFeature.js +19 -9
- package/build/features/permission/PermissionFeature.js.map +1 -1
- package/build/features/permission/actions/SyncAction.d.ts +22 -3
- package/build/features/permission/actions/SyncAction.js +58 -16
- package/build/features/permission/actions/SyncAction.js.map +1 -1
- package/build/features/permission/stores/PermissionStore.d.ts +6 -2
- package/build/features/permission/stores/PermissionStore.js +25 -21
- package/build/features/permission/stores/PermissionStore.js.map +1 -1
- package/build/features/view/actions/WatchAction.js +1 -1
- package/build/features/view/actions/WatchAction.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/README.md +6 -300
- package/node_modules/@typescript-eslint/parser/dist/parser.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/parser/dist/parser.js +15 -17
- package/node_modules/@typescript-eslint/parser/dist/parser.js.map +1 -1
- package/node_modules/@typescript-eslint/parser/package.json +5 -5
- package/node_modules/@typescript-eslint/scope-manager/README.md +5 -117
- package/node_modules/@typescript-eslint/scope-manager/package.json +5 -5
- package/node_modules/@typescript-eslint/types/README.md +6 -11
- package/node_modules/@typescript-eslint/types/package.json +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/README.md +6 -379
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/create-program/{createWatchProgram.d.ts → getWatchProgramsForProjects.d.ts} +3 -4
- package/node_modules/@typescript-eslint/typescript-estree/_ts3.4/dist/index.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js +3 -3
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createProjectProgram.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/{createWatchProgram.d.ts → getWatchProgramsForProjects.d.ts} +3 -4
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/getWatchProgramsForProjects.d.ts.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/{createWatchProgram.js → getWatchProgramsForProjects.js} +4 -5
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/getWatchProgramsForProjects.js.map +1 -0
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.d.ts.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/dist/index.js.map +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/parseSettings/warnAboutTSVersion.js +2 -2
- package/node_modules/@typescript-eslint/typescript-estree/package.json +5 -5
- package/node_modules/@typescript-eslint/visitor-keys/README.md +6 -9
- package/node_modules/@typescript-eslint/visitor-keys/package.json +3 -3
- package/package.json +3 -3
- package/src/__tests__/behavioral/eventContract/PullingMercuryEventContract.test.ts +0 -5
- package/src/__tests__/behavioral/permissions/PermissionStore.test.ts +1 -1
- package/src/__tests__/behavioral/permissions/SyncingPermissions.test.ts +21 -3
- package/src/__tests__/behavioral/views/WatchingSkillViews.test.ts +1 -1
- package/src/__tests__/support/EventFaker.ts +1 -2
- package/src/features/eventContract/EventContractFeature.ts +1 -6
- package/src/features/eventContract/actions/PullAction.ts +21 -3
- package/src/features/permission/PermissionFeature.ts +2 -7
- package/src/features/permission/actions/SyncAction.ts +42 -5
- package/src/features/permission/stores/PermissionStore.ts +25 -11
- package/src/features/view/actions/WatchAction.ts +1 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.d.ts.map +0 -1
- package/node_modules/@typescript-eslint/typescript-estree/dist/create-program/createWatchProgram.js.map +0 -1
|
@@ -57,23 +57,33 @@ var PermissionFeature = /*#__PURE__*/function (_AbstractFeature) {
|
|
|
57
57
|
return this.features.isInstalled('skill');
|
|
58
58
|
case 6:
|
|
59
59
|
isSkillInstalled = _context.sent;
|
|
60
|
-
if (!(
|
|
61
|
-
_context.next =
|
|
60
|
+
if (!(isInstalled && featureCode === 'node' && actionCode === 'upgrade')) {
|
|
61
|
+
_context.next = 21;
|
|
62
62
|
break;
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
if (!isSkillInstalled) {
|
|
65
|
+
_context.next = 14;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
_context.next = 11;
|
|
65
69
|
return this.writePlugin();
|
|
66
|
-
case
|
|
67
|
-
|
|
68
|
-
_context.next =
|
|
70
|
+
case 11:
|
|
71
|
+
_context.t0 = _context.sent;
|
|
72
|
+
_context.next = 15;
|
|
73
|
+
break;
|
|
74
|
+
case 14:
|
|
75
|
+
_context.t0 = [];
|
|
76
|
+
case 15:
|
|
77
|
+
combinedFile = _context.t0;
|
|
78
|
+
_context.next = 18;
|
|
69
79
|
return this.Action('permission', 'sync').execute({});
|
|
70
|
-
case
|
|
80
|
+
case 18:
|
|
71
81
|
results = _context.sent;
|
|
72
82
|
results.files = [].concat((0, _toConsumableArray2["default"])((_results$files = results.files) !== null && _results$files !== void 0 ? _results$files : []), (0, _toConsumableArray2["default"])(combinedFile));
|
|
73
83
|
return _context.abrupt("return", results);
|
|
74
|
-
case
|
|
84
|
+
case 21:
|
|
75
85
|
return _context.abrupt("return", {});
|
|
76
|
-
case
|
|
86
|
+
case 22:
|
|
77
87
|
case "end":
|
|
78
88
|
return _context.stop();
|
|
79
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PermissionFeature.js","names":["PermissionFeature","options","diskUtil","resolvePath","__dirname","name","writer","Writer","emitter","on","handleDidExecuteAction","bind","featureCode","actionCode","features","isInstalled","isSkillInstalled","writePlugin","combinedFile","Action","execute","results","files","writeTypesFile","cwd","AbstractFeature"],"sources":["../../../src/features/permission/PermissionFeature.ts"],"sourcesContent":["import { PermissionContractMap } from '@sprucelabs/mercury-types'\nimport { diskUtil, NpmPackage } from '@sprucelabs/spruce-skill-utils'\nimport AbstractFeature, {\n\tFeatureDependency,\n\tFeatureOptions,\n\tInstallResults,\n} from '../AbstractFeature'\nimport { FeatureCode } from '../features.types'\nimport PermissionWriter from './writers/PermissionWriter'\n\nexport default class PermissionFeature extends AbstractFeature {\n\tpublic code: FeatureCode = 'permission'\n\tpublic nameReadable = 'permission'\n\tpublic description = 'Manage permissions for your skill'\n\tpublic dependencies: FeatureDependency[] = []\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\tpublic packageDependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: '@sprucelabs/spruce-permission-plugin@latest',\n\t\t},\n\t]\n\tprivate writer: PermissionWriter\n\n\tpublic constructor(options: FeatureOptions) {\n\t\tsuper(options)\n\t\tthis.writer = this.Writer('permission')\n\n\t\tvoid this.emitter.on(\n\t\t\t'feature.did-execute',\n\t\t\tthis.handleDidExecuteAction.bind(this)\n\t\t)\n\t}\n\n\tpublic async handleDidExecuteAction({\n\t\tfeatureCode,\n\t\tactionCode,\n\t}: {\n\t\tfeatureCode: string\n\t\tactionCode: string\n\t}) {\n\t\tconst isInstalled = await this.features.isInstalled('permission')\n\t\tconst isSkillInstalled = await this.features.isInstalled('skill')\n\n\t\tif (
|
|
1
|
+
{"version":3,"file":"PermissionFeature.js","names":["PermissionFeature","options","diskUtil","resolvePath","__dirname","name","writer","Writer","emitter","on","handleDidExecuteAction","bind","featureCode","actionCode","features","isInstalled","isSkillInstalled","writePlugin","combinedFile","Action","execute","results","files","writeTypesFile","cwd","AbstractFeature"],"sources":["../../../src/features/permission/PermissionFeature.ts"],"sourcesContent":["import { PermissionContractMap } from '@sprucelabs/mercury-types'\nimport { diskUtil, NpmPackage } from '@sprucelabs/spruce-skill-utils'\nimport AbstractFeature, {\n\tFeatureDependency,\n\tFeatureOptions,\n\tInstallResults,\n} from '../AbstractFeature'\nimport { FeatureCode } from '../features.types'\nimport PermissionWriter from './writers/PermissionWriter'\n\nexport default class PermissionFeature extends AbstractFeature {\n\tpublic code: FeatureCode = 'permission'\n\tpublic nameReadable = 'permission'\n\tpublic description = 'Manage permissions for your skill'\n\tpublic dependencies: FeatureDependency[] = []\n\tpublic actionsDir = diskUtil.resolvePath(__dirname, 'actions')\n\tpublic packageDependencies: NpmPackage[] = [\n\t\t{\n\t\t\tname: '@sprucelabs/spruce-permission-plugin@latest',\n\t\t},\n\t]\n\tprivate writer: PermissionWriter\n\n\tpublic constructor(options: FeatureOptions) {\n\t\tsuper(options)\n\t\tthis.writer = this.Writer('permission')\n\n\t\tvoid this.emitter.on(\n\t\t\t'feature.did-execute',\n\t\t\tthis.handleDidExecuteAction.bind(this)\n\t\t)\n\t}\n\n\tpublic async handleDidExecuteAction({\n\t\tfeatureCode,\n\t\tactionCode,\n\t}: {\n\t\tfeatureCode: string\n\t\tactionCode: string\n\t}) {\n\t\tconst isInstalled = await this.features.isInstalled('permission')\n\t\tconst isSkillInstalled = await this.features.isInstalled('skill')\n\n\t\tif (isInstalled && featureCode === 'node' && actionCode === 'upgrade') {\n\t\t\tconst combinedFile = isSkillInstalled ? await this.writePlugin() : []\n\t\t\tconst results = await this.Action('permission', 'sync').execute({})\n\n\t\t\tresults.files = [...(results.files ?? []), ...combinedFile]\n\t\t\treturn results\n\t\t}\n\n\t\treturn {}\n\t}\n\n\tpublic async afterPackageInstall(): Promise<InstallResults> {\n\t\tconst files = await this.writePlugin()\n\t\tconst combinedFile = await this.writeTypesFile()\n\n\t\treturn {\n\t\t\tfiles: [...files, ...combinedFile],\n\t\t}\n\t}\n\n\tprivate async writeTypesFile() {\n\t\treturn await this.writer.writeTypesFile(\n\t\t\tthis.cwd,\n\t\t\t{} as PermissionContractMap\n\t\t)\n\t}\n\n\tprivate async writePlugin() {\n\t\treturn this.writer.writePlugin(this.cwd)\n\t}\n}\n\ndeclare module '../../features/features.types' {\n\tinterface FeatureMap {\n\t\tpermission: PermissionFeature\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;AACA;AACA;AAI2B;AAAA;AAAA,IAINA,iBAAiB;EAAA;EAAA;EAarC,2BAAmBC,OAAuB,EAAE;IAAA;IAAA;IAC3C,0BAAMA,OAAO;IAAC,yFAbY,YAAY;IAAA,iGACjB,YAAY;IAAA,gGACb,mCAAmC;IAAA,iGACb,EAAE;IAAA,+FACzBC,0BAAQ,CAACC,WAAW,CAACC,SAAS,EAAE,SAAS,CAAC;IAAA,wGACnB,CAC1C;MACCC,IAAI,EAAE;IACP,CAAC,CACD;IAAA;IAKA,MAAKC,MAAM,GAAG,MAAKC,MAAM,CAAC,YAAY,CAAC;IAEvC,KAAK,MAAKC,OAAO,CAACC,EAAE,CACnB,qBAAqB,EACrB,MAAKC,sBAAsB,CAACC,IAAI,gDAAM,CACtC;IAAA;EACF;EAAC;IAAA;IAAA;MAAA,4GAED;QAAA;QAAA;UAAA;YAAA;cAAA;gBACCC,WAAW,QAAXA,WAAW,EACXC,UAAU,QAAVA,UAAU;gBAAA;gBAAA,OAKgB,IAAI,CAACC,QAAQ,CAACC,WAAW,CAAC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BAAA;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACD;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;IAAA;IAAA;MAAA,iGAED;QAAA;UAAA;YAAA;cAAA;gBAAA,kCACQ,IAAI,CAAClB,MAAM,CAACW,WAAW,CAAC,IAAI,CAACO,GAAG,CAAC;cAAA;cAAA;gBAAA;YAAA;UAAA;QAAA;MAAA,CACxC;MAAA;QAAA;MAAA;MAAA;IAAA;EAAA;EAAA;AAAA,EA9D6CC,4BAAe;AAAA"}
|
|
@@ -1,20 +1,39 @@
|
|
|
1
|
+
import { SchemaValues } from '@sprucelabs/schema';
|
|
1
2
|
import AbstractAction from '../../AbstractAction';
|
|
2
3
|
import { ActionOptions, FeatureActionResponse } from '../../features.types';
|
|
4
|
+
import PermissionStore from '../stores/PermissionStore';
|
|
5
|
+
import PermissionWriter from '../writers/PermissionWriter';
|
|
3
6
|
export default class SyncAction extends AbstractAction<OptionsSchema> {
|
|
4
7
|
invocationMessage: string;
|
|
5
8
|
optionsSchema: {
|
|
6
9
|
id: string;
|
|
7
|
-
fields: {
|
|
10
|
+
fields: {
|
|
11
|
+
shouldSyncCorePermissions: {
|
|
12
|
+
type: "boolean";
|
|
13
|
+
};
|
|
14
|
+
};
|
|
8
15
|
};
|
|
9
16
|
readonly commandAliases: string[];
|
|
10
17
|
private permissions;
|
|
11
18
|
private writer;
|
|
12
19
|
constructor(options: ActionOptions);
|
|
13
|
-
execute(): Promise<FeatureActionResponse>;
|
|
20
|
+
execute(options?: SyncPermissionsOptions): Promise<FeatureActionResponse>;
|
|
14
21
|
}
|
|
15
22
|
declare const schema: {
|
|
16
23
|
id: string;
|
|
17
|
-
fields: {
|
|
24
|
+
fields: {
|
|
25
|
+
shouldSyncCorePermissions: {
|
|
26
|
+
type: "boolean";
|
|
27
|
+
};
|
|
28
|
+
};
|
|
18
29
|
};
|
|
19
30
|
declare type OptionsSchema = typeof schema;
|
|
31
|
+
export declare type SyncPermissionsOptions = SchemaValues<OptionsSchema>;
|
|
32
|
+
export declare function writePermissionTypesFile(options: {
|
|
33
|
+
permissions: PermissionStore;
|
|
34
|
+
shouldSyncCorePermissions: boolean | undefined;
|
|
35
|
+
namespaces?: string[];
|
|
36
|
+
writer: PermissionWriter;
|
|
37
|
+
cwd: string;
|
|
38
|
+
}): Promise<import("../../../writers/AbstractWriter").WriteResults>;
|
|
20
39
|
export {};
|
|
@@ -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
|
|
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
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
_context.next =
|
|
52
|
-
return
|
|
53
|
-
|
|
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 =
|
|
61
|
+
_context.next = 9;
|
|
56
62
|
return this.permissions.loadLocalPermissions();
|
|
57
|
-
case
|
|
63
|
+
case 9:
|
|
58
64
|
local = _context.sent;
|
|
59
|
-
_context.next =
|
|
65
|
+
_context.next = 12;
|
|
60
66
|
return this.writer.writeCombinedFile(this.cwd, {
|
|
61
67
|
contracts: local
|
|
62
68
|
});
|
|
63
|
-
case
|
|
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
|
|
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","
|
|
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;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,iBACCL,OAAgC;QAAA;QAAA;UAAA;YAAA;cAAA;gBAAA,wBAEM,IAAI,CAACM,2BAA2B,CACrEN,OAAO,aAAPA,OAAO,cAAPA,OAAO,GAAI,CAAC,CAAC,CACb,EAFOO,yBAAyB,yBAAzBA,yBAAyB;gBAI3BL,WAAW,GAAG,IAAI,CAACA,WAAW;gBAC9BE,MAAM,GAAG,IAAI,CAACA,MAAM;gBACpBI,GAAG,GAAG,IAAI,CAACA,GAAG;gBAAA;gBAAA,OAEKC,wBAAwB,CAAC;kBACjDP,WAAW,EAAXA,WAAW;kBACXK,yBAAyB,EAAzBA,yBAAyB;kBACzBH,MAAM,EAANA,MA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TA,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(
|
|
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
|
|
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
|
-
|
|
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
|
|
119
|
+
case 3:
|
|
119
120
|
client = _context2.sent;
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
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
|
|
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
|
|
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","
|
|
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.ListPermissionContractsEmitTargetAndP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AACH,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"}
|
|
@@ -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('
|
|
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'
|
|
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,KAAK,CAACE,IAAI;gBAE3B,IAAI,CAACC,OAAO,EAAE;gBACRC,QAAQ,GAAG,IAAI,CAACC,OAAO,CAAC,SAAS,CAAC;gBAAA;gBA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