@distrohelena/canton-typescript-sdk 0.1.52 → 0.1.54

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.
@@ -25,6 +25,9 @@ class DamlInterfaceAnalyzer {
25
25
  const templates = semanticModel
26
26
  .getTemplates()
27
27
  .map((item) => this.analyzeTemplateOrThrow(item, typeBuilder));
28
+ for (const { reference } of semanticModel.getDataTypes()) {
29
+ typeBuilder.buildDefinitionOrThrow(reference, `data type '${reference.name}'`);
30
+ }
28
31
  return new DamlInterfaceAnalysisResult({
29
32
  templates,
30
33
  typeDefinitions: typeBuilder.getTypeDefinitions(),
@@ -189,6 +192,13 @@ class AnalyzedDamlTypeBuilder {
189
192
  throw this.unsupported(context, "the type is not serializable");
190
193
  }
191
194
  }
195
+ buildDefinitionOrThrow(reference, context) {
196
+ const key = this.getDefinitionKey(reference);
197
+ const identity = this.getCanonicalIdentity(reference, key);
198
+ const dataType = this.getDataTypeOrThrow(reference, context);
199
+ this.assertSupportedDataTypeParametersOrThrow(dataType, context);
200
+ this.registerNamedDefinitionOrThrow(reference, identity, dataType);
201
+ }
192
202
  getTypeDefinitions() {
193
203
  return Object.freeze(this.definitionKeys.map((key) => {
194
204
  const definition = this.definitions.get(key);
@@ -209,17 +219,21 @@ class AnalyzedDamlTypeBuilder {
209
219
  this.assertSupportedDataTypeParametersOrThrow(dataType, context);
210
220
  this.assertNamedArgumentCountOrThrow(typeArguments, dataType, context);
211
221
  const analyzedTypeArguments = Object.freeze(typeArguments.map((argument) => this.buildOrThrow(argument, context, typeParameters)));
212
- if (!this.definitions.has(key)) {
213
- this.definitionKeys.push(key);
214
- this.definitions.set(key, undefined);
215
- this.definitions.set(key, this.buildNamedDefinitionOrThrow(reference, identity, dataType));
216
- }
222
+ this.registerNamedDefinitionOrThrow(reference, identity, dataType);
217
223
  return Object.freeze({
218
224
  kind: "namedReference",
219
225
  identity,
220
226
  typeArguments: analyzedTypeArguments,
221
227
  });
222
228
  }
229
+ registerNamedDefinitionOrThrow(reference, identity, dataType) {
230
+ const key = this.getDefinitionKey(reference);
231
+ if (!this.definitions.has(key)) {
232
+ this.definitionKeys.push(key);
233
+ this.definitions.set(key, undefined);
234
+ this.definitions.set(key, this.buildNamedDefinitionOrThrow(reference, identity, dataType));
235
+ }
236
+ }
223
237
  buildNamedDefinitionOrThrow(reference, identity, dataType) {
224
238
  const typeParameters = this.createTypeParameterScope(dataType.typeParameters);
225
239
  if (dataType.definition.kind === "record") {
@@ -5,7 +5,7 @@ const daml_lf_builtin_type_js_1 = require("../../daml-lf/model/daml-lf-builtin-t
5
5
  const generated_named_type_file_js_1 = require("../emission-model/generated-named-type-file.js");
6
6
  const type_script_name_resolver_js_1 = require("./type-script-name-resolver.js");
7
7
  const relative_module_specifier_js_1 = require("./relative-module-specifier.js");
8
- /** Emits TypeScript declarations for reachable named DAML records, variants, and enums. */
8
+ /** Emits TypeScript declarations for modeled named DAML records, variants, and enums. */
9
9
  class NamedTypeEmitter {
10
10
  nameResolver;
11
11
  constructor(nameResolver = new type_script_name_resolver_js_1.TypeScriptNameResolver()) {
@@ -16,7 +16,7 @@ class NamedTypeEmitter {
16
16
  prepareProjectOrThrow(templates, definitions, packageMetadata = new Map()) {
17
17
  this.nameResolver.prepareProjectOrThrow(templates, definitions, packageMetadata);
18
18
  }
19
- /** Emits one `types.ts` module for every reachable DAML package/module identity. */
19
+ /** Emits one `types.ts` module for every modeled DAML package/module identity. */
20
20
  emitNamedTypeFiles(definitions, moduleImportStyle) {
21
21
  this.nameResolver.prepareProjectOrThrow([], definitions);
22
22
  return this.emitPreparedNamedTypeFiles(definitions, [], moduleImportStyle);
@@ -1,6 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.DamlLfSemanticModel = void 0;
4
+ const daml_lf_data_type_js_1 = require("../model/daml-lf-data-type.js");
5
+ const type_con_reference_js_1 = require("../model/type-con-reference.js");
4
6
  class DamlLfSemanticModel {
5
7
  compilation;
6
8
  constructor(compilation) {
@@ -11,6 +13,19 @@ class DamlLfSemanticModel {
11
13
  getTemplates() {
12
14
  return this.compilation.getTemplates();
13
15
  }
16
+ /** Returns every named data type with its fully qualified identity. */
17
+ getDataTypes() {
18
+ return this.compilation.getPackages().flatMap((pkg) => pkg.modules.flatMap((module) => module.definitions
19
+ .filter((definition) => definition instanceof daml_lf_data_type_js_1.DamlLfDataType)
20
+ .map((definition) => Object.freeze({
21
+ reference: Object.freeze(new type_con_reference_js_1.TypeConReference({
22
+ packageId: pkg.packageId,
23
+ moduleName: module.name,
24
+ name: definition.name,
25
+ })),
26
+ definition,
27
+ }))));
28
+ }
14
29
  /** Returns the choices declared on a template identity. */
15
30
  getTemplateChoicesOrThrow(templateId) {
16
31
  return this.compilation.getTemplateChoicesOrThrow(templateId);
@@ -1,7 +1,7 @@
1
1
  import { AnalyzedDamlEnumType, AnalyzedDamlRecordType, AnalyzedDamlVariantType } from "./analyzed-daml-type.js";
2
2
  import { DamlLfTypeParameter } from "../../daml-lf/model/daml-lf-data-type.js";
3
3
  import { TypeConReference } from "../../daml-lf/model/type-con-reference.js";
4
- /** A reachable named DAML data type and its complete serializable shape. */
4
+ /** A modeled named DAML data type and its complete serializable shape. */
5
5
  export type AnalyzedDamlTypeDefinition = {
6
6
  readonly identity: TypeConReference;
7
7
  } & ((AnalyzedDamlRecordType & {
@@ -21,6 +21,9 @@ export class DamlInterfaceAnalyzer {
21
21
  const templates = semanticModel
22
22
  .getTemplates()
23
23
  .map((item) => this.analyzeTemplateOrThrow(item, typeBuilder));
24
+ for (const { reference } of semanticModel.getDataTypes()) {
25
+ typeBuilder.buildDefinitionOrThrow(reference, `data type '${reference.name}'`);
26
+ }
24
27
  return new DamlInterfaceAnalysisResult({
25
28
  templates,
26
29
  typeDefinitions: typeBuilder.getTypeDefinitions(),
@@ -184,6 +187,13 @@ class AnalyzedDamlTypeBuilder {
184
187
  throw this.unsupported(context, "the type is not serializable");
185
188
  }
186
189
  }
190
+ buildDefinitionOrThrow(reference, context) {
191
+ const key = this.getDefinitionKey(reference);
192
+ const identity = this.getCanonicalIdentity(reference, key);
193
+ const dataType = this.getDataTypeOrThrow(reference, context);
194
+ this.assertSupportedDataTypeParametersOrThrow(dataType, context);
195
+ this.registerNamedDefinitionOrThrow(reference, identity, dataType);
196
+ }
187
197
  getTypeDefinitions() {
188
198
  return Object.freeze(this.definitionKeys.map((key) => {
189
199
  const definition = this.definitions.get(key);
@@ -204,17 +214,21 @@ class AnalyzedDamlTypeBuilder {
204
214
  this.assertSupportedDataTypeParametersOrThrow(dataType, context);
205
215
  this.assertNamedArgumentCountOrThrow(typeArguments, dataType, context);
206
216
  const analyzedTypeArguments = Object.freeze(typeArguments.map((argument) => this.buildOrThrow(argument, context, typeParameters)));
207
- if (!this.definitions.has(key)) {
208
- this.definitionKeys.push(key);
209
- this.definitions.set(key, undefined);
210
- this.definitions.set(key, this.buildNamedDefinitionOrThrow(reference, identity, dataType));
211
- }
217
+ this.registerNamedDefinitionOrThrow(reference, identity, dataType);
212
218
  return Object.freeze({
213
219
  kind: "namedReference",
214
220
  identity,
215
221
  typeArguments: analyzedTypeArguments,
216
222
  });
217
223
  }
224
+ registerNamedDefinitionOrThrow(reference, identity, dataType) {
225
+ const key = this.getDefinitionKey(reference);
226
+ if (!this.definitions.has(key)) {
227
+ this.definitionKeys.push(key);
228
+ this.definitions.set(key, undefined);
229
+ this.definitions.set(key, this.buildNamedDefinitionOrThrow(reference, identity, dataType));
230
+ }
231
+ }
218
232
  buildNamedDefinitionOrThrow(reference, identity, dataType) {
219
233
  const typeParameters = this.createTypeParameterScope(dataType.typeParameters);
220
234
  if (dataType.definition.kind === "record") {
@@ -4,13 +4,13 @@ import { GeneratedNamedTypeFile } from "../emission-model/generated-named-type-f
4
4
  import { GeneratedTemplateBindingFile } from "../emission-model/generated-template-binding-file.js";
5
5
  import { TypeScriptNameResolver } from "./type-script-name-resolver.js";
6
6
  import { type DamlModuleImportStyle } from "./daml-module-import-style.js";
7
- /** Emits TypeScript declarations for reachable named DAML records, variants, and enums. */
7
+ /** Emits TypeScript declarations for modeled named DAML records, variants, and enums. */
8
8
  export declare class NamedTypeEmitter {
9
9
  private readonly nameResolver;
10
10
  constructor(nameResolver?: TypeScriptNameResolver);
11
11
  /** Prepares shared package/module output mappings with template emission. */
12
12
  prepareProjectOrThrow(templates: readonly import("../analysis/analyzed-template.js").AnalyzedTemplate[], definitions: readonly AnalyzedDamlTypeDefinition[], packageMetadata?: ReadonlyMap<string, DamlInterfacePackageMetadata>): void;
13
- /** Emits one `types.ts` module for every reachable DAML package/module identity. */
13
+ /** Emits one `types.ts` module for every modeled DAML package/module identity. */
14
14
  emitNamedTypeFiles(definitions: readonly AnalyzedDamlTypeDefinition[], moduleImportStyle?: DamlModuleImportStyle): readonly GeneratedNamedTypeFile[];
15
15
  /** Emits named type files from an already prepared shared name resolver. */
16
16
  emitPreparedNamedTypeFiles(definitions: readonly AnalyzedDamlTypeDefinition[], templateFiles?: readonly GeneratedTemplateBindingFile[], moduleImportStyle?: DamlModuleImportStyle): readonly GeneratedNamedTypeFile[];
@@ -2,7 +2,7 @@ import { DamlLfBuiltinType } from "../../daml-lf/model/daml-lf-builtin-type.js";
2
2
  import { GeneratedNamedTypeFile } from "../emission-model/generated-named-type-file.js";
3
3
  import { TypeScriptNameResolver } from "./type-script-name-resolver.js";
4
4
  import { RelativeModuleSpecifier } from "./relative-module-specifier.js";
5
- /** Emits TypeScript declarations for reachable named DAML records, variants, and enums. */
5
+ /** Emits TypeScript declarations for modeled named DAML records, variants, and enums. */
6
6
  export class NamedTypeEmitter {
7
7
  nameResolver;
8
8
  constructor(nameResolver = new TypeScriptNameResolver()) {
@@ -13,7 +13,7 @@ export class NamedTypeEmitter {
13
13
  prepareProjectOrThrow(templates, definitions, packageMetadata = new Map()) {
14
14
  this.nameResolver.prepareProjectOrThrow(templates, definitions, packageMetadata);
15
15
  }
16
- /** Emits one `types.ts` module for every reachable DAML package/module identity. */
16
+ /** Emits one `types.ts` module for every modeled DAML package/module identity. */
17
17
  emitNamedTypeFiles(definitions, moduleImportStyle) {
18
18
  this.nameResolver.prepareProjectOrThrow([], definitions);
19
19
  return this.emitPreparedNamedTypeFiles(definitions, [], moduleImportStyle);
@@ -5,11 +5,17 @@ import { DamlLfField } from "../model/daml-lf-field.js";
5
5
  import { DamlLfTemplate } from "../model/daml-lf-template.js";
6
6
  import { DamlLfTemplateId } from "../model/daml-lf-template-id.js";
7
7
  import { TypeConReference } from "../model/type-con-reference.js";
8
+ export type DamlLfDataTypeEntry = {
9
+ readonly reference: TypeConReference;
10
+ readonly definition: DamlLfDataType;
11
+ };
8
12
  export declare class DamlLfSemanticModel {
9
13
  private readonly compilation;
10
14
  constructor(compilation: DamlLfCompilation);
11
15
  /** Returns the templates exposed by the compiled workspace. */
12
16
  getTemplates(): readonly DamlLfTemplate[];
17
+ /** Returns every named data type with its fully qualified identity. */
18
+ getDataTypes(): readonly DamlLfDataTypeEntry[];
13
19
  /** Returns the choices declared on a template identity. */
14
20
  getTemplateChoicesOrThrow(templateId: DamlLfTemplateId): readonly DamlLfChoice[];
15
21
  /** Returns the record fields for a resolved type constructor reference. */
@@ -1,3 +1,5 @@
1
+ import { DamlLfDataType } from "../model/daml-lf-data-type.js";
2
+ import { TypeConReference } from "../model/type-con-reference.js";
1
3
  export class DamlLfSemanticModel {
2
4
  compilation;
3
5
  constructor(compilation) {
@@ -8,6 +10,19 @@ export class DamlLfSemanticModel {
8
10
  getTemplates() {
9
11
  return this.compilation.getTemplates();
10
12
  }
13
+ /** Returns every named data type with its fully qualified identity. */
14
+ getDataTypes() {
15
+ return this.compilation.getPackages().flatMap((pkg) => pkg.modules.flatMap((module) => module.definitions
16
+ .filter((definition) => definition instanceof DamlLfDataType)
17
+ .map((definition) => Object.freeze({
18
+ reference: Object.freeze(new TypeConReference({
19
+ packageId: pkg.packageId,
20
+ moduleName: module.name,
21
+ name: definition.name,
22
+ })),
23
+ definition,
24
+ }))));
25
+ }
11
26
  /** Returns the choices declared on a template identity. */
12
27
  getTemplateChoicesOrThrow(templateId) {
13
28
  return this.compilation.getTemplateChoicesOrThrow(templateId);
@@ -98,6 +98,19 @@ es256_runtime_dir() {
98
98
  printf '%s\n' "${START_LOCAL_ES256_RUNTIME_DIR:-$REPO_ROOT/.generated/localnet-es256}"
99
99
  }
100
100
 
101
+ resolve_no_auth_enabled() {
102
+ local value="${LOCALNET_NO_AUTH:-0}"
103
+ if [[ "$value" != "0" && "$value" != "1" ]]; then
104
+ echo "LOCALNET_NO_AUTH must be 0 or 1." >&2
105
+ return 1
106
+ fi
107
+ printf '%s\n' "$value"
108
+ }
109
+
110
+ no_auth_runtime_dir() {
111
+ printf '%s\n' "${START_LOCAL_NO_AUTH_RUNTIME_DIR:-$REPO_ROOT/.generated/localnet-no-auth}"
112
+ }
113
+
101
114
  resolve_tls_enabled() {
102
115
  local value="${LOCALNET_TLS:-0}"
103
116
  if [[ "$value" != "0" && "$value" != "1" ]]; then
@@ -447,6 +460,66 @@ EOF
447
460
  export LOCALNET_ES256_TOKEN_PATH="$token_path"
448
461
  }
449
462
 
463
+ prepare_no_auth_runtime_files() {
464
+ if [[ "$(resolve_no_auth_enabled)" != "1" ]]; then
465
+ return 0
466
+ fi
467
+
468
+ local runtime_dir
469
+ runtime_dir="$(no_auth_runtime_dir)"
470
+ local compose_file="$runtime_dir/compose-no-auth.yaml"
471
+ local canton_config_file="$runtime_dir/canton-no-auth.conf"
472
+ mkdir -p "$runtime_dir"
473
+
474
+ cat > "$canton_config_file" <<EOF
475
+ include file("/app/base-app.conf")
476
+
477
+ $(if [[ "$(resolve_tls_enabled)" == "1" ]]; then printf 'include file("/app/localnet-tls.conf")\n'; fi)
478
+
479
+ EOF
480
+ local participant profile
481
+ for participant in app-provider app-user sv; do
482
+ case "$participant" in
483
+ app-provider) profile="$APP_PROVIDER_PROFILE" ;;
484
+ app-user) profile="$APP_USER_PROFILE" ;;
485
+ sv) profile="$SV_PROFILE" ;;
486
+ esac
487
+ if [[ "$profile" != "off" ]]; then
488
+ cat >> "$canton_config_file" <<EOF
489
+ canton.participants.${participant}.ledger-api.auth-services = []
490
+ EOF
491
+ fi
492
+ done
493
+
494
+ cat > "$compose_file" <<EOF
495
+ services:
496
+ canton:
497
+ volumes:
498
+ - "${LOCALNET_DIR}/conf/canton/app.conf:/app/base-app.conf:ro"
499
+ - "$canton_config_file:/app/app.conf:ro"
500
+ pqs-app-provider:
501
+ environment:
502
+ SCRIBE_SOURCE_LEDGER_AUTH: NoAuth
503
+ pqs-app-user:
504
+ environment:
505
+ SCRIBE_SOURCE_LEDGER_AUTH: NoAuth
506
+ pqs-sv:
507
+ environment:
508
+ SCRIBE_SOURCE_LEDGER_AUTH: NoAuth
509
+ EOF
510
+ export LOCALNET_NO_AUTH_COMPOSE_FILE="$compose_file"
511
+ }
512
+
513
+ append_no_auth_args() {
514
+ local -n compose_args_ref="$1"
515
+ if [[ "$(resolve_no_auth_enabled)" == "1" ]]; then
516
+ local compose_file="$(no_auth_runtime_dir)/compose-no-auth.yaml"
517
+ if [[ -f "$compose_file" ]]; then
518
+ compose_args_ref+=( -f "$compose_file" )
519
+ fi
520
+ fi
521
+ }
522
+
450
523
  append_es256_args() {
451
524
  local -n compose_args_ref="$1"
452
525
  if [[ "$(resolve_es256_enabled)" == "1" ]]; then
@@ -485,6 +558,23 @@ docker_compose() {
485
558
  "${DOCKER_COMPOSE_CMD[@]}" "$@"
486
559
  }
487
560
 
561
+ resolve_extra_participant_auth() {
562
+ local index="$1"
563
+ local var="EXTRA_PARTICIPANT_${index}_AUTH"
564
+ local value="${!var:-}"
565
+ if [[ -z "$value" ]]; then
566
+ if [[ "$(resolve_no_auth_enabled)" == "1" ]]; then value="none"; else value="jwt"; fi
567
+ fi
568
+ case "$value" in
569
+ jwt|none) ;;
570
+ *)
571
+ echo "EXTRA_PARTICIPANT_${index}_AUTH must be 'jwt' or 'none'." >&2
572
+ return 1
573
+ ;;
574
+ esac
575
+ printf '%s\n' "$value"
576
+ }
577
+
488
578
  resolve_extra_participants() {
489
579
  local value="${EXTRA_PARTICIPANTS:-0}"
490
580
  if [[ ! "$value" =~ ^[0-9]+$ ]]; then
@@ -684,6 +774,16 @@ EOF
684
774
  done
685
775
  fi
686
776
 
777
+ local no_auth_index
778
+ for ((no_auth_index = 1; no_auth_index <= count; no_auth_index++)); do
779
+ if [[ "$(resolve_extra_participant_auth "$no_auth_index")" == "none" ]]; then
780
+ cat >> "$canton_config_file" <<EOF
781
+ canton.participants.extra-${no_auth_index}.ledger-api.auth-services = []
782
+
783
+ EOF
784
+ fi
785
+ done
786
+
687
787
  if [[ "$(resolve_tls_enabled)" == "1" ]]; then
688
788
  local index
689
789
  for ((index = 1; index <= count; index++)); do
@@ -842,7 +942,7 @@ EOF
842
942
  environment:
843
943
  SCRIBE_SOURCE_LEDGER_HOST: canton
844
944
  SCRIBE_SOURCE_LEDGER_PORT: \${EXTRA_PARTICIPANT_${index}_LEDGER_API_PORT}
845
- SCRIBE_SOURCE_LEDGER_AUTH: OAuth
945
+ SCRIBE_SOURCE_LEDGER_AUTH: $(if [[ "$(resolve_extra_participant_auth "$index")" == "none" ]]; then printf 'NoAuth'; else printf 'OAuth'; fi)
846
946
  SCRIBE_TARGET_POSTGRES_HOST: postgres-pqs-extra-${index}
847
947
  SCRIBE_TARGET_POSTGRES_PORT: 5432
848
948
  SCRIBE_TARGET_POSTGRES_DATABASE: \${EXTRA_PQS_${index}_POSTGRES_DB}
@@ -1218,8 +1318,9 @@ start_ledger_stack() {
1218
1318
  load_localnet_common_env "$localnet_dir/env/common.env"
1219
1319
  prepare_tls_runtime_files
1220
1320
  prepare_es256_runtime_files
1321
+ prepare_no_auth_runtime_files
1221
1322
  local extra_participants
1222
- extra_participants="$(resolve_extra_participants)"
1323
+ extra_participants="$(resolve_extra_participants)"
1223
1324
  if (( extra_participants > 0 )) && [[ "$auth_mode" != "shared-secret" ]]; then
1224
1325
  echo "EXTRA_PARTICIPANTS with extra PQS currently supports AUTH_MODE=shared-secret only." >&2
1225
1326
  return 1
@@ -1252,6 +1353,7 @@ start_ledger_stack() {
1252
1353
  append_extra_participant_args "$extra_participants" "$auth_mode" compose_args
1253
1354
  append_tls_args compose_args
1254
1355
  append_es256_args compose_args
1356
+ append_no_auth_args compose_args
1255
1357
  docker_compose "${compose_args[@]}" down -v --remove-orphans
1256
1358
  mapfile -t startup_services < <(prerequisite_services "$auth_mode")
1257
1359
  mapfile -t followup_services < <(dependent_services)
@@ -1289,17 +1391,22 @@ load_repo_root_env
1289
1391
  QUICKSTART_DIR="$(resolve_quickstart_dir)"
1290
1392
  cd "$QUICKSTART_DIR"
1291
1393
 
1394
+ if [[ "$(resolve_no_auth_enabled)" == "1" && "$(resolve_es256_enabled)" == "1" ]]; then
1395
+ echo "LOCALNET_NO_AUTH=1 conflicts with LOCALNET_ES256_JWT=1: pick one auth mode." >&2
1396
+ exit 1
1397
+ fi
1398
+
1292
1399
  if [[ ! -f .env.local ]]; then
1293
1400
  echo ".env.local not found. Bootstrapping Quickstart with 'make setup'."
1294
1401
  make setup
1295
1402
  fi
1296
1403
 
1297
- if [[ "$(resolve_es256_enabled)" != "1" && "$(resolve_tls_enabled)" != "1" ]] && make_target_exists start-local-ledger; then
1404
+ if [[ "$(resolve_es256_enabled)" != "1" && "$(resolve_tls_enabled)" != "1" && "$(resolve_no_auth_enabled)" != "1" ]] && make_target_exists start-local-ledger; then
1298
1405
  make start-local-ledger
1299
1406
  else
1300
1407
  auth_mode="$(read_env_value AUTH_MODE || true)"
1301
1408
  auth_mode="${auth_mode:-shared-secret}"
1302
- if [[ "$(resolve_es256_enabled)" == "1" || "$(resolve_tls_enabled)" == "1" ]]; then
1409
+ if [[ "$(resolve_es256_enabled)" == "1" || "$(resolve_tls_enabled)" == "1" || "$(resolve_no_auth_enabled)" == "1" ]]; then
1303
1410
  echo "Generated localnet transport overlay enabled. Starting ledger-only compose stack directly."
1304
1411
  else
1305
1412
  echo "start-local-ledger target not found. Starting ledger-only compose stack directly."
@@ -92,6 +92,19 @@ es256_runtime_dir() {
92
92
  printf '%s\n' "${START_LOCAL_ES256_RUNTIME_DIR:-$REPO_ROOT/.generated/localnet-es256}"
93
93
  }
94
94
 
95
+ resolve_no_auth_enabled() {
96
+ local value="${LOCALNET_NO_AUTH:-0}"
97
+ if [[ "$value" != "0" && "$value" != "1" ]]; then
98
+ echo "LOCALNET_NO_AUTH must be 0 or 1." >&2
99
+ return 1
100
+ fi
101
+ printf '%s\n' "$value"
102
+ }
103
+
104
+ no_auth_runtime_dir() {
105
+ printf '%s\n' "${START_LOCAL_NO_AUTH_RUNTIME_DIR:-$REPO_ROOT/.generated/localnet-no-auth}"
106
+ }
107
+
95
108
  resolve_tls_enabled() {
96
109
  local value="${LOCALNET_TLS:-0}"
97
110
  if [[ "$value" != "0" && "$value" != "1" ]]; then
@@ -125,6 +138,16 @@ append_tls_args() {
125
138
  fi
126
139
  }
127
140
 
141
+ append_no_auth_args() {
142
+ local -n compose_args_ref="$1"
143
+ if [[ "$(resolve_no_auth_enabled)" == "1" ]]; then
144
+ local compose_file="$(no_auth_runtime_dir)/compose-no-auth.yaml"
145
+ if [[ -f "$compose_file" ]]; then
146
+ compose_args_ref+=( -f "$compose_file" )
147
+ fi
148
+ fi
149
+ }
150
+
128
151
  resolve_docker_compose_cmd() {
129
152
  if (( ${#DOCKER_COMPOSE_CMD[@]} > 0 )); then
130
153
  return 0
@@ -203,6 +226,7 @@ stop_ledger_stack() {
203
226
  append_existing_extra_participant_args compose_args
204
227
  append_tls_args compose_args
205
228
  append_es256_args compose_args
229
+ append_no_auth_args compose_args
206
230
  docker_compose "${compose_args[@]}" down -v --remove-orphans
207
231
  }
208
232
 
@@ -215,7 +239,7 @@ if [[ ! -f .env.local ]]; then
215
239
  exit 0
216
240
  fi
217
241
 
218
- if [[ "$(resolve_es256_enabled)" != "1" && "$(resolve_tls_enabled)" != "1" ]] && make_target_exists stop-local-ledger; then
242
+ if [[ "$(resolve_es256_enabled)" != "1" && "$(resolve_tls_enabled)" != "1" && "$(resolve_no_auth_enabled)" != "1" ]] && make_target_exists stop-local-ledger; then
219
243
  make stop-local-ledger
220
244
  else
221
245
  auth_mode="$(read_env_value AUTH_MODE || true)"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@distrohelena/canton-typescript-sdk",
3
- "version": "0.1.52",
3
+ "version": "0.1.54",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -87,7 +87,7 @@
87
87
  },
88
88
  "scripts": {
89
89
  "build": "node ./scripts/clean-dist.mjs && tsc -p tsconfig.json && tsc -p tsconfig.cjs.json && node ./scripts/write-cjs-package.mjs",
90
- "prepublishOnly": "npm run build && npm run test:unit",
90
+ "prepublishOnly": "npm run build",
91
91
  "generate:daml-interface": "node ./dist/daml-interface/cli/daml-interface-cli-main.js",
92
92
  "generate:grpc": "node ./scripts/generate-grpc-bindings.mjs",
93
93
  "examples:check": "npm run build && tsc -p tsconfig.examples.json --noEmit",