@betty-blocks/cli 26.0.0-beta.8 → 26.0.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 (255) hide show
  1. package/assets/app-functions/wasm-template/.wasm-functions +0 -0
  2. package/assets/app-functions/wasm-template/functions/say-hello/1.0/Cargo.lock +449 -0
  3. package/assets/app-functions/wasm-template/functions/say-hello/1.0/Cargo.toml +10 -0
  4. package/assets/app-functions/wasm-template/functions/say-hello/1.0/Justfile +12 -0
  5. package/assets/app-functions/wasm-template/functions/say-hello/1.0/function.json +35 -0
  6. package/assets/app-functions/wasm-template/functions/say-hello/1.0/src/lib.rs +19 -0
  7. package/assets/app-functions/wasm-template/functions/say-hello/1.0/wit/world.wit +13 -0
  8. package/build/bb-blocks-new.d.ts +1 -0
  9. package/build/bb-blocks-new.js +26 -0
  10. package/build/bb-blocks-new.js.map +1 -0
  11. package/build/bb-blocks-publish.d.ts +1 -0
  12. package/build/bb-blocks-publish.js +98 -0
  13. package/build/bb-blocks-publish.js.map +1 -0
  14. package/build/bb-blocks-release.d.ts +1 -0
  15. package/build/bb-blocks-release.js +18 -0
  16. package/build/bb-blocks-release.js.map +1 -0
  17. package/build/bb-blocks.d.ts +1 -0
  18. package/build/bb-blocks.js +17 -0
  19. package/build/bb-blocks.js.map +1 -0
  20. package/build/bb-bundle-init.d.ts +1 -0
  21. package/build/bb-bundle-init.js +33 -0
  22. package/build/bb-bundle-init.js.map +1 -0
  23. package/build/bb-bundle.d.ts +1 -0
  24. package/build/bb-bundle.js +17 -0
  25. package/build/bb-bundle.js.map +1 -0
  26. package/build/bb-components-build.d.ts +1 -0
  27. package/build/bb-components-build.js +416 -0
  28. package/build/bb-components-build.js.map +1 -0
  29. package/build/bb-components-create.d.ts +1 -0
  30. package/build/bb-components-create.js +41 -0
  31. package/build/bb-components-create.js.map +1 -0
  32. package/build/bb-components-generate.d.ts +1 -0
  33. package/build/bb-components-generate.js +168 -0
  34. package/build/bb-components-generate.js.map +1 -0
  35. package/build/bb-components-publish-bundle.d.ts +1 -0
  36. package/build/bb-components-publish-bundle.js +50 -0
  37. package/build/bb-components-publish-bundle.js.map +1 -0
  38. package/build/bb-components-publish.d.ts +1 -0
  39. package/build/bb-components-publish.js +57 -0
  40. package/build/bb-components-publish.js.map +1 -0
  41. package/build/bb-components-serve.d.ts +1 -0
  42. package/build/bb-components-serve.js +35 -0
  43. package/build/bb-components-serve.js.map +1 -0
  44. package/build/bb-components.d.ts +1 -0
  45. package/build/bb-components.js +29 -0
  46. package/build/bb-components.js.map +1 -0
  47. package/build/bb-functions-bump.d.ts +1 -0
  48. package/build/bb-functions-bump.js +37 -0
  49. package/build/bb-functions-bump.js.map +1 -0
  50. package/build/bb-functions-init.d.ts +1 -0
  51. package/build/bb-functions-init.js +31 -0
  52. package/build/bb-functions-init.js.map +1 -0
  53. package/build/bb-functions-login.d.ts +1 -0
  54. package/build/bb-functions-login.js +17 -0
  55. package/build/bb-functions-login.js.map +1 -0
  56. package/build/bb-functions-logout.d.ts +1 -0
  57. package/build/bb-functions-logout.js +10 -0
  58. package/build/bb-functions-logout.js.map +1 -0
  59. package/build/bb-functions-new.d.ts +1 -0
  60. package/build/bb-functions-new.js +25 -0
  61. package/build/bb-functions-new.js.map +1 -0
  62. package/build/bb-functions-publish.d.ts +1 -0
  63. package/build/bb-functions-publish.js +52 -0
  64. package/build/bb-functions-publish.js.map +1 -0
  65. package/build/bb-functions-validate.d.ts +1 -0
  66. package/build/bb-functions-validate.js +17 -0
  67. package/build/bb-functions-validate.js.map +1 -0
  68. package/build/bb-functions.d.ts +1 -0
  69. package/build/bb-functions.js +29 -0
  70. package/build/bb-functions.js.map +1 -0
  71. package/build/bb.d.ts +2 -0
  72. package/build/bb.js +27 -0
  73. package/build/bb.js.map +1 -0
  74. package/build/blocks/blockDefinitions.d.ts +10 -0
  75. package/build/blocks/blockDefinitions.js +62 -0
  76. package/build/blocks/blockDefinitions.js.map +1 -0
  77. package/build/blocks/publishBlocks.d.ts +2 -0
  78. package/build/blocks/publishBlocks.js +54 -0
  79. package/build/blocks/publishBlocks.js.map +1 -0
  80. package/build/blocks/releaseBlocks.d.ts +5 -0
  81. package/build/blocks/releaseBlocks.js +78 -0
  82. package/build/blocks/releaseBlocks.js.map +1 -0
  83. package/build/components/bb-components-functions.d.ts +10 -0
  84. package/build/components/bb-components-functions.js +40 -0
  85. package/build/components/bb-components-functions.js.map +1 -0
  86. package/build/components/comments.d.ts +3 -0
  87. package/build/components/comments.js +78 -0
  88. package/build/components/comments.js.map +1 -0
  89. package/build/components/compatibility.d.ts +7 -0
  90. package/build/components/compatibility.js +60 -0
  91. package/build/components/compatibility.js.map +1 -0
  92. package/build/components/transformers/index.d.ts +3 -0
  93. package/build/components/transformers/index.js +36 -0
  94. package/build/components/transformers/index.js.map +1 -0
  95. package/build/components-build/index.d.ts +2 -0
  96. package/build/components-build/index.js +3 -0
  97. package/build/components-build/index.js.map +1 -0
  98. package/build/components-build/reportDiagnostics.d.ts +2 -0
  99. package/build/components-build/reportDiagnostics.js +13 -0
  100. package/build/components-build/reportDiagnostics.js.map +1 -0
  101. package/build/components-build/styles.d.ts +4 -0
  102. package/build/components-build/styles.js +87 -0
  103. package/build/components-build/styles.js.map +1 -0
  104. package/build/functions/config.d.ts +67 -0
  105. package/build/functions/config.js +190 -0
  106. package/build/functions/config.js.map +1 -0
  107. package/build/functions/createWasmDefinitionFiles.d.ts +4 -0
  108. package/build/functions/createWasmDefinitionFiles.js +61 -0
  109. package/build/functions/createWasmDefinitionFiles.js.map +1 -0
  110. package/build/functions/functionDefinitions.d.ts +23 -0
  111. package/build/functions/functionDefinitions.js +229 -0
  112. package/build/functions/functionDefinitions.js.map +1 -0
  113. package/build/functions/functionVersionBump.d.ts +19 -0
  114. package/build/functions/functionVersionBump.js +62 -0
  115. package/build/functions/functionVersionBump.js.map +1 -0
  116. package/build/functions/publishAppFunctions.d.ts +13 -0
  117. package/build/functions/publishAppFunctions.js +90 -0
  118. package/build/functions/publishAppFunctions.js.map +1 -0
  119. package/build/functions/publishWasmBlockStoreFunctions.d.ts +1 -0
  120. package/build/functions/publishWasmBlockStoreFunctions.js +100 -0
  121. package/build/functions/publishWasmBlockStoreFunctions.js.map +1 -0
  122. package/build/functions/utils.d.ts +2 -0
  123. package/build/functions/utils.js +20 -0
  124. package/build/functions/utils.js.map +1 -0
  125. package/build/functions/validateFunctions.d.ts +3 -0
  126. package/build/functions/validateFunctions.js +23 -0
  127. package/build/functions/validateFunctions.js.map +1 -0
  128. package/build/functions/validations.d.ts +31 -0
  129. package/build/functions/validations.js +140 -0
  130. package/build/functions/validations.js.map +1 -0
  131. package/build/interactions/compatibility.d.ts +3 -0
  132. package/build/interactions/compatibility.js +84 -0
  133. package/build/interactions/compatibility.js.map +1 -0
  134. package/build/interactions/diagnostics.d.ts +2 -0
  135. package/build/interactions/diagnostics.js +23 -0
  136. package/build/interactions/diagnostics.js.map +1 -0
  137. package/build/types.d.ts +377 -0
  138. package/build/types.js +40 -0
  139. package/build/types.js.map +1 -0
  140. package/build/utils/arguments.d.ts +2 -0
  141. package/build/utils/arguments.js +6 -0
  142. package/build/utils/arguments.js.map +1 -0
  143. package/build/utils/checkPackageVersion.d.ts +1 -0
  144. package/build/utils/checkPackageVersion.js +10 -0
  145. package/build/utils/checkPackageVersion.js.map +1 -0
  146. package/build/utils/checkUpdateAvailable.d.ts +1 -0
  147. package/build/utils/checkUpdateAvailable.js +65 -0
  148. package/build/utils/checkUpdateAvailable.js.map +1 -0
  149. package/build/utils/fusionAuth.d.ts +21 -0
  150. package/build/utils/fusionAuth.js +108 -0
  151. package/build/utils/fusionAuth.js.map +1 -0
  152. package/build/utils/hash.d.ts +2 -0
  153. package/build/utils/hash.js +3 -0
  154. package/build/utils/hash.js.map +1 -0
  155. package/build/utils/login.d.ts +15 -0
  156. package/build/utils/login.js +116 -0
  157. package/build/utils/login.js.map +1 -0
  158. package/build/utils/pick.d.ts +7 -0
  159. package/build/utils/pick.js +16 -0
  160. package/build/utils/pick.js.map +1 -0
  161. package/build/utils/readFilesByType.d.ts +2 -0
  162. package/build/utils/readFilesByType.js +23 -0
  163. package/build/utils/readFilesByType.js.map +1 -0
  164. package/build/utils/rootDir.d.ts +2 -0
  165. package/build/utils/rootDir.js +4 -0
  166. package/build/utils/rootDir.js.map +1 -0
  167. package/build/utils/serveComponentSet.d.ts +3 -0
  168. package/build/utils/serveComponentSet.js +52 -0
  169. package/build/utils/serveComponentSet.js.map +1 -0
  170. package/build/utils/transpile.d.ts +2 -0
  171. package/build/utils/transpile.js +25 -0
  172. package/build/utils/transpile.js.map +1 -0
  173. package/build/utils/uploadBlob.d.ts +24 -0
  174. package/build/utils/uploadBlob.js +56 -0
  175. package/build/utils/uploadBlob.js.map +1 -0
  176. package/build/utils/validation.d.ts +4 -0
  177. package/build/utils/validation.js +74 -0
  178. package/build/utils/validation.js.map +1 -0
  179. package/build/validations/component.d.ts +3 -0
  180. package/build/validations/component.js +56 -0
  181. package/build/validations/component.js.map +1 -0
  182. package/build/validations/constants.d.ts +16 -0
  183. package/build/validations/constants.js +208 -0
  184. package/build/validations/constants.js.map +1 -0
  185. package/build/validations/function-block-validations/index.d.ts +22 -0
  186. package/build/validations/function-block-validations/index.js +72 -0
  187. package/build/validations/function-block-validations/index.js.map +1 -0
  188. package/build/validations/interaction.d.ts +3 -0
  189. package/build/validations/interaction.js +22 -0
  190. package/build/validations/interaction.js.map +1 -0
  191. package/build/validations/prefab/action.d.ts +2 -0
  192. package/build/validations/prefab/action.js +99 -0
  193. package/build/validations/prefab/action.js.map +1 -0
  194. package/build/validations/prefab/component.d.ts +10 -0
  195. package/build/validations/prefab/component.js +290 -0
  196. package/build/validations/prefab/component.js.map +1 -0
  197. package/build/validations/prefab/componentOption.d.ts +3 -0
  198. package/build/validations/prefab/componentOption.js +176 -0
  199. package/build/validations/prefab/componentOption.js.map +1 -0
  200. package/build/validations/prefab/interaction.d.ts +2 -0
  201. package/build/validations/prefab/interaction.js +38 -0
  202. package/build/validations/prefab/interaction.js.map +1 -0
  203. package/build/validations/prefab/linkedOption.d.ts +3 -0
  204. package/build/validations/prefab/linkedOption.js +39 -0
  205. package/build/validations/prefab/linkedOption.js.map +1 -0
  206. package/build/validations/prefab/linkedPartial.d.ts +3 -0
  207. package/build/validations/prefab/linkedPartial.js +30 -0
  208. package/build/validations/prefab/linkedPartial.js.map +1 -0
  209. package/build/validations/prefab/variable.d.ts +3 -0
  210. package/build/validations/prefab/variable.js +36 -0
  211. package/build/validations/prefab/variable.js.map +1 -0
  212. package/build/validations/prefab.d.ts +17 -0
  213. package/build/validations/prefab.js +66 -0
  214. package/build/validations/prefab.js.map +1 -0
  215. package/build/validations/styles.d.ts +6 -0
  216. package/build/validations/styles.js +103 -0
  217. package/build/validations/styles.js.map +1 -0
  218. package/package.json +41 -44
  219. package/assets/app-functions/templates/test/helpers.js +0 -3
  220. package/assets/app-functions/templates/test/say-hello.test.js +0 -4
  221. package/assets/functions/packer/package.json +0 -9
  222. package/assets/functions/packer/webpack.config.js +0 -12
  223. package/assets/functions/templates/functions.json +0 -14
  224. package/assets/functions/templates/package.json +0 -11
  225. package/assets/functions/templates/src/all-users.js +0 -14
  226. package/assets/functions/templates/src/get-json.js +0 -9
  227. package/assets/functions/templates/src/index.js +0 -5
  228. package/assets/functions/templates/src/say-hello.js +0 -13
  229. package/build/src/bb-blocks-new.js +0 -6789
  230. package/build/src/bb-blocks-publish.js +0 -32641
  231. package/build/src/bb-blocks-release.js +0 -15528
  232. package/build/src/bb-blocks.js +0 -2149
  233. package/build/src/bb-bundle-init.js +0 -6035
  234. package/build/src/bb-bundle.js +0 -2636
  235. package/build/src/bb-components-build.js +0 -240547
  236. package/build/src/bb-components-create.js +0 -6046
  237. package/build/src/bb-components-generate.js +0 -6174
  238. package/build/src/bb-components-publish-bundle.js +0 -43347
  239. package/build/src/bb-components-publish.js +0 -43354
  240. package/build/src/bb-components-serve.js +0 -15327
  241. package/build/src/bb-components.js +0 -2157
  242. package/build/src/bb-functions-build.js +0 -4284
  243. package/build/src/bb-functions-bump.js +0 -14582
  244. package/build/src/bb-functions-init.js +0 -4749
  245. package/build/src/bb-functions-login.js +0 -15440
  246. package/build/src/bb-functions-logout.js +0 -15434
  247. package/build/src/bb-functions-new.js +0 -9144
  248. package/build/src/bb-functions-publish.js +0 -86693
  249. package/build/src/bb-functions-validate.js +0 -22160
  250. package/build/src/bb-functions.js +0 -2159
  251. package/build/src/bb.js +0 -2741
  252. /package/assets/app-functions/{templates → js-template}/.app-functions +0 -0
  253. /package/assets/app-functions/{templates → js-template}/functions/say-hello/1.0/function.json +0 -0
  254. /package/assets/app-functions/{templates → js-template}/functions/say-hello/1.0/index.js +0 -0
  255. /package/assets/app-functions/{templates → js-template}/package.json +0 -0
