@wirechunk/cli 0.0.2 → 0.0.3

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/build/main.js CHANGED
@@ -3955,15 +3955,14 @@ const normalizeEmailAddress = (email) => {
3955
3955
  }
3956
3956
  return { ok: true, value: emailTrimmed };
3957
3957
  };
3958
- const defaultFormattedDataTemplate = `{{#each .}}{{@key}}: {{{.}}}
3959
- {{/each}}`;
3960
3958
  const siteDomainKey = "siteDomain";
3961
- const formattedDataKey = "formattedData";
3962
3959
  const submittedAtKey = "submittedAt";
3960
+ const defaultFormattedDataTemplate = `{{#each .}}{{@key}}: {{{.}}}
3961
+ {{/each}}`;
3963
3962
  const defaultNotificationEmailBodyTemplate = `Form entry from your site {{${siteDomainKey}}}:
3964
3963
 
3965
- {{{${formattedDataKey}}}}
3966
-
3964
+ {{#each .}}{{@key}}: {{{.}}}
3965
+ {{/each}}
3967
3966
 
3968
3967
  Submitted {{${submittedAtKey}}}
3969
3968
  `;
@@ -24972,7 +24971,7 @@ const bootstrap = async (opts, env2) => {
24972
24971
  });
24973
24972
  console.log(`Created platform ${name} with handle ${handle} (ID ${platformId})`);
24974
24973
  };
24975
- const validateExtensionConfig$1 = validate25;
24974
+ const validateExtensionConfig = validate25;
24976
24975
  function validate25(data, { instancePath = "", parentData, parentDataProperty, rootData = data, dynamicAnchors = {} } = {}) {
24977
24976
  let vErrors = null;
24978
24977
  let errors2 = 0;
@@ -32035,7 +32034,7 @@ const preCompiledSafeValidator = (validate2) => (value) => {
32035
32034
  error: errorsText(validate2)
32036
32035
  };
32037
32036
  };
