@appsemble/cli 0.20.13 → 0.20.15

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 (190) hide show
  1. package/README.md +4 -4
  2. package/__fixtures__/getBlockConfigFromTypeScript/comments/tsconfig.json +1 -1
  3. package/__fixtures__/getBlockConfigFromTypeScript/duplicateActions/tsconfig.json +1 -1
  4. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventEmitters/tsconfig.json +1 -1
  5. package/__fixtures__/getBlockConfigFromTypeScript/duplicateEventListeners/tsconfig.json +1 -1
  6. package/__fixtures__/getBlockConfigFromTypeScript/duplicateParameters/tsconfig.json +1 -1
  7. package/__fixtures__/getBlockConfigFromTypeScript/fontawesomeParameters/tsconfig.json +1 -1
  8. package/__fixtures__/getBlockConfigFromTypeScript/tsError/tsconfig.json +1 -1
  9. package/__fixtures__/getBlockConfigFromTypeScript/valid/tsconfig.json +1 -1
  10. package/commands/app/create.d.ts +1 -1
  11. package/commands/app/create.js +16 -24
  12. package/commands/app/create.js.map +1 -1
  13. package/commands/app/create.ts +3 -3
  14. package/commands/app/extract-messages.d.ts +1 -1
  15. package/commands/app/extract-messages.js +12 -20
  16. package/commands/app/extract-messages.js.map +1 -1
  17. package/commands/app/extract-messages.ts +2 -2
  18. package/commands/app/index.js +12 -36
  19. package/commands/app/index.js.map +1 -1
  20. package/commands/app/index.ts +9 -5
  21. package/commands/app/update.d.ts +1 -1
  22. package/commands/app/update.js +18 -26
  23. package/commands/app/update.js.map +1 -1
  24. package/commands/app/update.ts +4 -4
  25. package/commands/asset/create.d.ts +1 -1
  26. package/commands/asset/create.js +20 -28
  27. package/commands/asset/create.js.map +1 -1
  28. package/commands/asset/create.ts +4 -4
  29. package/commands/asset/index.js +5 -33
  30. package/commands/asset/index.js.map +1 -1
  31. package/commands/asset/index.ts +3 -3
  32. package/commands/block/build.d.ts +1 -1
  33. package/commands/block/build.js +14 -22
  34. package/commands/block/build.js.map +1 -1
  35. package/commands/block/build.ts +2 -2
  36. package/commands/block/extract-messages.d.ts +1 -1
  37. package/commands/block/extract-messages.js +15 -23
  38. package/commands/block/extract-messages.js.map +1 -1
  39. package/commands/block/extract-messages.ts +2 -2
  40. package/commands/block/index.js +12 -36
  41. package/commands/block/index.js.map +1 -1
  42. package/commands/block/index.ts +9 -5
  43. package/commands/block/publish.d.ts +1 -1
  44. package/commands/block/publish.js +17 -25
  45. package/commands/block/publish.js.map +1 -1
  46. package/commands/block/publish.ts +3 -3
  47. package/commands/cleanupResources.d.ts +1 -1
  48. package/commands/cleanupResources.js +6 -11
  49. package/commands/cleanupResources.js.map +1 -1
  50. package/commands/cleanupResources.ts +2 -2
  51. package/commands/config/get.d.ts +1 -1
  52. package/commands/config/get.js +10 -17
  53. package/commands/config/get.js.map +1 -1
  54. package/commands/config/get.ts +6 -5
  55. package/commands/config/index.js +10 -35
  56. package/commands/config/index.js.map +1 -1
  57. package/commands/config/index.ts +7 -4
  58. package/commands/config/set.d.ts +1 -1
  59. package/commands/config/set.js +15 -22
  60. package/commands/config/set.js.map +1 -1
  61. package/commands/config/set.ts +7 -6
  62. package/commands/login.d.ts +1 -1
  63. package/commands/login.js +3 -7
  64. package/commands/login.js.map +1 -1
  65. package/commands/login.ts +1 -1
  66. package/commands/logout.d.ts +1 -1
  67. package/commands/logout.js +3 -7
  68. package/commands/logout.js.map +1 -1
  69. package/commands/logout.ts +1 -1
  70. package/commands/migrate.d.ts +1 -1
  71. package/commands/migrate.js +8 -16
  72. package/commands/migrate.js.map +1 -1
  73. package/commands/migrate.ts +3 -3
  74. package/commands/organization/create.d.ts +1 -1
  75. package/commands/organization/create.js +10 -15
  76. package/commands/organization/create.js.map +1 -1
  77. package/commands/organization/create.ts +4 -4
  78. package/commands/organization/index.js +10 -35
  79. package/commands/organization/index.js.map +1 -1
  80. package/commands/organization/index.ts +7 -4
  81. package/commands/organization/update.d.ts +1 -1
  82. package/commands/organization/update.js +10 -15
  83. package/commands/organization/update.js.map +1 -1
  84. package/commands/organization/update.ts +4 -4
  85. package/commands/resource/create.d.ts +1 -1
  86. package/commands/resource/create.js +18 -26
  87. package/commands/resource/create.js.map +1 -1
  88. package/commands/resource/create.ts +4 -4
  89. package/commands/resource/index.js +10 -35
  90. package/commands/resource/index.js.map +1 -1
  91. package/commands/resource/index.ts +7 -4
  92. package/commands/resource/update.d.ts +1 -1
  93. package/commands/resource/update.js +18 -26
  94. package/commands/resource/update.js.map +1 -1
  95. package/commands/resource/update.ts +4 -4
  96. package/commands/runCronJobs.d.ts +1 -1
  97. package/commands/runCronJobs.js +6 -11
  98. package/commands/runCronJobs.js.map +1 -1
  99. package/commands/runCronJobs.ts +2 -2
  100. package/commands/start.d.ts +1 -1
  101. package/commands/start.js +10 -15
  102. package/commands/start.js.map +1 -1
  103. package/commands/start.ts +4 -4
  104. package/commands/team/create.d.ts +1 -1
  105. package/commands/team/create.js +10 -15
  106. package/commands/team/create.js.map +1 -1
  107. package/commands/team/create.ts +4 -4
  108. package/commands/team/delete.d.ts +1 -1
  109. package/commands/team/delete.js +10 -15
  110. package/commands/team/delete.js.map +1 -1
  111. package/commands/team/delete.ts +4 -4
  112. package/commands/team/index.js +14 -37
  113. package/commands/team/index.js.map +1 -1
  114. package/commands/team/index.ts +11 -6
  115. package/commands/team/member/delete.d.ts +1 -1
  116. package/commands/team/member/delete.js +10 -15
  117. package/commands/team/member/delete.js.map +1 -1
  118. package/commands/team/member/delete.ts +4 -4
  119. package/commands/team/member/index.js +12 -36
  120. package/commands/team/member/index.js.map +1 -1
  121. package/commands/team/member/index.ts +9 -5
  122. package/commands/team/member/invite.d.ts +1 -1
  123. package/commands/team/member/invite.js +10 -15
  124. package/commands/team/member/invite.js.map +1 -1
  125. package/commands/team/member/invite.ts +4 -4
  126. package/commands/team/member/update.d.ts +1 -1
  127. package/commands/team/member/update.js +12 -17
  128. package/commands/team/member/update.js.map +1 -1
  129. package/commands/team/member/update.ts +4 -4
  130. package/commands/team/update.d.ts +1 -1
  131. package/commands/team/update.js +10 -15
  132. package/commands/team/update.js.map +1 -1
  133. package/commands/team/update.ts +4 -4
  134. package/index.js +66 -94
  135. package/index.js.map +1 -1
  136. package/index.ts +65 -65
  137. package/jest.config.js +3 -1
  138. package/jest.setup.js +3 -5
  139. package/jest.setup.js.map +1 -1
  140. package/jest.setup.ts +1 -1
  141. package/lib/__snapshots__/getBlockConfigFromTypeScript.test.ts.snap +42 -6
  142. package/lib/app.d.ts +1 -1
  143. package/lib/app.js +151 -163
  144. package/lib/app.js.map +1 -1
  145. package/lib/app.ts +7 -7
  146. package/lib/asset.js +11 -18
  147. package/lib/asset.js.map +1 -1
  148. package/lib/authentication.d.ts +1 -1
  149. package/lib/authentication.js +34 -65
  150. package/lib/authentication.js.map +1 -1
  151. package/lib/authentication.ts +3 -2
  152. package/lib/block.js +99 -113
  153. package/lib/block.js.map +1 -1
  154. package/lib/block.test.js +9 -14
  155. package/lib/block.test.js.map +1 -1
  156. package/lib/block.test.ts +1 -1
  157. package/lib/block.ts +5 -5
  158. package/lib/coercers.js +5 -13
  159. package/lib/coercers.js.map +1 -1
  160. package/lib/coercers.test.js +2 -4
  161. package/lib/coercers.test.js.map +1 -1
  162. package/lib/coercers.test.ts +1 -1
  163. package/lib/getBlockConfigFromTypeScript.js +49 -56
  164. package/lib/getBlockConfigFromTypeScript.js.map +1 -1
  165. package/lib/getBlockConfigFromTypeScript.test.js +42 -46
  166. package/lib/getBlockConfigFromTypeScript.test.js.map +1 -1
  167. package/lib/getBlockConfigFromTypeScript.test.ts +7 -6
  168. package/lib/initAxios.d.ts +1 -1
  169. package/lib/initAxios.js +7 -14
  170. package/lib/initAxios.js.map +1 -1
  171. package/lib/initAxios.ts +2 -2
  172. package/lib/loadWebpackConfig.js +14 -45
  173. package/lib/loadWebpackConfig.js.map +1 -1
  174. package/lib/loadWebpackConfig.ts +10 -17
  175. package/lib/organization.js +23 -31
  176. package/lib/organization.js.map +1 -1
  177. package/lib/output.js +5 -9
  178. package/lib/output.js.map +1 -1
  179. package/lib/processCss.js +11 -18
  180. package/lib/processCss.js.map +1 -1
  181. package/lib/resource.js +17 -25
  182. package/lib/resource.js.map +1 -1
  183. package/lib/serverImport.js +6 -34
  184. package/lib/serverImport.js.map +1 -1
  185. package/lib/serverImport.ts +0 -1
  186. package/lib/team.js +28 -41
  187. package/lib/team.js.map +1 -1
  188. package/package.json +11 -10
  189. package/tsconfig.json +0 -1
  190. package/types.js +1 -2
