@acomo/cli 1.0.17 → 1.0.19

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/dist/index.js CHANGED
@@ -5164,6 +5164,10 @@ __export(src_exports, {
5164
5164
  UserEntityToJSONTyped: () => UserEntityToJSONTyped,
5165
5165
  UserEntityTypeEnum: () => UserEntityTypeEnum,
5166
5166
  UsersApi: () => UsersApi,
5167
+ ValidateWorkflowModelSchemaRequestFromJSON: () => ValidateWorkflowModelSchemaRequestFromJSON,
5168
+ ValidateWorkflowModelSchemaRequestFromJSONTyped: () => ValidateWorkflowModelSchemaRequestFromJSONTyped,
5169
+ ValidateWorkflowModelSchemaRequestToJSON: () => ValidateWorkflowModelSchemaRequestToJSON,
5170
+ ValidateWorkflowModelSchemaRequestToJSONTyped: () => ValidateWorkflowModelSchemaRequestToJSONTyped,
5167
5171
  VoidApiResponse: () => VoidApiResponse,
5168
5172
  WorkflowModelEntityFromJSON: () => WorkflowModelEntityFromJSON,
5169
5173
  WorkflowModelEntityFromJSONTyped: () => WorkflowModelEntityFromJSONTyped,
@@ -5237,6 +5241,7 @@ __export(src_exports, {
5237
5241
  instanceOfUrlEntity: () => instanceOfUrlEntity,
5238
5242
  instanceOfUserAuthInfoEntity: () => instanceOfUserAuthInfoEntity,
5239
5243
  instanceOfUserEntity: () => instanceOfUserEntity,
5244
+ instanceOfValidateWorkflowModelSchemaRequest: () => instanceOfValidateWorkflowModelSchemaRequest,
5240
5245
  instanceOfWorkflowModelEntity: () => instanceOfWorkflowModelEntity,
5241
5246
  instanceOfWorkflowProcessEntity: () => instanceOfWorkflowProcessEntity,
5242
5247
  mapValues: () => mapValues,
@@ -8250,6 +8255,37 @@ function UserAuthInfoEntityToJSONTyped(value, ignoreDiscriminator = false) {
8250
8255
  };
8251
8256
  }
8252
8257
 
8258
+ // ../acomo-client/dist/src/client/models/ValidateWorkflowModelSchemaRequest.js
8259
+ function instanceOfValidateWorkflowModelSchemaRequest(value) {
8260
+ return true;
8261
+ }
8262
+ function ValidateWorkflowModelSchemaRequestFromJSON(json) {
8263
+ return ValidateWorkflowModelSchemaRequestFromJSONTyped(json, false);
8264
+ }
8265
+ function ValidateWorkflowModelSchemaRequestFromJSONTyped(json, ignoreDiscriminator) {
8266
+ if (json == null) {
8267
+ return json;
8268
+ }
8269
+ return {
8270
+ "definition": json["definition"] == null ? void 0 : json["definition"],
8271
+ "dataSchema": json["dataSchema"] == null ? void 0 : json["dataSchema"],
8272
+ "policy": json["policy"] == null ? void 0 : json["policy"]
8273
+ };
8274
+ }
8275
+ function ValidateWorkflowModelSchemaRequestToJSON(json) {
8276
+ return ValidateWorkflowModelSchemaRequestToJSONTyped(json, false);
8277
+ }
8278
+ function ValidateWorkflowModelSchemaRequestToJSONTyped(value, ignoreDiscriminator = false) {
8279
+ if (value == null) {
8280
+ return value;
8281
+ }
8282
+ return {
8283
+ "definition": value["definition"],
8284
+ "dataSchema": value["dataSchema"],
8285
+ "policy": value["policy"]
8286
+ };
8287
+ }
8288
+
8253
8289
  // ../acomo-client/dist/src/client/apis/AccountApi.js
8254
8290
  var AccountApi = class extends BaseAPI {
8255
8291
  async createMyOrganizationRaw(initOverrides) {
@@ -11603,6 +11639,26 @@ var SchemaApi = class extends BaseAPI {
11603
11639
  const response = await this.getWorkflowModelSchemasRaw(requestParameters, initOverrides);
11604
11640
  return await response.value();
11605
11641
  }
11642
+ async validateWorkflowModelSchemaRaw(requestParameters, initOverrides) {
11643
+ if (requestParameters["validateWorkflowModelSchemaRequest"] == null) {
11644
+ throw new RequiredError("validateWorkflowModelSchemaRequest", 'Required parameter "validateWorkflowModelSchemaRequest" was null or undefined when calling validateWorkflowModelSchema().');
11645
+ }
11646
+ const queryParameters = {};
11647
+ const headerParameters = {};
11648
+ headerParameters["Content-Type"] = "application/json";
11649
+ const response = await this.request({
11650
+ path: `/api/v1/schemas/model/validate`,
11651
+ method: "POST",
11652
+ headers: headerParameters,
11653
+ query: queryParameters,
11654
+ body: ValidateWorkflowModelSchemaRequestToJSON(requestParameters["validateWorkflowModelSchemaRequest"])
11655
+ }, initOverrides);
11656
+ return new JSONApiResponse(response);
11657
+ }
11658
+ async validateWorkflowModelSchema(requestParameters, initOverrides) {
11659
+ const response = await this.validateWorkflowModelSchemaRaw(requestParameters, initOverrides);
11660
+ return await response.value();
11661
+ }
11606
11662
  };
11607
11663
  var GetWorkflowModelSchemasTypeEnum = {
11608
11664
  Definition: "definition",
@@ -12928,7 +12984,8 @@ var operationDescriptions = {
12928
12984
  "updateWorkflowProcess": "\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u30D7\u30ED\u30BB\u30B9\u30921\u4EF6\u4FDD\u5B58\u3059\u308B\u3002",
12929
12985
  "uploadMyProcessDataFile": "\u81EA\u8EAB\u306E\u30D7\u30ED\u30BB\u30B9\u30C7\u30FC\u30BF\u306B\u7D10\u3065\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B",
12930
12986
  "uploadProcessDataFile": "\u30D7\u30ED\u30BB\u30B9\u30C7\u30FC\u30BF\u306B\u7D10\u3065\u3044\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u30A2\u30C3\u30D7\u30ED\u30FC\u30C9\u3059\u308B",
12931
- "validateExpression": "expression\u304C\u6B63\u3057\u3044\u304B\u3092\u8FD4\u3057\u307E\u3059\u3002"
12987
+ "validateExpression": "expression\u304C\u6B63\u3057\u3044\u304B\u3092\u8FD4\u3057\u307E\u3059\u3002",
12988
+ "validateWorkflowModelSchema": "\u30EF\u30FC\u30AF\u30D5\u30ED\u30FC\u30E2\u30C7\u30EB\u306E definition / dataSchema / policy \u3092 JSON Schema \u306B\u5BFE\u3057\u3066\u30D0\u30EA\u30C7\u30FC\u30B7\u30E7\u30F3\u3059\u308B\u3002\u30E2\u30C7\u30EB\u306E\u516C\u958B\u524D\u306B\u4F7F\u7528\u3059\u308B\u3002"
12932
12989
  };
12933
12990
 
12934
12991
  // src/generated/operation-params.ts
@@ -13956,6 +14013,11 @@ var operationParams = {
13956
14013
  params: [
13957
14014
  { name: "expressionJson", in: "path", required: true, type: "string", description: "" }
13958
14015
  ]
14016
+ },
14017
+ "validateWorkflowModelSchema": {
14018
+ httpMethod: "POST",
14019
+ path: "/api/v1/schemas/model/validate",
14020
+ params: []
13959
14021
  }
13960
14022
  };
13961
14023
 
@@ -14037,7 +14099,7 @@ var EXIT_CODES = {
14037
14099
  VALIDATION: 3,
14038
14100
  NOT_FOUND: 4
14039
14101
  };
14040
- async function resolveParams(positional) {
14102
+ async function resolveBody(positional) {
14041
14103
  if (positional) {
14042
14104
  try {
14043
14105
  return JSON.parse(positional);
@@ -14047,6 +14109,12 @@ async function resolveParams(positional) {
14047
14109
  }
14048
14110
  return void 0;
14049
14111
  }
14112
+ function buildClientParams(operationId, namedParams, body) {
14113
+ const paramInfo = getOperationRequestSchema(operationId);
14114
+ if (!paramInfo?.requestBody) return namedParams;
14115
+ const { dtoName } = paramInfo.requestBody;
14116
+ return { ...namedParams, [dtoName]: body ?? {} };
14117
+ }
14050
14118
  function placeholderForType(type) {
14051
14119
  if (type === "string") return "";
14052
14120
  if (type === "number" || type === "integer") return 0;
@@ -14056,13 +14124,6 @@ function placeholderForType(type) {
14056
14124
  return {};
14057
14125
  return "";
14058
14126
  }
14059
- function buildExampleParams(params) {
14060
- const out = {};
14061
- for (const p of params) {
14062
- if (p.required) out[p.name] = placeholderForType(p.type);
14063
- }
14064
- return out;
14065
- }
14066
14127
  function buildExampleBody(properties) {
14067
14128
  const out = {};
14068
14129
  for (const p of properties) {
@@ -14166,7 +14227,6 @@ function buildApiCommandHelpDescriptor(operationId) {
14166
14227
  const pathParams = paramInfo.params.filter((p) => p.in === "path").map(toParamEntry);
14167
14228
  const queryParams = paramInfo.params.filter((p) => p.in === "query").map(toParamEntry);
14168
14229
  const requestBody = paramInfo.requestBody ? {
14169
- dtoName: paramInfo.requestBody.dtoName,
14170
14230
  properties: paramInfo.requestBody.properties.map((p) => {
14171
14231
  const entry = {
14172
14232
  name: p.name,
@@ -14178,29 +14238,38 @@ function buildApiCommandHelpDescriptor(operationId) {
14178
14238
  return entry;
14179
14239
  })
14180
14240
  } : null;
14181
- const minimalArgs = {
14182
- ...buildExampleParams(paramInfo.params)
14183
- };
14184
- if (paramInfo.requestBody) {
14185
- const bodyExample = buildExampleBody(paramInfo.requestBody.properties);
14186
- for (const [k, v] of Object.entries(bodyExample)) minimalArgs[k] = v;
14187
- }
14188
- const exampleCommand = `acomo ${operationId} '${JSON.stringify(minimalArgs)}'`;
14189
- const positionals = [
14241
+ const paramOptions = paramInfo.params.map((p) => ({
14242
+ name: p.name,
14243
+ type: p.type === "number" || p.type === "integer" ? "number" : p.type === "boolean" ? "boolean" : "string",
14244
+ description: normalizeDescription(p.description || ""),
14245
+ required: p.required
14246
+ }));
14247
+ const minimalArgs = paramInfo.requestBody ? buildExampleBody(paramInfo.requestBody.properties) : null;
14248
+ const optionsPart = paramInfo.params.filter((p) => p.required).map(
14249
+ (p) => `--${p.name} ${p.example !== void 0 ? String(p.example) : `<${p.type}>`}`
14250
+ ).join(" ");
14251
+ const bodyPart = minimalArgs && Object.keys(minimalArgs).length > 0 ? ` '${JSON.stringify(minimalArgs)}'` : "";
14252
+ const exampleCommand = `acomo ${operationId}${optionsPart ? " " + optionsPart : ""}${bodyPart}`;
14253
+ const hasBody = !!paramInfo.requestBody;
14254
+ const hasParams = paramInfo.params.length > 0;
14255
+ const usageParts = [`acomo ${operationId}`];
14256
+ if (hasParams) usageParts.push("[--option value...]");
14257
+ if (hasBody) usageParts.push("[body]");
14258
+ const positionals = hasBody ? [
14190
14259
  {
14191
- name: "params",
14260
+ name: "body",
14192
14261
  type: "object",
14193
14262
  required: false,
14194
- description: "JSON \u30D1\u30E9\u30E1\u30FC\u30BF"
14263
+ description: "\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3 JSON"
14195
14264
  }
14196
- ];
14265
+ ] : [];
14197
14266
  return buildCommandHelp({
14198
14267
  command: operationId,
14199
14268
  kind: "api-command",
14200
14269
  summary,
14201
- usage: `acomo ${operationId} [params]`,
14270
+ usage: usageParts.join(" "),
14202
14271
  positionals,
14203
- options: GLOBAL_OPTIONS2,
14272
+ options: [...paramOptions, ...GLOBAL_OPTIONS2],
14204
14273
  inputSchema: {
14205
14274
  pathParams,
14206
14275
  queryParams,
@@ -14328,7 +14397,29 @@ async function main() {
14328
14397
  const pkg = JSON.parse(
14329
14398
  readFileSync4(resolve5(scriptDir, "../package.json"), "utf-8")
14330
14399
  );
14331
- const argv = yargs_default(hideBin(process.argv)).scriptName("acomo").usage("Usage: $0 <command> [options]").help().alias("h", "help").version(pkg.version).alias("v", "version");
14400
+ const argv = yargs_default(hideBin(process.argv)).scriptName("acomo").usage("Usage: $0 <command> [options]").help().alias("h", "help").version(pkg.version).alias("v", "version").fail((msg, _err, yargs) => {
14401
+ if (msg === "\u30B3\u30DE\u30F3\u30C9\u3092\u6307\u5B9A\u3057\u3066\u304F\u3060\u3055\u3044\u3002") {
14402
+ yargs.showHelp();
14403
+ process.exit(0);
14404
+ }
14405
+ const jsonMode = !process.stdout.isTTY;
14406
+ if (jsonMode) {
14407
+ console.error(
14408
+ JSON.stringify({
14409
+ error: true,
14410
+ code: "VALIDATION_ERROR",
14411
+ message: msg,
14412
+ suggestion: "\u5FC5\u9808\u30D1\u30E9\u30E1\u30FC\u30BF\u3092\u78BA\u8A8D\u3057\u3066\u304F\u3060\u3055\u3044\u3002`acomo <command> --help` \u3067\u30D1\u30E9\u30E1\u30FC\u30BF\u60C5\u5831\u3092\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002"
14413
+ })
14414
+ );
14415
+ } else {
14416
+ console.error(`\u5FC5\u9808\u30D1\u30E9\u30E1\u30FC\u30BF\u304C\u4E0D\u8DB3\u3057\u3066\u3044\u307E\u3059: ${msg}`);
14417
+ console.error(
14418
+ "`acomo <command> --help` \u3067\u30D1\u30E9\u30E1\u30FC\u30BF\u60C5\u5831\u3092\u78BA\u8A8D\u3067\u304D\u307E\u3059\u3002"
14419
+ );
14420
+ }
14421
+ process.exit(EXIT_CODES.VALIDATION);
14422
+ });
14332
14423
  argv.command(
14333
14424
  command2(),
14334
14425
  describe(),
@@ -14360,20 +14451,45 @@ async function main() {
14360
14451
  const registry = buildOperationRegistry(configuration);
14361
14452
  for (const [operationId] of registry) {
14362
14453
  const paramInfo = getOperationRequestSchema(operationId);
14454
+ const hasBody = !!paramInfo?.requestBody;
14363
14455
  argv.command(
14364
- `${operationId} [params]`,
14456
+ hasBody ? `${operationId} [body]` : operationId,
14365
14457
  operationDescriptions[operationId] ?? operationId,
14366
14458
  (y) => {
14367
- y.positional("params", {
14368
- type: "string",
14369
- description: "JSON \u30D1\u30E9\u30E1\u30FC\u30BF"
14370
- });
14459
+ if (paramInfo) {
14460
+ for (const p of paramInfo.params) {
14461
+ const yargsType = p.type === "number" || p.type === "integer" ? "number" : p.type === "boolean" ? "boolean" : "string";
14462
+ y.option(p.name, {
14463
+ type: yargsType,
14464
+ description: p.description,
14465
+ demandOption: p.required
14466
+ });
14467
+ }
14468
+ }
14469
+ if (hasBody) {
14470
+ y.positional("body", {
14471
+ type: "string",
14472
+ description: "\u30EA\u30AF\u30A8\u30B9\u30C8\u30DC\u30C7\u30A3 JSON"
14473
+ });
14474
+ }
14371
14475
  return y;
14372
14476
  },
14373
14477
  async (cmdArgv) => {
14374
14478
  try {
14375
- const params = await resolveParams(
14376
- cmdArgv.params
14479
+ const body = await resolveBody(
14480
+ cmdArgv.body
14481
+ );
14482
+ const namedParams = {};
14483
+ if (paramInfo) {
14484
+ for (const p of paramInfo.params) {
14485
+ const val = cmdArgv[p.name];
14486
+ if (val !== void 0) namedParams[p.name] = val;
14487
+ }
14488
+ }
14489
+ const clientParams = buildClientParams(
14490
+ operationId,
14491
+ namedParams,
14492
+ body
14377
14493
  );
14378
14494
  const entry = registry.get(operationId);
14379
14495
  const apiConfig = createConfiguration();
@@ -14381,7 +14497,7 @@ async function main() {
14381
14497
  apiConfig
14382
14498
  );
14383
14499
  const rawResponse = await instance[entry.method + "Raw"](
14384
- params ?? {}
14500
+ clientParams
14385
14501
  );
14386
14502
  if (!rawResponse.raw.ok) {
14387
14503
  throw new ResponseError(