32038
- const validateExtensionConfig = preCompiledSafeValidator(validateExtensionConfig$1);
32037
+ const validateExtensionManifest = preCompiledSafeValidator(validateExtensionConfig);
32039
32038
  const requireValidExtensionDir = async (dir2) => {
32040
32039
  const extConfigPath = resolve$1(dir2, "extension.json");
32041
32040
  if (!existsSync(extConfigPath)) {
@@ -32043,7 +32042,7 @@ const requireValidExtensionDir = async (dir2) => {
32043
32042
  process.exit(1);
32044
32043
  }
32045
32044
  const extConfig = JSON.parse(await readFile(extConfigPath, "utf8"));
32046
- const validateResult = validateExtensionConfig(extConfig);
32045
+ const validateResult = validateExtensionManifest(extConfig);
32047
32046
  if (validateResult.ok) {
32048
32047
  const config2 = validateResult.value;
32049
32048
  if (config2.components) {
@@ -32059,7 +32058,7 @@ const requireValidExtensionDir = async (dir2) => {
32059
32058
  }
32060
32059
  }
32061
32060
  }
32062
- return { ...config2, dir: dir2 };
32061
+ return { manifest: config2, dir: dir2 };
32063
32062
  }
32064
32063
  console.error(`Invalid extension config file:`, validateResult.error);
32065
32064
  process.exit(1);
@@ -60711,20 +60710,20 @@ const createExtensionVersion = async (opts, env2) => {
60711
60710
  const extensionId = requireExtensionIdOptionOrEnvVar(opts, env2);
60712
60711
  const apiToken = requireApiToken(env2);
60713
60712
  const cwd = process.cwd();
60714
- const extConfig = await requireValidExtensionDir(cwd);
60713
+ const { manifest } = await requireValidExtensionDir(cwd);
60715
60714
  let enableServer;
60716
60715
  let enableDb;
60717
- if (extConfig.server) {
60718
- enableServer = !!extConfig.server.enable;
60719
- if (extConfig.server.database?.enable && extConfig.server.enable === false) {
60716
+ if (manifest.server) {
60717
+ enableServer = !!manifest.server.enable;
60718
+ if (manifest.server.database?.enable && manifest.server.enable === false) {
60720
60719
  console.warn("WARNING: Automatically disabling database because server is disabled");
60721
60720
  enableDb = false;
60722
- } else if (extConfig.server.database?.enable && !extConfig.server.enable) {
60721
+ } else if (manifest.server.database?.enable && !manifest.server.enable) {
60723
60722
  console.warn("WARNING: Automatically enabling server because database is enabled");
60724
60723
  enableServer = true;
60725
60724
  enableDb = true;
60726
60725
  } else {
60727
- enableDb = !!extConfig.server.database?.enable;
60726
+ enableDb = !!manifest.server.database?.enable;
60728
60727
  }
60729
60728
  } else {
60730
60729
  enableServer = false;
@@ -60748,7 +60747,7 @@ const createExtensionVersion = async (opts, env2) => {
60748
60747
  console.log(`Creating extension version ${versionName} (Extension ID ${extensionId})
60749
60748
  Server: ${enableServer ? "enabled" : "disabled"}
60750
60749
  Database: ${enableDb ? "enabled" : "disabled"}
60751
- Components: ${Object.keys(extConfig.components ?? {}).length}`);
60750
+ Components: ${Object.keys(manifest.components ?? {}).length}`);
60752
60751
  let extensionVersionId;
60753
60752
  let signedUrl;
60754
60753
  try {
@@ -60761,8 +60760,9 @@ const createExtensionVersion = async (opts, env2) => {
60761
60760
  variables: {
60762
60761
  input: {
60763
60762
  extensionId,
60764
- extensionName: extConfig.name,
60763
+ extensionName: manifest.name,
60765
60764
  versionName,
60765
+ manifest: JSON.stringify(manifest),
60766
60766
  enableServer,
60767
60767
  enableDb,
60768
60768
  config: config2 ? JSON.stringify(config2) : void 0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirechunk/cli",
3
- "version": "0.0.2",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "scripts": {
@@ -44,22 +44,22 @@ export const createExtensionVersion = async (
44
44
  const extensionId = requireExtensionIdOptionOrEnvVar(opts, env);
45
45
  const apiToken = requireApiToken(env);
46
46
  const cwd = process.cwd();
47
- const extConfig = await requireValidExtensionDir(cwd);
47
+ const { manifest } = await requireValidExtensionDir(cwd);
48
48
  let enableServer: boolean;
49
49
  let enableDb: boolean;
50
- if (extConfig.server) {
51
- enableServer = !!extConfig.server.enable;
52
- if (extConfig.server.database?.enable && extConfig.server.enable === false) {
50
+ if (manifest.server) {
51
+ enableServer = !!manifest.server.enable;
52
+ if (manifest.server.database?.enable && manifest.server.enable === false) {
53
53
  // Server was explicitly disabled, so don't allow database.
54
54
  console.warn('WARNING: Automatically disabling database because server is disabled');
55
55
  enableDb = false;
56
- } else if (extConfig.server.database?.enable && !extConfig.server.enable) {
56
+ } else if (manifest.server.database?.enable && !manifest.server.enable) {
57
57
  // Server was unspecified, so enable it because database is enabled.
58
58
  console.warn('WARNING: Automatically enabling server because database is enabled');
59
59
  enableServer = true;
60
60
  enableDb = true;
61
61
  } else {
62
- enableDb = !!extConfig.server.database?.enable;
62
+ enableDb = !!manifest.server.database?.enable;
63
63
  }
64
64
  } else {
65
65
  enableServer = false;
@@ -84,7 +84,7 @@ export const createExtensionVersion = async (
84
84
  console.log(`Creating extension version ${versionName} (Extension ID ${extensionId})
85
85
  Server: ${enableServer ? 'enabled' : 'disabled'}
86
86
  Database: ${enableDb ? 'enabled' : 'disabled'}
87
- Components: ${Object.keys(extConfig.components ?? {}).length}`);
87
+ Components: ${Object.keys(manifest.components ?? {}).length}`);
88
88
 
89
89
  let extensionVersionId: string;
90
90
  let signedUrl: string;
@@ -98,8 +98,9 @@ export const createExtensionVersion = async (
98
98
  variables: {
99
99
  input: {
100
100
  extensionId,
101
- extensionName: extConfig.name,
101
+ extensionName: manifest.name,
102
102
  versionName,
103
+ manifest: JSON.stringify(manifest),
103
104
  enableServer,
104
105
  enableDb,
105
106
  config: config ? JSON.stringify(config) : undefined,
@@ -364,6 +364,8 @@ export type CreateExtensionVersionInput = {
364
364
  extensionId: Scalars['String']['input'];
365
365
  /** The extension name is required only so that we can validate that a user is not mistakenly trying to change the name. */
366
366
  extensionName: Scalars['String']['input'];
367
+ /** A JSON object. */
368
+ manifest: Scalars['String']['input'];
367
369
  versionName: Scalars['String']['input'];
368
370
  };
369
371
 
@@ -961,6 +963,27 @@ export type EditFormTemplateFormattedDataTemplateSuccessResult = {
961
963
  formTemplate: FormTemplate;
962
964
  };
963
965
 
966
+ export type EditFormTemplateInput = {
967
+ components?: InputMaybe<ComponentsUpdate>;
968
+ emailBodyTemplate?: InputMaybe<OptionalStringUpdate>;
969
+ emailSubjectTemplate?: InputMaybe<OptionalStringUpdate>;
970
+ id: Scalars['String']['input'];
971
+ status?: InputMaybe<PublishStatusUpdate>;
972
+ title?: InputMaybe<StringUpdate>;
973
+ useEmailBodyTemplate?: InputMaybe<BooleanUpdate>;
974
+ useEmailSubjectTemplate?: InputMaybe<BooleanUpdate>;
975
+ };
976
+
977
+ export type EditFormTemplateResult =
978
+ | AuthorizationError
979
+ | EditFormTemplateSuccessResult
980
+ | GenericUserError;
981
+
982
+ export type EditFormTemplateSuccessResult = {
983
+ __typename?: 'EditFormTemplateSuccessResult';
984
+ formTemplate: FormTemplate;
985
+ };
986
+
964
987
  export type EditLayoutInput = {
965
988
  components?: InputMaybe<ComponentsUpdate>;
966
989
  id: Scalars['String']['input'];
@@ -1320,6 +1343,7 @@ export type Form = {
1320
1343
  confirmationRedirectParameters: Array<FormConfirmationRedirectUrlParameter>;
1321
1344
  confirmationRedirectUrl?: Maybe<Scalars['String']['output']>;
1322
1345
  emailBodyTemplate?: Maybe<Scalars['String']['output']>;
1346
+ emailSubjectTemplate?: Maybe<Scalars['String']['output']>;
1323
1347
  entriesTotalCount: Scalars['Int']['output'];
1324
1348
  formattedDataTemplate?: Maybe<Scalars['String']['output']>;
1325
1349
  id: Scalars['String']['output'];
@@ -1327,6 +1351,7 @@ export type Form = {
1327
1351
  submissionActions: Array<FormSubmissionAction>;
1328
1352
  title: Scalars['String']['output'];
1329
1353
  useEmailBodyTemplate: Scalars['Boolean']['output'];
1354
+ useEmailSubjectTemplate: Scalars['Boolean']['output'];
1330
1355
  useFormattedDataTemplate: Scalars['Boolean']['output'];
1331
1356
  };
1332
1357
 
@@ -1398,12 +1423,14 @@ export type FormTemplate = {
1398
1423
  confirmationRedirectParameters: Array<FormConfirmationRedirectUrlParameter>;
1399
1424
  confirmationRedirectUrl?: Maybe<Scalars['String']['output']>;
1400
1425
  emailBodyTemplate?: Maybe<Scalars['String']['output']>;
1426
+ emailSubjectTemplate?: Maybe<Scalars['String']['output']>;
1401
1427
  formattedDataTemplate?: Maybe<Scalars['String']['output']>;
1402
1428
  id: Scalars['String']['output'];
1403
1429
  status: PublishStatus;
1404
1430
  steps: Array<FormTemplateStep>;
1405
1431
  title: Scalars['String']['output'];
1406
1432
  useEmailBodyTemplate: Scalars['Boolean']['output'];
1433
+ useEmailSubjectTemplate: Scalars['Boolean']['output'];
1407
1434
  useFormattedDataTemplate: Scalars['Boolean']['output'];
1408
1435
  };
1409
1436
 
@@ -1769,6 +1796,7 @@ export type Mutation = {
1769
1796
  editFormStepPosition: EditFormStepPositionResult;
1770
1797
  editFormSubmissionAction: FormSubmissionAction;
1771
1798
  editFormTemplate: FormTemplate;
1799
+ editFormTemplate2: EditFormTemplateResult;
1772
1800
  editFormTemplateConfirmation: FormTemplate;
1773
1801
  editFormTemplateEmailTemplate: EditFormTemplateEmailTemplateResult;
1774
1802
  editFormTemplateFormattedDataTemplate: EditFormTemplateFormattedDataTemplateResult;
@@ -2207,6 +2235,10 @@ export type MutationEditFormTemplateArgs = {
2207
2235
  title: Scalars['String']['input'];
2208
2236
  };
2209
2237
 
2238
+ export type MutationEditFormTemplate2Args = {
2239
+ input: EditFormTemplateInput;
2240
+ };
2241
+
2210
2242
  export type MutationEditFormTemplateConfirmationArgs = {
2211
2243
  confirmationAction: ConfirmationAction;
2212
2244
  confirmationMessageComponents?: InputMaybe<Scalars['String']['input']>;