@@ -1,5 +1,5 @@
1
1
  import { Argv } from 'yargs';
2
- import { BaseArguments } from '../../types';
2
+ import { BaseArguments } from '../../types.js';
3
3
  interface ConfigSetArguments extends BaseArguments {
4
4
  key: string;
5
5
  value: string;
@@ -1,16 +1,10 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handler = exports.builder = exports.description = exports.command = void 0;
7
- const util_1 = require("util");
8
- const node_utils_1 = require("@appsemble/node-utils");
9
- const utils_1 = require("@appsemble/utils");
10
- const read_pkg_up_1 = __importDefault(require("read-pkg-up"));
11
- exports.command = 'set <key> <value>';
12
- exports.description = 'Set an Appsemble configuration option in package.json.';
13
- function builder(yargs) {
1
+ import { inspect } from 'util';
2
+ import { logger, writeData } from '@appsemble/node-utils';
3
+ import { has } from '@appsemble/utils';
4
+ import { readPackageUp } from 'read-pkg-up';
5
+ export const command = 'set <key> <value>';
6
+ export const description = 'Set an Appsemble configuration option in package.json.';
7
+ export function builder(yargs) {
14
8
  return yargs
15
9
  .positional('key', {
16
10
  describe: 'The key whose value to set',
@@ -19,11 +13,11 @@ function builder(yargs) {
19
13
  describe: 'The value to set',
20
14
  });
21
15
  }
22
- exports.builder = builder;
23
- async function handler({ key, value }) {
24
- const { packageJson, path } = await (0, read_pkg_up_1.default)({ normalize: false });
25
- if (!(0, utils_1.has)(packageJson, 'appsembleServer')) {
26
- packageJson.appsembleServer = {};
16
+ export async function handler({ key, value }) {
17
+ const { packageJson, path } = await readPackageUp({ normalize: false });
18
+ const pkg = packageJson;
19
+ if (!has(pkg, 'appsembleServer')) {
20
+ pkg.appsembleServer = {};
27
21
  }
28
22
  let parsed;
29
23
  try {
@@ -32,9 +26,8 @@ async function handler({ key, value }) {
32
26
  catch {
33
27
  parsed = value;
34
28
  }
35
- packageJson.appsembleServer[key] = parsed;
36
- await (0, node_utils_1.writeData)(path, packageJson);
37
- node_utils_1.logger.info(`Set option appsembleServer.${key} to ${(0, util_1.inspect)(parsed, { colors: true })} in ${path}`);
29
+ pkg.appsembleServer[key] = parsed;
30
+ await writeData(path, packageJson);
31
+ logger.info(`Set option appsembleServer.${key} to ${inspect(parsed, { colors: true })} in ${path}`);
38
32
  }
39
- exports.handler = handler;
40
33
  //# sourceMappingURL=set.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"set.js","sourceRoot":"","sources":["set.ts"],"names":[],"mappings":";;;;;;AAAA,+BAA+B;AAE/B,sDAA0D;AAC1D,4CAAuC;AACvC,8DAAoC;AAUvB,QAAA,OAAO,GAAG,mBAAmB,CAAC;AAC9B,QAAA,WAAW,GAAG,wDAAwD,CAAC;AAEpF,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK;SACT,UAAU,CAAC,KAAK,EAAE;QACjB,QAAQ,EAAE,4BAA4B;KACvC,CAAC;SACD,UAAU,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,kBAAkB;KAC7B,CAAC,CAAC;AACP,CAAC;AARD,0BAQC;AAEM,KAAK,UAAU,OAAO,CAAC,EAAE,GAAG,EAAE,KAAK,EAAsB;IAC9D,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,GAAG,MAAM,IAAA,qBAAS,EAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC,CAAC;IACpE,IAAI,CAAC,IAAA,WAAG,EAAC,WAAW,EAAE,iBAAiB,CAAC,EAAE;QACxC,WAAW,CAAC,eAAe,GA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IACxE,MAAM,GAAG,GAAG,WAAkC,CAAC;IAC/C,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,iBAAiB,CAAC,EAAE;QAChC,GAAG,CAAC,eAAe,GAAG,EAAE,CAAC;KAC1B;IACD,IAAI,MAAM,CAAC;IACX,IAAI;QACF,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;KAC5B;IAAC,MAAM;QACN,MAAM,GAAG,KAAK,CAAC;KAChB;IACD,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC;IAClC,MAAM,SAAS,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACnC,MAAM,CAAC,IAAI,CACT,8BAA8B,GAAG,OAAO,OAAO,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,OAAO,IAAI,EAAE,CACvF,CAAC;AACJ,CAAC"}
@@ -2,10 +2,10 @@ import { inspect } from 'util';
2
2
 
3
3
  import { logger, writeData } from '@appsemble/node-utils';
4
4
  import { has } from '@appsemble/utils';
5
- import readPkgUp from 'read-pkg-up';
5
+ import { readPackageUp } from 'read-pkg-up';
6
6
  import { Argv } from 'yargs';
7
7
 
8
- import { BaseArguments, MonoRepoPackageJson } from '../../types';
8
+ import { BaseArguments, MonoRepoPackageJson } from '../../types.js';
9
9
 
10
10
  interface ConfigSetArguments extends BaseArguments {
11
11
  key: string;
@@ -26,9 +26,10 @@ export function builder(yargs: Argv): Argv<any> {
26
26
  }
27
27
 
28
28
  export async function handler({ key, value }: ConfigSetArguments): Promise<void> {
29
- const { packageJson, path } = await readPkgUp({ normalize: false });
30
- if (!has(packageJson, 'appsembleServer')) {
31
- packageJson.appsembleServer = {};
29
+ const { packageJson, path } = await readPackageUp({ normalize: false });
30
+ const pkg = packageJson as MonoRepoPackageJson;
31
+ if (!has(pkg, 'appsembleServer')) {
32
+ pkg.appsembleServer = {};
32
33
  }
33
34
  let parsed;
34
35
  try {
@@ -36,7 +37,7 @@ export async function handler({ key, value }: ConfigSetArguments): Promise<void>
36
37
  } catch {
37
38
  parsed = value;
38
39
  }
39
- (packageJson as MonoRepoPackageJson).appsembleServer[key] = parsed;
40
+ pkg.appsembleServer[key] = parsed;
40
41
  await writeData(path, packageJson);
41
42
  logger.info(
42
43
  `Set option appsembleServer.${key} to ${inspect(parsed, { colors: true })} in ${path}`,
@@ -1,3 +1,3 @@
1
- export { login as handler } from '../lib/authentication';
1
+ export { login as handler } from '../lib/authentication.js';
2
2
  export declare const command = "login";
3
3
  export declare const description = "Save OAuth2 client credentials in the key chain for future sessions on this machine.";
package/commands/login.js CHANGED
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.description = exports.command = exports.handler = void 0;
4
- var authentication_1 = require("../lib/authentication");
5
- Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return authentication_1.login; } });
6
- exports.command = 'login';
7
- exports.description = 'Save OAuth2 client credentials in the key chain for future sessions on this machine.';
1
+ export { login as handler } from '../lib/authentication.js';
2
+ export const command = 'login';
3
+ export const description = 'Save OAuth2 client credentials in the key chain for future sessions on this machine.';
8
4
  //# sourceMappingURL=login.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"login.js","sourceRoot":"","sources":["login.ts"],"names":[],"mappings":";;;AAAA,wDAAyD;AAAhD,yGAAA,KAAK,OAAW;AAEZ,QAAA,OAAO,GAAG,OAAO,CAAC;AAClB,QAAA,WAAW,GACtB,sFAAsF,CAAC"}
1
+ {"version":3,"file":"login.js","sourceRoot":"","sources":["login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE5D,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC;AAC/B,MAAM,CAAC,MAAM,WAAW,GACtB,sFAAsF,CAAC"}
package/commands/login.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { login as handler } from '../lib/authentication';
1
+ export { login as handler } from '../lib/authentication.js';
2
2
 
3
3
  export const command = 'login';
4
4
  export const description =
@@ -1,3 +1,3 @@
1
- export { remove as handler } from '../lib/authentication';
1
+ export { remove as handler } from '../lib/authentication.js';
2
2
  export declare const command = "logout";
3
3
  export declare const description = "Remove OAuth2 client credentials from the key chain using an interactive prompt. Beware this will not revoke them.";
@@ -1,8 +1,4 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.description = exports.command = exports.handler = void 0;
4
- var authentication_1 = require("../lib/authentication");
5
- Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return authentication_1.remove; } });
6
- exports.command = 'logout';
7
- exports.description = 'Remove OAuth2 client credentials from the key chain using an interactive prompt. Beware this will not revoke them.';
1
+ export { remove as handler } from '../lib/authentication.js';
2
+ export const command = 'logout';
3
+ export const description = 'Remove OAuth2 client credentials from the key chain using an interactive prompt. Beware this will not revoke them.';
8
4
  //# sourceMappingURL=logout.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"logout.js","sourceRoot":"","sources":["logout.ts"],"names":[],"mappings":";;;AAAA,wDAA0D;AAAjD,yGAAA,MAAM,OAAW;AAEb,QAAA,OAAO,GAAG,QAAQ,CAAC;AACnB,QAAA,WAAW,GACtB,oHAAoH,CAAC"}
1
+ {"version":3,"file":"logout.js","sourceRoot":"","sources":["logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,OAAO,EAAE,MAAM,0BAA0B,CAAC;AAE7D,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC;AAChC,MAAM,CAAC,MAAM,WAAW,GACtB,oHAAoH,CAAC"}
@@ -1,4 +1,4 @@
1
- export { remove as handler } from '../lib/authentication';
1
+ export { remove as handler } from '../lib/authentication.js';
2
2
 
3
3
  export const command = 'logout';
4
4
  export const description =
@@ -1,5 +1,5 @@
1
1
  import { Argv } from 'yargs';
2
- import { BaseArguments } from '../types';
2
+ import { BaseArguments } from '../types.js';
3
3
  export declare const command = "migrate [migrate-to]";
4
4
  export declare const description = "Migrate the Appsemble database";
5
5
  export declare function builder(yargs: Argv): Argv<any>;
@@ -1,18 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handler = exports.builder = exports.description = exports.command = void 0;
7
- const serverImport_1 = require("../lib/serverImport");
8
- const package_json_1 = __importDefault(require("../package.json"));
9
- exports.command = 'migrate [migrate-to]';
10
- exports.description = 'Migrate the Appsemble database';
11
- function builder(yargs) {
1
+ import { serverImport } from '../lib/serverImport.js';
2
+ import pkg from '../package.json' assert { type: 'json' };
3
+ export const command = 'migrate [migrate-to]';
4
+ export const description = 'Migrate the Appsemble database';
5
+ export function builder(yargs) {
12
6
  return yargs
13
7
  .positional('migrate-to', {
14
8
  desc: 'The database version to migrate to.',
15
- default: package_json_1.default.version,
9
+ default: pkg.version,
16
10
  })
17
11
  .option('database-host', {
18
12
  desc: 'The host of the database to connect to. This defaults to the connected database container.',
@@ -43,11 +37,9 @@ function builder(yargs) {
43
37
  conflicts: ['database-host', 'database-name', 'database-user', 'database-password'],
44
38
  });
45
39
  }
46
- exports.builder = builder;
47
- async function handler(argv) {
48
- const { migrate, setArgv } = await (0, serverImport_1.serverImport)('setArgv', 'migrate');
40
+ export async function handler(argv) {
41
+ const { migrate, setArgv } = await serverImport('setArgv', 'migrate');
49
42
  setArgv(argv);
50
43
  return migrate();
51
44
  }
52
- exports.handler = handler;
53
45
  //# sourceMappingURL=migrate.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"migrate.js","sourceRoot":"","sources":["migrate.ts"],"names":[],"mappings":";;;;;;AAEA,sDAAmD;AACnD,mEAAkC;AAGrB,QAAA,OAAO,GAAG,sBAAsB,CAAC;AACjC,QAAA,WAAW,GAAG,gCAAgC,CAAC;AAE5D,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KA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OAAO,EAAE,OAAO,EAAE,GAAG,MAAM,YAAY,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC;IACd,OAAO,OAAO,EAAE,CAAC;AACnB,CAAC"}
@@ -1,8 +1,8 @@
1
1
  import { Argv } from 'yargs';
2
2
 
3
- import { serverImport } from '../lib/serverImport';
4
- import pkg from '../package.json';
5
- import { BaseArguments } from '../types';
3
+ import { serverImport } from '../lib/serverImport.js';
4
+ import pkg from '../package.json' assert { type: 'json' };
5
+ import { BaseArguments } from '../types.js';
6
6
 
7
7
  export const command = 'migrate [migrate-to]';
8
8
  export const description = 'Migrate the Appsemble database';
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { ReadStream } from 'fs';
3
3
  import { Argv } from 'yargs';
4
- import { BaseArguments } from '../../types';
4
+ import { BaseArguments } from '../../types.js';
5
5
  interface CreateOrganizationArguments extends BaseArguments {
6
6
  description: string;
7
7
  email: string;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = exports.builder = exports.description = exports.command = void 0;
4
- const authentication_1 = require("../../lib/authentication");
5
- const coercers_1 = require("../../lib/coercers");
6
- const organization_1 = require("../../lib/organization");
7
- exports.command = 'create <id>';
8
- exports.description = 'Register a new organization. You will be the owner of the new organization.';
9
- function builder(yargs) {
1
+ import { authenticate } from '../../lib/authentication.js';
2
+ import { coerceFile } from '../../lib/coercers.js';
3
+ import { createOrganization } from '../../lib/organization.js';
4
+ export const command = 'create <id>';
5
+ export const description = 'Register a new organization. You will be the owner of the new organization.';
6
+ export function builder(yargs) {
10
7
  return yargs
11
8
  .positional('id', {
12
9
  describe: 'The id for the newly created organization',
@@ -25,13 +22,12 @@ function builder(yargs) {
25
22
  })
26
23
  .option('icon', {
27
24
  describe: 'The file location of the icon representing the organization.',
28
- coerce: coercers_1.coerceFile,
25
+ coerce: coerceFile,
29
26
  });
30
27
  }
31
- exports.builder = builder;
32
- async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
33
- await (0, authentication_1.authenticate)(remote, 'organizations:write', clientCredentials);
34
- await (0, organization_1.createOrganization)({
28
+ export async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
29
+ await authenticate(remote, 'organizations:write', clientCredentials);
30
+ await createOrganization({
35
31
  description: desc,
36
32
  email,
37
33
  icon,
@@ -40,5 +36,4 @@ async function handler({ clientCredentials, description: desc, email, icon, id,
40
36
  website,
41
37
  });
42
38
  }
43
- exports.handler = handler;
44
39
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["create.ts"],"names":[],"mappings":";;;AAIA,6DAAwD;AACxD,iDAAgD;AAChD,yDAA4D;AAY/C,QAAA,OAAO,GAAG,aAAa,CAAC;AACxB,QAAA,WAAW,GACtB,6EAA6E,CAAC;AAEhF,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK;SACT,UAAU,CAAC,IAAI,EAAE;QAChB,QAAQ,EAAE,2CAA2C;KACtD,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,8BAA8B;KACzC,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,6DAA6D;KACxE,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,QAAQ,EAAE,iCAAiC;KAC5C,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,QAAQ,EAAE,6BAA6B;KACxC,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,8DAA8D;QACxE,MAAM,EAAE,qBAAU;KACnB,CAAC,CAAC;AACP,CAAC;AArBD,0BAqBC;AAEM,KAAK,UAAU,OAAO,CAAC,EAC5B,iBAAiB,EACjB,WAAW,EAAE,IAAI,EACjB,KAAK,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,MAAM,EACN,OAAO,GAC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AY,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;IACrE,MAAM,kBAAkB,CAAC;QACvB,WAAW,EAAE,IAAI;QACjB,KAAK;QACL,IAAI;QACJ,EAAE;QACF,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -2,10 +2,10 @@ import { ReadStream } from 'fs';
2
2
 
3
3
  import { Argv } from 'yargs';
4
4
 
5
- import { authenticate } from '../../lib/authentication';
6
- import { coerceFile } from '../../lib/coercers';
7
- import { createOrganization } from '../../lib/organization';
8
- import { BaseArguments } from '../../types';
5
+ import { authenticate } from '../../lib/authentication.js';
6
+ import { coerceFile } from '../../lib/coercers.js';
7
+ import { createOrganization } from '../../lib/organization.js';
8
+ import { BaseArguments } from '../../types.js';
9
9
 
10
10
  interface CreateOrganizationArguments extends BaseArguments {
11
11
  description: string;
@@ -1,37 +1,12 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.builder = exports.description = exports.command = exports.handler = void 0;
27
- const create = __importStar(require("./create"));
28
- const update = __importStar(require("./update"));
29
- var utils_1 = require("@appsemble/utils");
30
- Object.defineProperty(exports, "handler", { enumerable: true, get: function () { return utils_1.noop; } });
31
- exports.command = 'organization';
32
- exports.description = 'Commands related to organizations.';
33
- function builder(yargs) {
34
- return yargs.command(create).command(update).demandCommand(1);
1
+ import * as create from './create.js';
2
+ import * as update from './update.js';
3
+ export { noop as handler } from '@appsemble/utils';
4
+ export const command = 'organization';
5
+ export const description = 'Commands related to organizations.';
6
+ export function builder(yargs) {
7
+ return yargs
8
+ .command(create)
9
+ .command(update)
10
+ .demandCommand(1);
35
11
  }
36
- exports.builder = builder;
37
12
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,iDAAmC;AACnC,iDAAmC;AAEnC,0CAAmD;AAA1C,gGAAA,IAAI,OAAW;AAEX,QAAA,OAAO,GAAG,cAAc,CAAC;AACzB,QAAA,WAAW,GAAG,oCAAoC,CAAC;AAEhE,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;AAChE,CAAC;AAFD,0BAEC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAEtC,OAAO,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAEnD,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC;AACtC,MAAM,CAAC,MAAM,WAAW,GAAG,oCAAoC,CAAC;AAEhE,MAAM,UAAU,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK;SACT,OAAO,CAAC,MAAkC,CAAC;SAC3C,OAAO,CAAC,MAAkC,CAAC;SAC3C,aAAa,CAAC,CAAC,CAAC,CAAC;AACtB,CAAC"}
@@ -1,7 +1,7 @@
1
- import { Argv } from 'yargs';
1
+ import { Argv, CommandModule } from 'yargs';
2
2
 
3
- import * as create from './create';
4
- import * as update from './update';
3
+ import * as create from './create.js';
4
+ import * as update from './update.js';
5
5
 
6
6
  export { noop as handler } from '@appsemble/utils';
7
7
 
@@ -9,5 +9,8 @@ export const command = 'organization';
9
9
  export const description = 'Commands related to organizations.';
10
10
 
11
11
  export function builder(yargs: Argv): Argv {
12
- return yargs.command(create).command(update).demandCommand(1);
12
+ return yargs
13
+ .command(create as unknown as CommandModule)
14
+ .command(update as unknown as CommandModule)
15
+ .demandCommand(1);
13
16
  }
@@ -1,7 +1,7 @@
1
1
  /// <reference types="node" />
2
2
  import { ReadStream } from 'fs';
3
3
  import { Argv } from 'yargs';
4
- import { BaseArguments } from '../../types';
4
+ import { BaseArguments } from '../../types.js';
5
5
  interface UpdateOrganizationArguments extends BaseArguments {
6
6
  description: string;
7
7
  email: string;
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.handler = exports.builder = exports.description = exports.command = void 0;
4
- const authentication_1 = require("../../lib/authentication");
5
- const coercers_1 = require("../../lib/coercers");
6
- const organization_1 = require("../../lib/organization");
7
- exports.command = 'update <id>';
8
- exports.description = 'Update an existing organization. You must be an owner of the organization.';
9
- function builder(yargs) {
1
+ import { authenticate } from '../../lib/authentication.js';
2
+ import { coerceFile } from '../../lib/coercers.js';
3
+ import { updateOrganization } from '../../lib/organization.js';
4
+ export const command = 'update <id>';
5
+ export const description = 'Update an existing organization. You must be an owner of the organization.';
6
+ export function builder(yargs) {
10
7
  return yargs
11
8
  .positional('id', {
12
9
  describe: 'The ID of the organization',
@@ -25,13 +22,12 @@ function builder(yargs) {
25
22
  })
26
23
  .option('icon', {
27
24
  describe: 'The file location of the icon representing the organization.',
28
- coerce: coercers_1.coerceFile,
25
+ coerce: coerceFile,
29
26
  });
30
27
  }
31
- exports.builder = builder;
32
- async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
33
- await (0, authentication_1.authenticate)(remote, 'organizations:write', clientCredentials);
34
- await (0, organization_1.updateOrganization)({
28
+ export async function handler({ clientCredentials, description: desc, email, icon, id, name, remote, website, }) {
29
+ await authenticate(remote, 'organizations:write', clientCredentials);
30
+ await updateOrganization({
35
31
  description: desc,
36
32
  email,
37
33
  icon,
@@ -40,5 +36,4 @@ async function handler({ clientCredentials, description: desc, email, icon, id,
40
36
  website,
41
37
  });
42
38
  }
43
- exports.handler = handler;
44
39
  //# sourceMappingURL=update.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"update.js","sourceRoot":"","sources":["update.ts"],"names":[],"mappings":";;;AAIA,6DAAwD;AACxD,iDAAgD;AAChD,yDAA4D;AAY/C,QAAA,OAAO,GAAG,aAAa,CAAC;AACxB,QAAA,WAAW,GACtB,4EAA4E,CAAC;AAE/E,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK;SACT,UAAU,CAAC,IAAI,EAAE;QAChB,QAAQ,EAAE,4BAA4B;KACvC,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,+BAA+B;KAC1C,CAAC;SACD,MAAM,CAAC,OAAO,EAAE;QACf,QAAQ,EAAE,6DAA6D;KACxE,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,QAAQ,EAAE,iCAAiC;KAC5C,CAAC;SACD,MAAM,CAAC,aAAa,EAAE;QACrB,QAAQ,EAAE,6BAA6B;KACxC,CAAC;SACD,MAAM,CAAC,MAAM,EAAE;QACd,QAAQ,EAAE,8DAA8D;QACxE,MAAM,EAAE,qBAAU;KACnB,CAAC,CAAC;AACP,CAAC;AArBD,0BAqBC;AAEM,KAAK,UAAU,OAAO,CAAC,EAC5B,iBAAiB,EAC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AI,EACjB,KAAK,EACL,IAAI,EACJ,EAAE,EACF,IAAI,EACJ,MAAM,EACN,OAAO,GACqB;IAC5B,MAAM,YAAY,CAAC,MAAM,EAAE,qBAAqB,EAAE,iBAAiB,CAAC,CAAC;IACrE,MAAM,kBAAkB,CAAC;QACvB,WAAW,EAAE,IAAI;QACjB,KAAK;QACL,IAAI;QACJ,EAAE;QACF,IAAI;QACJ,OAAO;KACR,CAAC,CAAC;AACL,CAAC"}
@@ -2,10 +2,10 @@ import { ReadStream } from 'fs';
2
2
 
3
3
  import { Argv } from 'yargs';
4
4
 
5
- import { authenticate } from '../../lib/authentication';
6
- import { coerceFile } from '../../lib/coercers';
7
- import { updateOrganization } from '../../lib/organization';
8
- import { BaseArguments } from '../../types';
5
+ import { authenticate } from '../../lib/authentication.js';
6
+ import { coerceFile } from '../../lib/coercers.js';
7
+ import { updateOrganization } from '../../lib/organization.js';
8
+ import { BaseArguments } from '../../types.js';
9
9
 
10
10
  interface UpdateOrganizationArguments extends BaseArguments {
11
11
  description: string;
@@ -1,5 +1,5 @@
1
1
  import { Argv } from 'yargs';
2
- import { BaseArguments } from '../../types';
2
+ import { BaseArguments } from '../../types.js';
3
3
  interface CreateResourceArguments extends BaseArguments {
4
4
  resourceName: string;
5
5
  paths: string[];
@@ -1,18 +1,12 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.handler = exports.builder = exports.description = exports.command = void 0;
7
- const node_utils_1 = require("@appsemble/node-utils");
8
- const fast_glob_1 = __importDefault(require("fast-glob"));
9
- const normalize_path_1 = __importDefault(require("normalize-path"));
10
- const app_1 = require("../../lib/app");
11
- const authentication_1 = require("../../lib/authentication");
12
- const resource_1 = require("../../lib/resource");
13
- exports.command = 'create <resource-name> <paths...>';
14
- exports.description = 'Create resources based on a specified JSON file or directory.';
15
- function builder(yargs) {
1
+ import { AppsembleError, logger } from '@appsemble/node-utils';
2
+ import fg from 'fast-glob';
3
+ import normalizePath from 'normalize-path';
4
+ import { resolveAppIdAndRemote } from '../../lib/app.js';
5
+ import { authenticate } from '../../lib/authentication.js';
6
+ import { createResource } from '../../lib/resource.js';
7
+ export const command = 'create <resource-name> <paths...>';
8
+ export const description = 'Create resources based on a specified JSON file or directory.';
9
+ export function builder(yargs) {
16
10
  return yargs
17
11
  .positional('resource-name', {
18
12
  describe: 'The name of the resource that should be created.',
@@ -36,19 +30,18 @@ function builder(yargs) {
36
30
  demandOption: 'app',
37
31
  });
38
32
  }
39
- exports.builder = builder;
40
- async function handler({ app, appId, clientCredentials, context, paths, remote, resourceName, }) {
41
- const [resolvedAppId, resolvedRemote] = await (0, app_1.resolveAppIdAndRemote)(app, context, remote, appId);
42
- await (0, authentication_1.authenticate)(resolvedRemote, 'resources:write', clientCredentials);
43
- const normalizedPaths = paths.map((path) => (0, normalize_path_1.default)(path));
44
- const files = (await (0, fast_glob_1.default)(normalizedPaths, { absolute: true, onlyFiles: true })).filter((file) => file.endsWith('.json') || file.endsWith('.csv'));
33
+ export async function handler({ app, appId, clientCredentials, context, paths, remote, resourceName, }) {
34
+ const [resolvedAppId, resolvedRemote] = await resolveAppIdAndRemote(app, context, remote, appId);
35
+ await authenticate(resolvedRemote, 'resources:write', clientCredentials);
36
+ const normalizedPaths = paths.map((path) => normalizePath(path));
37
+ const files = (await fg(normalizedPaths, { absolute: true, onlyFiles: true })).filter((file) => file.endsWith('.json') || file.endsWith('.csv'));
45
38
  if (!files.length) {
46
- throw new node_utils_1.AppsembleError('No .json or .csv files found.');
39
+ throw new AppsembleError('No .json or .csv files found.');
47
40
  }
48
- node_utils_1.logger.info(`Creating resources based on ${files.length} files`);
41
+ logger.info(`Creating resources based on ${files.length} files`);
49
42
  for (const path of files) {
50
- node_utils_1.logger.info('');
51
- await (0, resource_1.createResource)({
43
+ logger.info('');
44
+ await createResource({
52
45
  resourceName,
53
46
  appId: resolvedAppId,
54
47
  path,
@@ -56,5 +49,4 @@ async function handler({ app, appId, clientCredentials, context, paths, remote,
56
49
  });
57
50
  }
58
51
  }
59
- exports.handler = handler;
60
52
  //# sourceMappingURL=create.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"create.js","sourceRoot":"","sources":["create.ts"],"names":[],"mappings":";;;;;;AAAA,sDAA+D;AAC/D,0DAA2B;AAC3B,oEAA2C;AAG3C,uCAAsD;AACtD,6DAAwD;AACxD,iDAAoD;AAWvC,QAAA,OAAO,GAAG,mCAAmC,CAAC;AAC9C,QAAA,WAAW,GAAG,+DAA+D,CAAC;AAE3F,SAAgB,OAAO,CAAC,KAAW;IACjC,OAAO,KAAK;SACT,UAAU,CAAC,eAAe,EAAE;QAC3B,QAAQ,EAAE,kDAAkD;QAC5D,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,UAAU,CAAC,OAAO,EAAE;QACnB,QAAQ,EAAE,qCAAqC;QAC/C,SAAS,EAAE,IAAI;QACf,YAAY,EAAE,IAAI;KACnB,CAAC;SACD,MAAM,CAAC,QAAQ,EAAE;QAChB,QAAQ,EAAE,gDAAgD;QAC1D,IAAI,EAAE,QAAQ;KACf,CAAC;SACD,MAAM,CAAC,KAAK,EAAE;QACb,QAAQ,EAAE,sBAAsB;QAChC,YAAY,EAAE,SAAS;KACxB,CAAC;SACD,MAAM,CAAC,SAAS,EAAE;QACjB,QAAQ,EAAE,gEAAgE;QAC1E,YAAY,EAAE,KAAK;KACpB,CAAC,CAAC;AACP,CAAC;AAvBD,0BAuBC;AAEM,KAAK,UAAU,OAAO,CAAC,EAC5B,GAAG,EACH,KAAK,EACL,iBAAiB,EACjB,OAAO,EACP,KAAK,EACL,MAAM,EACN,YAAY,GACY;IACxB,MAAM,CAAC,aAAa,EAAE,cAAc,CAAC,GAAG,MAAM,IAAA,2BAAqB,EAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,CAAC;IACjG,MAAM,IAAA,6BAAY,EAAC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MAAM,CACnF,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAC1D,CAAC;IAEF,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE;QACjB,MAAM,IAAI,cAAc,CAAC,+BAA+B,CAAC,CAAC;KAC3D;IAED,MAAM,CAAC,IAAI,CAAC,+BAA+B,KAAK,CAAC,MAAM,QAAQ,CAAC,CAAC;IACjE,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;QACxB,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;QAChB,MAAM,cAAc,CAAC;YACnB,YAAY;YACZ,KAAK,EAAE,aAAa;YACpB,IAAI;YACJ,MAAM,EAAE,cAAc;SACvB,CAAC,CAAC;KACJ;AACH,CAAC"}
@@ -3,10 +3,10 @@ import fg from 'fast-glob';
3
3
  import normalizePath from 'normalize-path';
4
4
  import { Argv } from 'yargs';
5
5
 
6
- import { resolveAppIdAndRemote } from '../../lib/app';
7
- import { authenticate } from '../../lib/authentication';
8
- import { createResource } from '../../lib/resource';
9
- import { BaseArguments } from '../../types';
6
+ import { resolveAppIdAndRemote } from '../../lib/app.js';
7
+ import { authenticate } from '../../lib/authentication.js';
8
+ import { createResource } from '../../lib/resource.js';
9
+ import { BaseArguments } from '../../types.js';
10
10
 
11
11
  interface CreateResourceArguments extends BaseArguments {
12
12
  resourceName: string;