@@ -0,0 +1,168 @@
1
+ /* npm dependencies */
2
+ import chalk from 'chalk';
3
+ import { Command } from 'commander';
4
+ import { outputFile, outputFileSync, pathExists } from 'fs-extra';
5
+ import { checkUpdateAvailableCLI } from './utils/checkUpdateAvailable';
6
+ const program = new Command();
7
+ program
8
+ .argument('<name>', 'name of the component')
9
+ .name('bb components generate')
10
+ .parse(process.argv);
11
+ const { args } = program;
12
+ if (args.length === 0) {
13
+ program.help();
14
+ }
15
+ const name = args[0].charAt(0).toLowerCase() + args[0].slice(1);
16
+ const advancedTs = `import { variable } from '@betty-blocks/component-sdk';
17
+
18
+ export const advanced = (value: string) => {
19
+ return {
20
+ dataComponentAttribute: variable('Test attribute', {
21
+ value: [value],
22
+ }),
23
+ };
24
+ };
25
+ `;
26
+ const configurationTs = `import {
27
+ OptionCategory,
28
+ OptionProducer,
29
+ PrefabComponentStyle,
30
+ } from '@betty-blocks/component-sdk';
31
+
32
+ export interface Configuration {
33
+ options?: Record<string, OptionProducer>;
34
+ adornmentIcon?: string;
35
+ label?: string;
36
+ inputLabel?: string;
37
+ type?: HTMLInputElement['type'];
38
+ style?: PrefabComponentStyle;
39
+ ref?: { id: string };
40
+ inputType?: string;
41
+ placeholder?: string;
42
+ dataComponentAttribute?: string;
43
+ optionCategories?: OptionCategory[];
44
+ validationPattern?: string;
45
+ pattern?: string;
46
+ }
47
+ `;
48
+ void (async () => {
49
+ await checkUpdateAvailableCLI();
50
+ if (!/^[a-z][a-z0-9]*$/i.test(name)) {
51
+ throw Error(chalk.red(`\nName cannot contain special characters or spaces\n`));
52
+ }
53
+ if (await pathExists(`src/prefabs/${name}.tsx`)) {
54
+ throw Error(chalk.red(`\nPrefab ${name} already exists\n`));
55
+ }
56
+ if (await pathExists(`src/components/${name}.js`)) {
57
+ throw Error(chalk.red(`\nComponent ${name} already exists\n`));
58
+ }
59
+ const capitalisedName = name.charAt(0).toUpperCase() + name.slice(1);
60
+ const prefabsStructureIndex = `// Import all prefabs here
61
+ import { ${capitalisedName} } from './${capitalisedName}';
62
+
63
+ // Import all prefab options here
64
+ import { ${name}Options } from './${capitalisedName}/options';
65
+
66
+ export { ${capitalisedName}, ${name}Options };
67
+ `;
68
+ await pathExists('src/prefabs/structures/advanced.ts').then((exists) => {
69
+ if (!exists) {
70
+ console.log("advanced.ts didn't exist yet. Creating it");
71
+ outputFileSync('src/prefabs/structures/advanced.ts', advancedTs);
72
+ }
73
+ });
74
+ await pathExists('src/prefabs/structures/Configuration.ts').then((exists) => {
75
+ if (!exists) {
76
+ console.log("Configuration.ts didn't exist yet. Creating it");
77
+ outputFileSync('src/prefabs/structures/Configuration.ts', configurationTs);
78
+ }
79
+ });
80
+ await pathExists('src/prefabs/structures/index.ts').then((exists) => {
81
+ if (!exists) {
82
+ console.log("index.ts didn't exist yet. Creating it");
83
+ outputFileSync('src/prefabs/structures/index.ts', prefabsStructureIndex);
84
+ }
85
+ });
86
+ const prefab = `import { prefab, Icon } from '@betty-blocks/component-sdk';
87
+
88
+ import { ${capitalisedName} } from './structures/${capitalisedName}';
89
+
90
+ const attributes = {
91
+ category: 'CONTENT',
92
+ icon: Icon.TitleIcon,
93
+ keywords: [''],
94
+ };
95
+
96
+ export default prefab('${capitalisedName}', attributes, undefined, [${capitalisedName}({})]);
97
+ `;
98
+ const structureIndex = `import { component, PrefabReference } from '@betty-blocks/component-sdk';
99
+ import { Configuration } from '../Configuration';
100
+ import {
101
+ ${name}Options as defaultOptions,
102
+ categories as defaultCategories,
103
+ } from './options';
104
+
105
+ export const ${capitalisedName} = (
106
+ config: Configuration,
107
+ descendants: PrefabReference[] = [],
108
+ ) => {
109
+ const options = { ...(config.options || defaultOptions) };
110
+ const style = { ...config.style };
111
+ const ref = config.ref ? { ...config.ref } : undefined;
112
+ const label = config.label ? config.label : undefined;
113
+ const optionCategories = config.optionCategories
114
+ ? { ...config.optionCategories }
115
+ : defaultCategories;
116
+
117
+ return component(
118
+ '${capitalisedName}',
119
+ { options, ref, style, label, optionCategories },
120
+ descendants,
121
+ );
122
+ };
123
+ `;
124
+ const optionsIndex = `import { variable } from '@betty-blocks/component-sdk';
125
+ import { advanced } from '../../advanced';
126
+
127
+ export const categories = [
128
+ {
129
+ label: 'Advanced Options',
130
+ expanded: false,
131
+ members: ['dataComponentAttribute'],
132
+ },
133
+ ];
134
+
135
+ export const ${name}Options = {
136
+ content: variable('Content', {
137
+ value: ['Hello world'],
138
+ configuration: { as: 'MULTILINE' },
139
+ }),
140
+
141
+ ...advanced('${capitalisedName}'),
142
+ };
143
+ `;
144
+ const component = `(() => ({
145
+ name: '${capitalisedName}',
146
+ type: 'CONTENT_COMPONENT',
147
+ allowedTypes: [],
148
+ orientation: 'HORIZONTAL',
149
+ jsx: (() => {
150
+ const { useText } = B;
151
+ const { content } = options;
152
+ return <div className={classes.root}>{useText(content)}</div>;
153
+ })(),
154
+ styles: () => () => ({
155
+ root: {},
156
+ }),
157
+ }))();
158
+ `;
159
+ await Promise.all([
160
+ outputFile(`src/prefabs/structures/${capitalisedName}/index.ts`, structureIndex),
161
+ outputFile(`src/prefabs/structures/${capitalisedName}/options/index.ts`, optionsIndex),
162
+ outputFile(`src/prefabs/${name}.tsx`, prefab),
163
+ outputFile(`src/components/${name}.js`, component),
164
+ console.log(chalk.green('The component has been generated')),
165
+ console.log(chalk.blueBright("\nIf you would like to use the component in another prefab, \nwe recommend adding the import and export of the component structure to 'src/prefabs/structures/index.ts' for a clean import from the same file")),
166
+ ]);
167
+ })();
168
+ //# sourceMappingURL=bb-components-generate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-components-generate.js","sourceRoot":"","sources":["../src/bb-components-generate.ts"],"names":[],"mappings":"AAAA,sBAAsB;AACtB,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAElE,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,QAAQ,CAAC,QAAQ,EAAE,uBAAuB,CAAC;KAC3C,IAAI,CAAC,wBAAwB,CAAC;KAC9B,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AAEzB,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;IACtB,OAAO,CAAC,IAAI,EAAE,CAAC;AACjB,CAAC;AAED,MAAM,IAAI,GAAW,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAExE,MAAM,UAAU,GAAG;;;;;;;;;CASlB,CAAC;AAEF,MAAM,eAAe,GAAG;;;;;;;;;;;;;;;;;;;;;CAqBvB,CAAC;AAEF,KAAK,CAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,uBAAuB,EAAE,CAAC;IAChC,IAAI,CAAC,mBAAmB,CAAC,IAAI,CAA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CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,EAAE;QAClE,IAAI,CAAC,MAAM,EAAE,CAAC;YACZ,OAAO,CAAC,GAAG,CAAC,wCAAwC,CAAC,CAAC;YACtD,cAAc,CAAC,iCAAiC,EAAE,qBAAqB,CAAC,CAAC;QAC3E,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,MAAM,MAAM,GAAG;;WAEN,eAAe,yBAAyB,eAAe;;;;;;;;yBAQzC,eAAe,8BAA8B,eAAe;CACpF,CAAC;IAEA,MAAM,cAAc,GAAG;;;IAGrB,IAAI;;;;eAIO,eAAe;;;;;;;;;;;;;OAavB,eAAe;;;;;CAKrB,CAAC;IAEA,MAAM,YAAY,GAAG;;;;;;;;;;;eAWR,IAAI;;;;;;iBAMF,eAAe;;CAE/B,CAAC;IAEA,MAAM,SAAS,GAAG;WACT,eAAe;;;;;;;;;;;;;CAazB,CAAC;IAEA,MAAM,OAAO,CAAC,GAAG,CAAC;QAChB,UAAU,CACR,0BAA0B,eAAe,WAAW,EACpD,cAAc,CACf;QACD,UAAU,CACR,0BAA0B,eAAe,mBAAmB,EAC5D,YAAY,CACb;QACD,UAAU,CAAC,eAAe,IAAI,MAAM,EAAE,MAAM,CAAC;QAC7C,UAAU,CAAC,kBAAkB,IAAI,KAAK,EAAE,SAAS,CAAC;QAClD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,kCAAkC,CAAC,CAAC;QAC5D,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,UAAU,CACd,+MAA+M,CAChN,CACF;KACF,CAAC,CAAC;AACL,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,50 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import { readFileSync } from 'fs';
4
+ import { publish, validateBucketName, } from './components/bb-components-functions';
5
+ import { checkUpdateAvailableCLI } from './utils/checkUpdateAvailable';
6
+ const program = new Command();
7
+ program
8
+ .usage('[options] [path]')
9
+ .name('bb components publish-bundle')
10
+ .option('-b, --bucket [name]', 'the component set name')
11
+ .parse(process.argv);
12
+ const { args } = program;
13
+ const distDir = args.length === 0 ? 'dist' : `${args[0]}/dist`;
14
+ const { bucket } = program.opts();
15
+ if (!bucket) {
16
+ throw new Error(chalk.red('\n-b or --bucket [name] is required\n'));
17
+ }
18
+ validateBucketName(bucket);
19
+ const readJS = async (fileName) => {
20
+ try {
21
+ return readFileSync(`${distDir}/${fileName}`, 'utf8');
22
+ }
23
+ catch (error) {
24
+ if (error instanceof Error) {
25
+ const { message } = error;
26
+ throw new Error(chalk.red([
27
+ 'There was an error trying to publish your component set',
28
+ message,
29
+ ].join('\n')));
30
+ }
31
+ throw new Error(`Unknown error occurred: ${error}`);
32
+ }
33
+ };
34
+ void (async () => {
35
+ await checkUpdateAvailableCLI();
36
+ const files = ['bundle.js', 'bundle.js.map'];
37
+ const [{ url }] = await Promise.all(files.map(async (fileName) => {
38
+ const objects = await readJS(fileName);
39
+ return publish({
40
+ blobContentType: 'text/javascript',
41
+ bucketName: bucket,
42
+ fileName,
43
+ objects,
44
+ });
45
+ }));
46
+ console.log(chalk.green(`Upload succesfully.\n
47
+ Use the following URL in the Page Builder to start working with your newly updated bundle:\n
48
+ ${url}`));
49
+ })();
50
+ //# sourceMappingURL=bb-components-publish-bundle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-components-publish-bundle.js","sourceRoot":"","sources":["../src/bb-components-publish-bundle.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAElC,OAAO,EACL,OAAO,EACP,kBAAkB,GACnB,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,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AAe,CAAC,CAAC;IAC7C,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACjC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,QAAQ,CAAC,CAAC;QACvC,OAAO,OAAO,CAAC;YACb,eAAe,EAAE,iBAAiB;YAClC,UAAU,EAAE,MAAM;YAClB,QAAQ;YACR,OAAO;SACR,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT;;EAEJ,GAAG,EAAE,CACF,CACF,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,57 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import { pathExists, readJSON } from 'fs-extra';
4
+ import { publish } from './components/bb-components-functions';
5
+ import { checkUpdateAvailableCLI } from './utils/checkUpdateAvailable';
6
+ const program = new Command();
7
+ program
8
+ .usage('[options] [path]')
9
+ .name('bb components publish')
10
+ .option('-b, --bucket [name]', 'the component set name')
11
+ .parse(process.argv);
12
+ const { args } = program;
13
+ const name = program.opts().bucket;
14
+ const distDir = args.length === 0 ? 'dist' : `${args[0]}/dist`;
15
+ if (!name || typeof name !== 'string' || !name.length) {
16
+ throw new Error(chalk.red('\n-b or --bucket [name] is required\n'));
17
+ }
18
+ const read = async (fileName) => {
19
+ try {
20
+ return await readJSON(`${distDir}/${fileName}`);
21
+ }
22
+ catch (error) {
23
+ if (error instanceof Error) {
24
+ const { message } = error;
25
+ throw new Error(chalk.red([
26
+ 'There was an error trying to publish your component set',
27
+ message,
28
+ ].join('\n')));
29
+ }
30
+ throw new Error(`Unknown error occurred: ${error}`);
31
+ }
32
+ };
33
+ void (async () => {
34
+ await checkUpdateAvailableCLI();
35
+ const files = ['prefabs.json', 'templates.json', 'interactions.json'];
36
+ const existingPath = await pathExists(`${distDir}/pagePrefabs.json`);
37
+ const existingPartialPath = await pathExists(`${distDir}/partials.json`);
38
+ if (existingPath) {
39
+ files.push('pagePrefabs.json');
40
+ }
41
+ if (existingPartialPath) {
42
+ files.push('partials.json');
43
+ }
44
+ const [{ url }] = await Promise.all(files.map(async (fileName) => {
45
+ const objects = await read(fileName);
46
+ return publish({
47
+ blobContentType: 'text/html',
48
+ bucketName: name,
49
+ fileName,
50
+ objects: JSON.stringify(objects),
51
+ });
52
+ }));
53
+ console.log(chalk.green(`Upload succesfully.\n
54
+ Use the following URL in the Page Builder to start working with your component set:\n
55
+ ${url}`));
56
+ })();
57
+ //# sourceMappingURL=bb-components-publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-components-publish.js","sourceRoot":"","sources":["../src/bb-components-publish.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEhD,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAC/D,OAAO,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,KAAK,CAAC,kBAAkB,CAAC;KACzB,IAAI,CAAC,uBAAuB,CAAC;KAC7B,MAAM,CAAC,qBAAqB,EAAE,wBAAwB,CAAC;KACvD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC;AACnC,MAAM,OAAO,GAAW,IAAI,CAAC,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAA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C;IACD,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,MAAM,OAAO,CAAC,GAAG,CACjC,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QAC3B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,QAAQ,CAAC,CAAC;QACrC,OAAO,OAAO,CAAC;YACb,eAAe,EAAE,WAAW;YAC5B,UAAU,EAAE,IAAI;YAChB,QAAQ;YACR,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC;SACjC,CAAC,CAAC;IACL,CAAC,CAAC,CACH,CAAC;IAEF,OAAO,CAAC,GAAG,CACT,KAAK,CAAC,KAAK,CACT;;EAEJ,GAAG,EAAE,CACF,CACF,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,35 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import { parseDir, parsePort } from './utils/arguments';
4
+ import serveComponentSet from './utils/serveComponentSet';
5
+ const program = new Command();
6
+ const programOpts = program.opts();
7
+ program
8
+ .usage('[path]')
9
+ .name('bb components serve')
10
+ .option('-p, --port [port]', 'Port to listen on.', (value) => parsePort(value, 5002), 5002)
11
+ .option('--host [host]', 'Host to listen on.', 'localhost')
12
+ .option('--ssl', 'Serve using HTTPS.', false)
13
+ .option('--ssl-key [ssl-key]', 'SSL certificate to use for serving HTTPS.')
14
+ .option('--ssl-cert [ssl-cert]', 'SSL key to use for serving HTTPS.')
15
+ .option('--offline', 'skip update check')
16
+ .parse(process.argv);
17
+ const options = {
18
+ host: programOpts.host,
19
+ port: programOpts.port,
20
+ rootDir: parseDir(program.args),
21
+ ssl: programOpts.ssl,
22
+ sslCert: programOpts.sslCert,
23
+ sslKey: programOpts.sslKey,
24
+ };
25
+ const arg = process.argv.slice(2);
26
+ const hasOfflineFlag = arg.includes('--offline');
27
+ /* execute command */
28
+ serveComponentSet(options, hasOfflineFlag).then(() => {
29
+ const scheme = options.ssl ? 'https' : 'http';
30
+ const url = `${scheme}://${options.host}:${options.port}`;
31
+ console.info(chalk.green(`Serving the component set at ${url}`));
32
+ }, (error) => {
33
+ throw new Error(`Error: ${error}`);
34
+ });
35
+ //# sourceMappingURL=bb-components-serve.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-components-serve.js","sourceRoot":"","sources":["../src/bb-components-serve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACxD,OAAO,iBAAiB,MAAM,2BAA2B,CAAC;AAE1D,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAEnC,OAAO;KACJ,KAAK,CAAC,QAAQ,CAAC;KACf,IAAI,CAAC,qBAAqB,CAAC;KAC3B,MAAM,CACL,mBAAmB,EACnB,oBAAoB,EACpB,CAAC,KAAa,EAAE,EAAE,CAAC,SAAS,CAAC,KAAK,EAAE,IAAI,CAAC,EACzC,IAAI,CACL;KACA,MAAM,CAAC,eAAe,EAAE,oBAAoB,EAAE,WAAW,CAAC;KAC1D,MAAM,CAAC,OAAO,EAAE,oBAAoB,EAAE,KAAK,CAAC;KAC5C,MAAM,CAAC,qBAAqB,EAAE,2CAA2C,CAAC;KAC1E,MAAM,CAAC,uBAAuB,EAAE,mCAAmC,CAAC;KACpE,MAAM,CAAC,WAAW,EAAE,mBAAmB,CAAC;KACxC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,OAAO,GAAiB;IAC5B,IAAI,EAAE,WAAW,CAAC,IAAc;IAChC,IAAI,EAAE,WAAW,CAAC,IAAc;IAChC,OAAO,EAAE,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC;IAC/B,GAAG,EAAE,WAAW,CAAC,GAAc;IAC/B,OAAO,EAAE,WAAW,CAAC,OAAiB;IACtC,MAAM,EAAE,WAAW,CAAC,MAAgB;CACrC,CAAC;AAEF,MAAM,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AAClC,MAAM,cAAc,GAAG,GAAG,CAAC,QAAQ,CAAC,WAAW,CAAC,CAAC;AAEjD,qBAAqB;AACrB,iBAAiB,CAAC,OAAO,EAAE,cAAc,CAAC,CAAC,IAAI,CAC7C,GAAG,EAAE;IACH,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC;IAC9C,MAAM,GAAG,GAAG,GAAG,MAAM,MAAM,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC;IAE1D,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,gCAAgC,GAAG,EAAE,CAAC,CAAC,CAAC;AACnE,CAAC,EACD,CAAC,KAAK,EAAE,EAAE;IACR,MAAM,IAAI,KAAK,CAAC,UAAU,KAAK,EAAE,CAAC,CAAC;AACrC,CAAC,CACF,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,29 @@
1
+ import { Command } from 'commander';
2
+ import {} from './types';
3
+ const availableCommands = [
4
+ 'create',
5
+ 'build',
6
+ 'serve',
7
+ 'publish',
8
+ 'help',
9
+ 'generate',
10
+ 'publish-bundle',
11
+ ];
12
+ const program = new Command();
13
+ program
14
+ .usage(`<${availableCommands.join('|')}>`)
15
+ .name('bb components')
16
+ .command('create <path>', 'create a new component set at path')
17
+ .command('build [path]', 'build the component set at a specific path, defaults to CWD')
18
+ .command('serve [path]', 'serve the component set at a specific path, defaults to CWD')
19
+ .command('publish-bundle [options] [path]', 'publish a bundle')
20
+ .command('publish [options] [path]', 'publish the component set from a specific path, defaults to CWD')
21
+ .command('generate [name]', 'generate a component with a given name')
22
+ .on('command:*', ([command]) => {
23
+ if (!availableCommands.includes(command)) {
24
+ console.error('Invalid command: %s\n', command);
25
+ program.outputHelp();
26
+ }
27
+ })
28
+ .parse(process.argv);
29
+ //# sourceMappingURL=bb-components.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-components.js","sourceRoot":"","sources":["../src/bb-components.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAA0B,MAAM,SAAS,CAAC;AAEjD,MAAM,iBAAiB,GAAwB;IAC7C,QAAQ;IACR,OAAO;IACP,OAAO;IACP,SAAS;IACT,MAAM;IACN,UAAU;IACV,gBAAgB;CACjB,CAAC;AAEF,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,KAAK,CAAC,IAAI,iBAAiB,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;KACzC,IAAI,CAAC,eAAe,CAAC;KACrB,OAAO,CAAC,eAAe,EAAE,oCAAoC,CAAC;KAC9D,OAAO,CACN,cAAc,EACd,6DAA6D,CAC9D;KACA,OAAO,CACN,cAAc,EACd,6DAA6D,CAC9D;KACA,OAAO,CAAC,iCAAiC,EAAE,kBAAkB,CAAC;KAC9D,OAAO,CACN,0BAA0B,EAC1B,iEAAiE,CAClE;KACA,OAAO,CAAC,iBAAiB,EAAE,wCAAwC,CAAC;KACpE,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC,OAAO,CAAW,EAAQ,EAAE;IAC7C,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC,OAA4B,CAAC,EAAE,CAAC;QAC9D,OAAO,CAAC,KAAK,CAAC,uBAAuB,EAAE,OAAO,CAAC,CAAC;QAChD,OAAO,CAAC,UAAU,EAAE,CAAC;IACvB,CAAC;AACH,CAAC,CAAC;KACD,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,37 @@
1
+ import chalk from 'chalk';
2
+ import { Command } from 'commander';
3
+ import fs from 'fs-extra';
4
+ import path from 'path';
5
+ import { collectBumpInput, replaceVersionInCargoTomlFile, replaceVersionInWitFile, } from './functions/functionVersionBump';
6
+ const program = new Command();
7
+ program.name('bb functions bump');
8
+ const check = chalk.green(`✔`);
9
+ const cross = chalk.red(`✖`);
10
+ const workingDir = process.cwd();
11
+ const isWasmFunctionProject = fs.existsSync(path.join(workingDir, '.wasm-functions'));
12
+ void (async () => {
13
+ const { dirName, newVersion, currentVersion } = await collectBumpInput();
14
+ const sourceDir = path.join(workingDir, 'functions', dirName, currentVersion);
15
+ const targetDir = path.join(workingDir, 'functions', dirName, newVersion);
16
+ try {
17
+ fs.copySync(sourceDir, targetDir);
18
+ if (isWasmFunctionProject) {
19
+ replaceVersionInWitFile({
20
+ currentVersion,
21
+ dirName,
22
+ newVersion,
23
+ targetDir,
24
+ });
25
+ replaceVersionInCargoTomlFile({
26
+ currentVersion,
27
+ newVersion,
28
+ targetDir,
29
+ });
30
+ }
31
+ console.log(`${check} Version bumped to ${path.join(dirName, newVersion)}`);
32
+ }
33
+ catch {
34
+ console.log(`${cross} Failed to bump version to ${path.join(dirName, newVersion)}`);
35
+ }
36
+ })();
37
+ //# sourceMappingURL=bb-functions-bump.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-bump.js","sourceRoot":"","sources":["../src/bb-functions-bump.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EACL,gBAAgB,EAChB,6BAA6B,EAC7B,uBAAuB,GACxB,MAAM,iCAAiC,CAAC;AAEzC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OA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AC;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,31 @@
1
+ import { Command } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import rootDir from './utils/rootDir';
5
+ const program = new Command();
6
+ program
7
+ .name('bb functions init')
8
+ .argument('<identifier>', 'the identifier (subdomain) of your application')
9
+ .option('-t, --type [type]', 'Specify the type of functions project to initialize. E.g., "wasm" or "js".', 'js')
10
+ .parse(process.argv);
11
+ const { args } = program;
12
+ const options = program.opts();
13
+ const [identifier] = args;
14
+ const workingDir = process.cwd();
15
+ const targetDir = path.join(workingDir, identifier);
16
+ if (fs.existsSync(targetDir)) {
17
+ console.log(`The directory "${targetDir}" already exists. Abort.`);
18
+ process.exit(1);
19
+ }
20
+ let sourceDir = path.join(rootDir(), 'assets', 'app-functions', 'js-template');
21
+ if (options.type === 'wasm') {
22
+ sourceDir = path.join(rootDir(), 'assets', 'app-functions', 'wasm-template');
23
+ }
24
+ fs.copySync(sourceDir, targetDir);
25
+ console.log(`Initialized functions project in ${targetDir}.
26
+ You can use "bb functions" to publish it:
27
+
28
+ cd ${identifier}
29
+ bb functions publish
30
+ `);
31
+ //# sourceMappingURL=bb-functions-init.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-init.js","sourceRoot":"","sources":["../src/bb-functions-init.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,OAAO,MAAM,iBAAiB,CAAC;AAEtC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,mBAAmB,CAAC;KACzB,QAAQ,CAAC,cAAc,EAAE,gDAAgD,CAAC;KAC1E,MAAM,CACL,mBAAmB,EACnB,4EAA4E,EAC5E,IAAI,CACL;KACA,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC;AACzB,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,EAAE,CAAC;AAE/B,MAAM,CAAC,UAAU,CAAC,GAAG,IAAI,CAAC;AAC1B,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC;AAEpD,IAAI,EAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;IAC7B,OAAO,CAAC,GAAG,CAAC,kBAAkB,SAAS,0BAA0B,CAAC,CAAC;IACnE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,IAAI,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,aAAa,CAAC,CAAC;AAC/E,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;IAC5B,SAAS,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,EAAE,eAAe,EAAE,eAAe,CAAC,CAAC;AAC/E,CAAC;AAED,EAAE,CAAC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;AAElC,OAAO,CAAC,GAAG,CAAC,oCAAoC,SAAS;;;aAG5C,UAAU;;KAElB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+ import Config from './functions/config';
3
+ import FusionAuth from './utils/login';
4
+ const program = new Command();
5
+ program.name('bb functions login').parse(process.argv);
6
+ void (async () => {
7
+ const config = new Config();
8
+ const fusionAuth = new FusionAuth(config);
9
+ const loggedIn = await fusionAuth.login();
10
+ if (loggedIn) {
11
+ console.log(`You are now logged in.`);
12
+ }
13
+ else {
14
+ console.log(`Couldn't log you in.`);
15
+ }
16
+ })();
17
+ //# sourceMappingURL=bb-functions-login.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-login.js","sourceRoot":"","sources":["../src/bb-functions-login.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvD,KAAK,CAAC,KAAK,IAAmB,EAAE;IAC9B,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;IAC5B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;IAE1C,MAAM,QAAQ,GAAG,MAAM,UAAU,CAAC,KAAK,EAAE,CAAC;IAE1C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAC;IACxC,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACtC,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,10 @@
1
+ import { Command } from 'commander';
2
+ import Config from './functions/config';
3
+ import FusionAuth from './utils/login';
4
+ const program = new Command();
5
+ program.name('bb functions logout').parse(process.argv);
6
+ const config = new Config();
7
+ const fusionAuth = new FusionAuth(config);
8
+ fusionAuth.clearTokens();
9
+ console.log('You are now logged out!');
10
+ //# sourceMappingURL=bb-functions-logout.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-logout.js","sourceRoot":"","sources":["../src/bb-functions-logout.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,MAAM,MAAM,oBAAoB,CAAC;AACxC,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AACxD,MAAM,MAAM,GAAG,IAAI,MAAM,EAAE,CAAC;AAC5B,MAAM,UAAU,GAAG,IAAI,UAAU,CAAC,MAAM,CAAC,CAAC;AAE1C,UAAU,CAAC,WAAW,EAAE,CAAC;AAEzB,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,25 @@
1
+ import { Command } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { newFunctionDefinition } from './functions/functionDefinitions';
5
+ const program = new Command();
6
+ program
7
+ .argument('<function-name>', 'Name of the new function')
8
+ .name('bb functions new')
9
+ .parse(process.argv);
10
+ const { args: [inputFunctionName], } = program;
11
+ const workingDir = process.cwd();
12
+ const isJsFunctionPorject = fs.existsSync(path.join(workingDir, '.app-functions'));
13
+ const isWasmFunctionProject = fs.existsSync(path.join(workingDir, '.wasm-functions'));
14
+ if (!isJsFunctionPorject && !isWasmFunctionProject) {
15
+ throw new Error(`${workingDir} doesn't seem to be a functions project.\nPlease make sure you're in the root of the project.`);
16
+ }
17
+ try {
18
+ const functionsDir = path.join(workingDir, 'functions');
19
+ newFunctionDefinition(functionsDir, inputFunctionName, isWasmFunctionProject);
20
+ console.log(`functions/${inputFunctionName} created`);
21
+ }
22
+ catch (error) {
23
+ throw new Error(`functions/${inputFunctionName} could not be created. Error: ${error}`);
24
+ }
25
+ //# sourceMappingURL=bb-functions-new.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-new.js","sourceRoot":"","sources":["../src/bb-functions-new.ts"],"names":[],"mappings":"AA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{};
@@ -0,0 +1,52 @@
1
+ import { Command } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import prompts from 'prompts';
5
+ import { getAllWasmFunctionsWithVersions } from './functions/functionDefinitions';
6
+ import publishAppFunctions from './functions/publishAppFunctions';
7
+ import { publishWasmBlockStoreFunctions } from './functions/publishWasmBlockStoreFunctions';
8
+ import { validateFunctions } from './functions/validateFunctions';
9
+ const program = new Command();
10
+ program
11
+ .name('bb functions publish')
12
+ .option('--skip-compile', 'Skip the compilation of the application.')
13
+ .option('-a, --all', 'Publish all wasm functions, this only applies to wasm functions projects.')
14
+ .parse(process.argv);
15
+ const { skipCompile, all } = program.opts();
16
+ const workingDir = process.cwd();
17
+ const baseFunctionsPath = path.join(workingDir, 'functions');
18
+ const isWasmFunctionProject = fs.existsSync(path.join(workingDir, '.wasm-functions'));
19
+ void (async () => {
20
+ const { valid } = await validateFunctions(isWasmFunctionProject, baseFunctionsPath);
21
+ if (!valid) {
22
+ process.exit(1);
23
+ }
24
+ if (isWasmFunctionProject) {
25
+ const functionNames = getAllWasmFunctionsWithVersions(baseFunctionsPath);
26
+ const choices = functionNames.map((name) => ({
27
+ title: name,
28
+ value: name,
29
+ }));
30
+ let selected = [];
31
+ if (all) {
32
+ selected = functionNames;
33
+ }
34
+ else {
35
+ const results = (await prompts([
36
+ {
37
+ choices,
38
+ instructions: false,
39
+ message: 'Which wasm functions do you want to publish?',
40
+ name: 'selected',
41
+ type: 'multiselect',
42
+ },
43
+ ]));
44
+ ({ selected } = results);
45
+ }
46
+ await publishWasmBlockStoreFunctions(baseFunctionsPath, selected);
47
+ }
48
+ else {
49
+ await publishAppFunctions({ skipCompile });
50
+ }
51
+ })();
52
+ //# sourceMappingURL=bb-functions-publish.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-publish.js","sourceRoot":"","sources":["../src/bb-functions-publish.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CA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AAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;YAC3C,KAAK,EAAE,IAAI;YACX,KAAK,EAAE,IAAI;SACZ,CAAC,CAAC,CAAC;QAEJ,IAAI,QAAQ,GAAa,EAAE,CAAC;QAC5B,IAAI,GAAG,EAAE,CAAC;YACR,QAAQ,GAAG,aAAa,CAAC;QAC3B,CAAC;aAAM,CAAC;YACN,MAAM,OAAO,GAAG,CAAC,MAAM,OAAO,CAAC;gBAC7B;oBACE,OAAO;oBACP,YAAY,EAAE,KAAK;oBACnB,OAAO,EAAE,8CAA8C;oBACvD,IAAI,EAAE,UAAU;oBAChB,IAAI,EAAE,aAAa;iBACpB;aACF,CAAC,CAA2B,CAAC;YAC9B,CAAC,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,CAAC;QAC3B,CAAC;QAED,MAAM,8BAA8B,CAAC,iBAAiB,EAAE,QAAQ,CAAC,CAAC;IACpE,CAAC;SAAM,CAAC;QACN,MAAM,mBAAmB,CAAC,EAAE,WAAW,EAAE,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC,CAAC,EAAE,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,17 @@
1
+ import { Command } from 'commander';
2
+ import fs from 'fs-extra';
3
+ import path from 'path';
4
+ import { validateFunctions } from './functions/validateFunctions';
5
+ const program = new Command();
6
+ program
7
+ .name('bb functions validate')
8
+ .argument('[function-name]', 'Name of the function to validate')
9
+ .parse(process.argv);
10
+ const { args: [inputFunctionName], } = program;
11
+ const workingDir = process.cwd();
12
+ const baseFunctionsPath = path.join(workingDir, 'functions');
13
+ const isWasmFunctionProject = fs.existsSync(path.join(workingDir, '.wasm-functions'));
14
+ void (async () => {
15
+ validateFunctions(isWasmFunctionProject, baseFunctionsPath, inputFunctionName);
16
+ })();
17
+ //# sourceMappingURL=bb-functions-validate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bb-functions-validate.js","sourceRoot":"","sources":["../src/bb-functions-validate.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,MAAM,UAAU,CAAC;AAC1B,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAElE,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,uBAAuB,CAAC;KAC7B,QAAQ,CAAC,iBAAiB,EAAE,kCAAkC,CAAC;KAC/D,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;AAEvB,MAAM,EACJ,IAAI,EAAE,CAAC,iBAAiB,CAAC,GAC1B,GAAG,OAAO,CAAC;AAEZ,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;AACjC,MAAM,iBAAiB,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,WAAW,CAAC,CAAC;AAE7D,MAAM,qBAAqB,GAAG,EAAE,CAAC,UAAU,CACzC,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,iBAAiB,CAAC,CACzC,CAAC;AAEF,KAAK,CAAC,KAAK,IAAmB,EAAE;IAC9B,iBAAiB,CACf,qBAAqB,EACrB,iBAAiB,EACjB,iBAAiB,CAClB,CAAC;AACJ,CAAC,CAAC,EAAE,CAAC"}