@algorandfoundation/algokit-client-generator 7.0.0-alpha.1 → 7.0.0-alpha.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.
Files changed (137) hide show
  1. package/cli.js.map +1 -0
  2. package/cli.mjs.map +1 -0
  3. package/{src/client → client}/app-client-context.js +3 -2
  4. package/client/app-client-context.js.map +1 -0
  5. package/{src/client → client}/app-client-context.mjs +3 -2
  6. package/client/app-client-context.mjs.map +1 -0
  7. package/client/app-client.js.map +1 -0
  8. package/client/app-client.mjs.map +1 -0
  9. package/client/app-factory.js.map +1 -0
  10. package/client/app-factory.mjs.map +1 -0
  11. package/{src/client → client}/app-types.js +7 -0
  12. package/client/app-types.js.map +1 -0
  13. package/{src/client → client}/app-types.mjs +8 -1
  14. package/client/app-types.mjs.map +1 -0
  15. package/client/call-composer-types.js.map +1 -0
  16. package/client/call-composer-types.mjs.map +1 -0
  17. package/client/call-composer.js.map +1 -0
  18. package/client/call-composer.mjs.map +1 -0
  19. package/client/deploy-types.js.map +1 -0
  20. package/client/deploy-types.mjs.map +1 -0
  21. package/client/generate.js.map +1 -0
  22. package/client/generate.mjs.map +1 -0
  23. package/client/generator-context.js.map +1 -0
  24. package/client/generator-context.mjs.map +1 -0
  25. package/client/helpers/contains-non-void-method.js.map +1 -0
  26. package/client/helpers/contains-non-void-method.mjs.map +1 -0
  27. package/client/helpers/get-equivalent-type.js.map +1 -0
  28. package/client/helpers/get-equivalent-type.mjs.map +1 -0
  29. package/{src/client → client}/imports.js +2 -2
  30. package/client/imports.js.map +1 -0
  31. package/{src/client → client}/imports.mjs +2 -2
  32. package/client/imports.mjs.map +1 -0
  33. package/client/params-factory.js.map +1 -0
  34. package/client/params-factory.mjs.map +1 -0
  35. package/client/utility-types.js.map +1 -0
  36. package/client/utility-types.mjs.map +1 -0
  37. package/output/writer.js.map +1 -0
  38. package/output/writer.mjs.map +1 -0
  39. package/package.json +2 -2
  40. package/schema/load.js.map +1 -0
  41. package/schema/load.mjs.map +1 -0
  42. package/util/boom.js.map +1 -0
  43. package/util/boom.mjs.map +1 -0
  44. package/util/color-console.js.map +1 -0
  45. package/util/color-console.mjs.map +1 -0
  46. package/util/sanitization.js.map +1 -0
  47. package/util/sanitization.mjs.map +1 -0
  48. package/src/cli.js.map +0 -1
  49. package/src/cli.mjs.map +0 -1
  50. package/src/client/app-client-context.js.map +0 -1
  51. package/src/client/app-client-context.mjs.map +0 -1
  52. package/src/client/app-client.js.map +0 -1
  53. package/src/client/app-client.mjs.map +0 -1
  54. package/src/client/app-factory.js.map +0 -1
  55. package/src/client/app-factory.mjs.map +0 -1
  56. package/src/client/app-types.js.map +0 -1
  57. package/src/client/app-types.mjs.map +0 -1
  58. package/src/client/call-composer-types.js.map +0 -1
  59. package/src/client/call-composer-types.mjs.map +0 -1
  60. package/src/client/call-composer.js.map +0 -1
  61. package/src/client/call-composer.mjs.map +0 -1
  62. package/src/client/deploy-types.js.map +0 -1
  63. package/src/client/deploy-types.mjs.map +0 -1
  64. package/src/client/generate.js.map +0 -1
  65. package/src/client/generate.mjs.map +0 -1
  66. package/src/client/generator-context.js.map +0 -1
  67. package/src/client/generator-context.mjs.map +0 -1
  68. package/src/client/helpers/contains-non-void-method.js.map +0 -1
  69. package/src/client/helpers/contains-non-void-method.mjs.map +0 -1
  70. package/src/client/helpers/get-equivalent-type.js.map +0 -1
  71. package/src/client/helpers/get-equivalent-type.mjs.map +0 -1
  72. package/src/client/imports.js.map +0 -1
  73. package/src/client/imports.mjs.map +0 -1
  74. package/src/client/params-factory.js.map +0 -1
  75. package/src/client/params-factory.mjs.map +0 -1
  76. package/src/client/utility-types.js.map +0 -1
  77. package/src/client/utility-types.mjs.map +0 -1
  78. package/src/output/writer.js.map +0 -1
  79. package/src/output/writer.mjs.map +0 -1
  80. package/src/schema/load.js.map +0 -1
  81. package/src/schema/load.mjs.map +0 -1
  82. package/src/util/boom.js.map +0 -1
  83. package/src/util/boom.mjs.map +0 -1
  84. package/src/util/color-console.js.map +0 -1
  85. package/src/util/color-console.mjs.map +0 -1
  86. package/src/util/sanitization.js.map +0 -1
  87. package/src/util/sanitization.mjs.map +0 -1
  88. /package/{src/cli.js → cli.js} +0 -0
  89. /package/{src/cli.mjs → cli.mjs} +0 -0
  90. /package/{src/client → client}/app-client.js +0 -0
  91. /package/{src/client → client}/app-client.mjs +0 -0
  92. /package/{src/client → client}/app-factory.js +0 -0
  93. /package/{src/client → client}/app-factory.mjs +0 -0
  94. /package/{src/client → client}/call-composer-types.js +0 -0
  95. /package/{src/client → client}/call-composer-types.mjs +0 -0
  96. /package/{src/client → client}/call-composer.js +0 -0
  97. /package/{src/client → client}/call-composer.mjs +0 -0
  98. /package/{src/client → client}/deploy-types.js +0 -0
  99. /package/{src/client → client}/deploy-types.mjs +0 -0
  100. /package/{src/client → client}/generate.js +0 -0
  101. /package/{src/client → client}/generate.mjs +0 -0
  102. /package/{src/client → client}/generator-context.js +0 -0
  103. /package/{src/client → client}/generator-context.mjs +0 -0
  104. /package/{src/client → client}/helpers/contains-non-void-method.js +0 -0
  105. /package/{src/client → client}/helpers/contains-non-void-method.mjs +0 -0
  106. /package/{src/client → client}/helpers/get-equivalent-type.js +0 -0
  107. /package/{src/client → client}/helpers/get-equivalent-type.mjs +0 -0
  108. /package/{src/client → client}/params-factory.js +0 -0
  109. /package/{src/client → client}/params-factory.mjs +0 -0
  110. /package/{src/client → client}/utility-types.js +0 -0
  111. /package/{src/client → client}/utility-types.mjs +0 -0
  112. /package/{src/index.js → index.js} +0 -0
  113. /package/{src/index.js.map → index.js.map} +0 -0
  114. /package/{src/index.mjs → index.mjs} +0 -0
  115. /package/{src/index.mjs.map → index.mjs.map} +0 -0
  116. /package/{src/output → output}/writer.js +0 -0
  117. /package/{src/output → output}/writer.mjs +0 -0
  118. /package/{src/schema → schema}/application.schema.json.js +0 -0
  119. /package/{src/schema → schema}/application.schema.json.js.map +0 -0
  120. /package/{src/schema → schema}/application.schema.json.mjs +0 -0
  121. /package/{src/schema → schema}/application.schema.json.mjs.map +0 -0
  122. /package/{src/schema → schema}/arc56.schema.json.js +0 -0
  123. /package/{src/schema → schema}/arc56.schema.json.js.map +0 -0
  124. /package/{src/schema → schema}/arc56.schema.json.mjs +0 -0
  125. /package/{src/schema → schema}/arc56.schema.json.mjs.map +0 -0
  126. /package/{src/schema → schema}/contract.schema.json.js +0 -0
  127. /package/{src/schema → schema}/contract.schema.json.js.map +0 -0
  128. /package/{src/schema → schema}/contract.schema.json.mjs +0 -0
  129. /package/{src/schema → schema}/contract.schema.json.mjs.map +0 -0
  130. /package/{src/schema → schema}/load.js +0 -0
  131. /package/{src/schema → schema}/load.mjs +0 -0
  132. /package/{src/util → util}/boom.js +0 -0
  133. /package/{src/util → util}/boom.mjs +0 -0
  134. /package/{src/util → util}/color-console.js +0 -0
  135. /package/{src/util → util}/color-console.mjs +0 -0
  136. /package/{src/util → util}/sanitization.js +0 -0
  137. /package/{src/util → util}/sanitization.mjs +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"deploy-types.mjs","sources":["../../../src/client/deploy-types.ts"],"sourcesContent":["import { DecIndent, DocumentParts, IncIndent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { isAbiMethod } from './app-client-context'\n\nexport function* deployTypes({ app, sanitizer }: GeneratorContext): DocumentParts {\n const name = app.name.makeSafeTypeIdentifier\n\n if (app.createMethods.length) {\n yield* jsDoc('Defines supported create method params for this smart contract')\n yield `export type ${name}CreateCallParams =`\n yield IncIndent\n\n for (const method of app.createMethods) {\n const onComplete = method.createActions.inputType\n if (!isAbiMethod(method)) {\n yield `| Expand<AppClientBareCallParams & {method?: never} & ${onComplete.typeLiteral} & CreateSchema>`\n } else {\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method.signature)\n const uniqueName = method.uniqueName.original\n if (uniqueName !== method.signature) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'} & ${onComplete.typeLiteral} & CreateSchema>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'} & ${onComplete.typeLiteral} & CreateSchema>`\n }\n }\n yield DecIndent\n }\n if (app.updateMethods.length) {\n yield* jsDoc('Defines supported update method params for this smart contract')\n yield `export type ${name}UpdateCallParams =`\n yield IncIndent\n\n for (const method of app.updateMethods) {\n if (!isAbiMethod(method)) {\n yield `| Expand<AppClientBareCallParams> & {method?: never}`\n } else {\n const uniqueName = method.uniqueName.original\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method.signature)\n if (uniqueName !== method.signature) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n if (app.deleteMethods.length) {\n yield* jsDoc('Defines supported delete method params for this smart contract')\n yield `export type ${name}DeleteCallParams =`\n yield IncIndent\n for (const method of app.deleteMethods) {\n if (!isAbiMethod(method)) {\n yield `| Expand<AppClientBareCallParams> & {method?: never}`\n } else {\n const uniqueName = method.uniqueName.original\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(method.signature)\n if (uniqueName !== method.signature) {\n const methodName = sanitizer.makeSafeStringTypeLiteral(uniqueName)\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodName}'}>`\n }\n yield `| Expand<CallParams<${name}Args['obj']['${methodSigSafe}'] | ${name}Args['tuple']['${methodSigSafe}']> & {method: '${methodSigSafe}'}>`\n }\n }\n yield DecIndent\n }\n\n yield* jsDoc('Defines arguments required for the deploy method.')\n yield `export type ${name}DeployParams = Expand<Omit<AppFactoryDeployParams, 'createParams' | 'updateParams' | 'deleteParams'> & {`\n yield IncIndent\n if (app.createMethods.length) {\n yield* jsDoc(\n 'Create transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `createParams?: ${name}CreateCallParams`\n }\n if (app.updateMethods.length) {\n yield* jsDoc(\n 'Update transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `updateParams?: ${name}UpdateCallParams`\n }\n if (app.deleteMethods.length) {\n yield* jsDoc(\n 'Delete transaction parameters to use if a create needs to be issued as part of deployment; use `method` to define ABI call (if available) or leave out for a bare call (if available)',\n )\n yield `deleteParams?: ${name}DeleteCallParams`\n }\n yield DecIndent\n yield `}>`\n yield NewLine\n}\n"],"names":[],"mappings":";;;AAIM,UAAW,WAAW,CAAC,EAAE,GAAG,EAAE,SAAS,EAAoB,EAAA;AAC/D,IAAA,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,sBAAsB;AAE5C,IAAA,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,KAAK,CAAC,gEAAgE,CAAC;QAC9E,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,kBAAA,CAAoB;AAC7C,QAAA,MAAM,SAAS;AAEf,QAAA,KAAK,MAAM,MAAM,IAAI,GAAG,CAAC,aAAa,EAAE;AACtC,YAAA,MAAM,UAAU,GAAG,MAAM,CAAC,aAAa,CAAC,SAAS;AACjD,YAAA,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE;AACxB,gBAAA,MAAM,CAAA,sDAAA,EAAyD,UAAU,CAAC,WAAW,kBAAkB;YACzG;iBAAO;gBACL,MAAM,aAAa,GAAG,SAAS,CAAC,yBAAyB,CAAC,MAAM,CAAC,S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AAmB,aAAa,CAAA,GAAA,CAAK;YAChJ;QACF;AACA,QAAA,MAAM,SAAS;IACjB;AAEA,IAAA,OAAO,KAAK,CAAC,mDAAmD,CAAC;IACjE,MAAM,CAAA,YAAA,EAAe,IAAI,CAAA,wGAAA,CAA0G;AACnI,IAAA,MAAM,SAAS;AACf,IAAA,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,IAAI,GAAG,CAAC,aAAa,CAAC,MAAM,EAAE;AAC5B,QAAA,OAAO,KAAK,CACV,uLAAuL,CACxL;QACD,MAAM,CAAA,eAAA,EAAkB,IAAI,CAAA,gBAAA,CAAkB;IAChD;AACA,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,IAAI;AACV,IAAA,MAAM,OAAO;AACf;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.js","sources":["../../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, ProgramSourceInfo, StructField } from '@algorandfoundation/algokit-utils/abi'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\n yield `/* eslint-disable */`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^10`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":["createGeneratorContext","imports","inline","NewLine","utilityTypes","appTypes","deployTypes","paramsFactory","appFactory","appClient","callComposerType"],"mappings":";;;;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B;AACH;AAEA,SAAS,aAAa,CAAC,GAAkB,EAAE,OAAyB,EAAA;AAClE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC;;AAG5C,IAAA,MAAM,gBA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ACA,IAAA,MAAMH,cAAO;;AAGb,IAAA,OAAOI,2BAAa,CAAC,GAAG,CAAC;AACzB,IAAA,MAAMJ,cAAO;;AAEb,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAOK,qBAAU,CAAC,GAAG,CAAC;IACxB;;AAEA,IAAA,OAAOC,mBAAS,CAAC,GAAG,CAAC;AAErB,IAAA,OAAOC,kCAAgB,CAAC,GAAG,CAAC;AAC9B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.mjs","sources":["../../../src/client/generate.ts"],"sourcesContent":["import { DocumentParts, inline, NewLine } from '../output/writer'\nimport { paramsFactory } from './params-factory'\nimport { appClient } from './app-client'\nimport { deployTypes } from './deploy-types'\nimport { utilityTypes } from './utility-types'\nimport { imports } from './imports'\nimport { createGeneratorContext, GeneratorOptions } from './generator-context'\nimport { appTypes } from './app-types'\nimport { callComposerType } from './call-composer-types'\nimport { Arc56Contract, ProgramSourceInfo, StructField } from '@algorandfoundation/algokit-utils/abi'\nimport { appFactory } from './app-factory'\nimport { Sanitizer } from '../util/sanitization'\n\nfunction convertStructs(s: StructField[], sanitizer: Sanitizer): StructField[] {\n return s.map(\n ({ name, type }) =>\n ({\n name: sanitizer.makeSafePropertyIdentifier(name),\n type: typeof type === 'string' ? type : convertStructs(type, sanitizer),\n }) satisfies StructField,\n )\n}\n\nfunction shrinkAppSpec(app: Arc56Contract, options: GeneratorOptions): Arc56Contract {\n const strippedAppSpec = structuredClone(app)\n\n // Only keep the source info if it is needed for error mapping\n const shrinkSourceInfo = (sourceInfo: ProgramSourceInfo['sourceInfo']) => {\n return sourceInfo\n .filter((entry) => entry.errorMessage)\n .map((entry) => ({\n pc: entry.pc,\n errorMessage: entry.errorMessage,\n // Keep minimal context for error mapping if available\n ...(entry.teal !== undefined && { teal: entry.teal }),\n }))\n }\n\n // Keep only source info entries that can be used for approval and clear program error mapping\n if (strippedAppSpec.sourceInfo?.approval?.sourceInfo && strippedAppSpec.sourceInfo.approval.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.approval.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.approval.sourceInfo)\n }\n\n if (strippedAppSpec.sourceInfo?.clear?.sourceInfo && strippedAppSpec.sourceInfo.clear.sourceInfo.length > 0) {\n strippedAppSpec.sourceInfo.clear.sourceInfo = shrinkSourceInfo(strippedAppSpec.sourceInfo.clear.sourceInfo)\n }\n\n if (strippedAppSpec.compilerInfo) {\n delete strippedAppSpec.compilerInfo\n }\n\n // These are used for deploying but not for calling deployed apps\n if (options.mode === 'minimal') {\n if (strippedAppSpec.source) {\n delete strippedAppSpec.source\n }\n if (strippedAppSpec.byteCode) {\n delete strippedAppSpec.byteCode\n }\n if (strippedAppSpec.templateVariables) {\n delete strippedAppSpec.templateVariables\n }\n if (strippedAppSpec.scratchVariables) {\n delete strippedAppSpec.scratchVariables\n }\n }\n return strippedAppSpec\n}\n\nexport function* generate(app: Arc56Contract, options?: Partial<GeneratorOptions>): DocumentParts {\n const resolvedOptions: GeneratorOptions = {\n // Set defaults\n preserveNames: false,\n mode: 'full',\n ...options,\n }\n const reduceAppSpec = shrinkAppSpec(app, resolvedOptions)\n\n const ctx = createGeneratorContext(reduceAppSpec, resolvedOptions)\n yield `/* eslint-disable */`\n yield `/**`\n yield ` * This file was automatically generated by @algorandfoundation/algokit-client-generator.`\n yield ` * DO NOT MODIFY IT BY HAND.`\n yield ` * requires: @algorandfoundation/algokit-utils: ^10`\n yield ` */`\n\n yield* imports()\n // Change the structs definition to sanitize property names according to the defined rules\n // for instance, this may (unless you passed in --preserve-names) convert properties like my_prop to myProp\n reduceAppSpec.structs = Object.fromEntries(\n Object.keys(reduceAppSpec.structs).map((key) => [key, convertStructs(reduceAppSpec.structs[key], ctx.sanitizer)]),\n )\n yield* inline('export const APP_SPEC: Arc56Contract = ', JSON.stringify(reduceAppSpec), ' as unknown as Arc56Contract')\n yield NewLine\n\n yield* utilityTypes()\n yield NewLine\n yield* appTypes(ctx)\n\n if (ctx.mode === 'full') {\n yield* deployTypes(ctx)\n }\n yield NewLine\n\n // Write a call factory\n yield* paramsFactory(ctx)\n yield NewLine\n // Write a factory in full mode\n if (ctx.mode === 'full') {\n yield* appFactory(ctx)\n }\n // Write a client\n yield* appClient(ctx)\n\n yield* callComposerType(ctx)\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,SAAS,cAAc,CAAC,CAAgB,EAAE,SAAoB,EAAA;AAC5D,IAAA,OAAO,CAAC,CAAC,GAAG,CACV,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,MACZ;AACC,QAAA,IAAI,EAAE,SAAS,CAAC,0BAA0B,CAAC,IAAI,CAAC;AAChD,QAAA,IAAI,EAAE,OAAO,IAAI,KAAK,QAAQ,GAAG,IAAI,GAAG,cAAc,CAAC,IAAI,EAAE,SAAS,CAAC;AACxE,KAAA,CAAuB,CAC3B;AACH;AAEA,SAAS,aAAa,CAAC,GAAkB,EAAE,OAAyB,EAAA;AAClE,IAAA,MAAM,eAAe,GAAG,eAAe,CAAC,GAAG,CAAC;;AAG5C,IAAA,MAAM,gBAAgB,GAAG,CAAC,UAA2C,KAAI;AACvE,QAAA,OAAO;aACJ,MAAM,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,YAAY;AACpC,aAAA,GAAG,CAAC,CAAC,KAAK,MAAM;YACf,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,YAAY,EAAE,KAAK,CAAC,YAAY;;AAEhC,YAAA,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,CAAC;AACtD,SAAA,CAAC,CAAC;AACP,IAAA,CAAC;;IAGD,IAAI,eAAe,CAAC,UAAU,EAAE,QAAQ,EAAE,UAAU,IAAI,eAAe,CAAC,UAAU,CAAC,QAAQ,CAAC,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE;AACjH,QAAA,eAAe,CAAC,U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;AACjG,IAAA,MAAM,8BAA8B;AACpC,IAAA,MAAM,qDAAqD;AAC3D,IAAA,MAAM,KAAK;AAEX,IAAA,OAAO,OAAO,EAAE;;;AAGhB,IAAA,aAAa,CAAC,OAAO,GAAG,MAAM,CAAC,WAAW,CACxC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAClH;AACD,IAAA,OAAO,MAAM,CAAC,yCAAyC,EAAE,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,EAAE,8BAA8B,CAAC;AACvH,IAAA,MAAM,OAAO;AAEb,IAAA,OAAO,YAAY,EAAE;AACrB,IAAA,MAAM,OAAO;AACb,IAAA,OAAO,QAAQ,CAAC,GAAG,CAAC;AAEpB,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAO,WAAW,CAAC,GAAG,CAAC;IACzB;AACA,IAAA,MAAM,OAAO;;AAGb,IAAA,OAAO,aAAa,CAAC,GAAG,CAAC;AACzB,IAAA,MAAM,OAAO;;AAEb,IAAA,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE;AACvB,QAAA,OAAO,UAAU,CAAC,GAAG,CAAC;IACxB;;AAEA,IAAA,OAAO,SAAS,CAAC,GAAG,CAAC;AAErB,IAAA,OAAO,gBAAgB,CAAC,GAAG,CAAC;AAC9B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator-context.js","sources":["../../../src/client/generator-context.ts"],"sourcesContent":["import { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { AppClientContext, createAppClientContext } from './app-client-context'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n name: string\n app: AppClientContext\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n const appCtx = createAppClientContext(app, sanitizer)\n return {\n sanitizer,\n name: appCtx.name.makeSafeTypeIdentifier,\n app: appCtx,\n mode: options.mode,\n }\n}\n"],"names":["getSanitizer","createAppClientContext"],"mappings":";;;;;AAIA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY;MAc1C,sBAAsB,GAAG,CAAC,GAAkB,EAAE,OAAyB,KAAsB;AACxG,IAAA,MAAM,SAAS,GAAGA,yBAAY,CAAC,OAAO,CAAC;IACvC,MAAM,MAAM,GAAGC,uCAAsB,CAAC,GAAG,EAAE,SAAS,CAAC;IACrD,OAAO;QACL,SAAS;AACT,QAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB;AACxC,QAAA,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB;AACH;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generator-context.mjs","sources":["../../../src/client/generator-context.ts"],"sourcesContent":["import { getSanitizer, Sanitizer } from '../util/sanitization'\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { AppClientContext, createAppClientContext } from './app-client-context'\n\nconst GenerateMode = {\n FULL: 'full',\n MINIMAL: 'minimal',\n} as const\nexport type GenerateMode = (typeof GenerateMode)[keyof typeof GenerateMode]\nexport const generateModes = Object.values(GenerateMode)\n\nexport type GeneratorContext = {\n name: string\n app: AppClientContext\n sanitizer: Sanitizer\n mode: GenerateMode\n}\n\nexport type GeneratorOptions = {\n preserveNames: boolean\n mode: GenerateMode\n}\n\nexport const createGeneratorContext = (app: Arc56Contract, options: GeneratorOptions): GeneratorContext => {\n const sanitizer = getSanitizer(options)\n const appCtx = createAppClientContext(app, sanitizer)\n return {\n sanitizer,\n name: appCtx.name.makeSafeTypeIdentifier,\n app: appCtx,\n mode: options.mode,\n }\n}\n"],"names":[],"mappings":";;;AAIA,MAAM,YAAY,GAAG;AACnB,IAAA,IAAI,EAAE,MAAM;AACZ,IAAA,OAAO,EAAE,SAAS;CACV;AAEH,MAAM,aAAa,GAAG,MAAM,CAAC,MAAM,CAAC,YAAY;MAc1C,sBAAsB,GAAG,CAAC,GAAkB,EAAE,OAAyB,KAAsB;AACxG,IAAA,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC;IACvC,MAAM,MAAM,GAAG,sBAAsB,CAAC,GAAG,EAAE,SAAS,CAAC;IACrD,OAAO;QACL,SAAS;AACT,QAAA,IAAI,EAAE,MAAM,CAAC,IAAI,CAAC,sBAAsB;AACxC,QAAA,GAAG,EAAE,MAAM;QACX,IAAI,EAAE,OAAO,CAAC,IAAI;KACnB;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contains-non-void-method.js","sources":["../../../../src/client/helpers/contains-non-void-method.ts"],"sourcesContent":["import { AppClientMethodContext, isAbiMethod } from '../app-client-context'\n\nexport const containsNonVoidMethod = (methods: AppClientMethodContext[]) => {\n return methods.some((method) => {\n return isAbiMethod(method) && method.returns.tsOutType !== 'void'\n })\n}\n"],"names":["isAbiMethod"],"mappings":";;;;AAEO,MAAM,qBAAqB,GAAG,CAAC,OAAiC,KAAI;AACzE,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;AAC7B,QAAA,OAAOA,4BAAW,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,KAAK,MAAM;AACnE,IAAA,CAAC,CAAC;AACJ;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"contains-non-void-method.mjs","sources":["../../../../src/client/helpers/contains-non-void-method.ts"],"sourcesContent":["import { AppClientMethodContext, isAbiMethod } from '../app-client-context'\n\nexport const containsNonVoidMethod = (methods: AppClientMethodContext[]) => {\n return methods.some((method) => {\n return isAbiMethod(method) && method.returns.tsOutType !== 'void'\n })\n}\n"],"names":[],"mappings":";;AAEO,MAAM,qBAAqB,GAAG,CAAC,OAAiC,KAAI;AACzE,IAAA,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,KAAI;AAC7B,QAAA,OAAO,WAAW,CAAC,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,SAAS,KAAK,MAAM;AACnE,IAAA,CAAC,CAAC;AACJ;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-equivalent-type.js","sources":["../../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIStructType,\n ABIUfixedType,\n ABIUintType,\n AVMType,\n argTypeIsTransaction,\n ABITransactionType,\n} from '@algorandfoundation/algokit-utils/abi'\n\nimport { Sanitizer } from '../../util/sanitization'\n\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\n\nexport function getEquivalentType(\n algoType: ABIType | ABIReferenceType | ABITransactionType | AVMType | 'void',\n ioType: 'input' | 'output',\n sanitizer: Sanitizer,\n): string {\n if (algoType == 'void') {\n return 'void'\n }\n if (algoType == 'AVMBytes') {\n return ioType === 'input' ? bytesOrStringType : 'Uint8Array'\n }\n if (algoType == 'AVMString') {\n return 'string'\n }\n if (algoType == 'AVMUint64') {\n return 'bigint'\n }\n if (argTypeIsTransaction(algoType)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (algoType == ABIReferenceType.Account) {\n return bytesOrStringType\n }\n if (algoType == ABIReferenceType.Application || algoType == ABIReferenceType.Asset) {\n return 'bigint'\n }\n\n return abiTypeToTs(algoType, ioType, sanitizer)\n}\n\nexport function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output', sanitizer: Sanitizer): string {\n if (abiType instanceof ABIStructType) {\n return sanitizer.makeSafeTypeIdentifier(abiType.structName)\n }\n\n if (abiType instanceof ABIUintType) {\n if (abiType.bitSize < 53) return ioType === 'input' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType, sanitizer)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.length).fill(abiTypeToTs(abiType.childType, ioType, sanitizer)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType, sanitizer)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n}\n"],"names":["argTypeIsTransaction","ABIReferenceType","ABIStructType","ABIUintType","ABIArrayDynamicType","ABIByteType","ABIArrayStaticType","ABIAddressType","ABIBoolType","ABIUfixedType","ABITupleType","ABIStringType"],"mappings":";;;;AAoBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;S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AAO,YAAYM,iBAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,SAAS;AAClB;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"get-equivalent-type.mjs","sources":["../../../../src/client/helpers/get-equivalent-type.ts"],"sourcesContent":["import {\n ABIAddressType,\n ABIArrayDynamicType,\n ABIArrayStaticType,\n ABIBoolType,\n ABIByteType,\n ABIReferenceType,\n ABIStringType,\n ABITupleType,\n ABIType,\n ABIStructType,\n ABIUfixedType,\n ABIUintType,\n AVMType,\n argTypeIsTransaction,\n ABITransactionType,\n} from '@algorandfoundation/algokit-utils/abi'\n\nimport { Sanitizer } from '../../util/sanitization'\n\nconst bigIntOrNumberType = 'bigint | number'\nconst bytesOrStringType = 'Uint8Array | string'\n\nexport function getEquivalentType(\n algoType: ABIType | ABIReferenceType | ABITransactionType | AVMType | 'void',\n ioType: 'input' | 'output',\n sanitizer: Sanitizer,\n): string {\n if (algoType == 'void') {\n return 'void'\n }\n if (algoType == 'AVMBytes') {\n return ioType === 'input' ? bytesOrStringType : 'Uint8Array'\n }\n if (algoType == 'AVMString') {\n return 'string'\n }\n if (algoType == 'AVMUint64') {\n return 'bigint'\n }\n if (argTypeIsTransaction(algoType)) {\n return 'AppMethodCallTransactionArgument'\n }\n if (algoType == ABIReferenceType.Account) {\n return bytesOrStringType\n }\n if (algoType == ABIReferenceType.Application || algoType == ABIReferenceType.Asset) {\n return 'bigint'\n }\n\n return abiTypeToTs(algoType, ioType, sanitizer)\n}\n\nexport function abiTypeToTs(abiType: ABIType, ioType: 'input' | 'output', sanitizer: Sanitizer): string {\n if (abiType instanceof ABIStructType) {\n return sanitizer.makeSafeTypeIdentifier(abiType.structName)\n }\n\n if (abiType instanceof ABIUintType) {\n if (abiType.bitSize < 53) return ioType === 'input' ? bigIntOrNumberType : 'number'\n return ioType === 'input' ? bigIntOrNumberType : 'bigint'\n }\n if (abiType instanceof ABIArrayDynamicType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n\n const childTsType = abiTypeToTs(abiType.childType, ioType, sanitizer)\n if (childTsType === bigIntOrNumberType) {\n return 'bigint[] | number[]'\n } else if (childTsType === bytesOrStringType) {\n return 'Uint8Array[] | string[]'\n }\n\n return `${childTsType}[]`\n }\n if (abiType instanceof ABIArrayStaticType) {\n if (abiType.childType instanceof ABIByteType) return 'Uint8Array'\n return `[${new Array(abiType.length).fill(abiTypeToTs(abiType.childType, ioType, sanitizer)).join(', ')}]`\n }\n if (abiType instanceof ABIAddressType) {\n return 'string'\n }\n if (abiType instanceof ABIBoolType) {\n return 'boolean'\n }\n if (abiType instanceof ABIUfixedType) {\n return 'number'\n }\n if (abiType instanceof ABITupleType) {\n return `[${abiType.childTypes.map((c) => abiTypeToTs(c, ioType, sanitizer)).join(', ')}]`\n }\n if (abiType instanceof ABIByteType) {\n return 'number'\n }\n if (abiType instanceof ABIStringType) {\n return 'string'\n }\n return 'unknown'\n}\n"],"names":[],"mappings":";;AAoBA,MAAM,kBAAkB,GAAG,iBAAiB;AAC5C,MAAM,iBAAiB,GAAG,qBAAqB;SAE/B,iBAAiB,CAC/B,QAA4E,EAC5E,MAA0B,EAC1B,SAAoB,EAAA;AAEpB,IAAA,IAAI,QAAQ,IAAI,MAAM,EAAE;AACtB,QAAA,OAAO,MAAM;IACf;AACA,IAAA,IAAI,QAAQ,IAAI,UAAU,EAAE;QAC1B,OAAO,MAAM,KAAK,OAAO,GAAG,iBAAiB,GAAG,YAAY;IAC9D;AACA,IAAA,IAAI,QAAQ,IAAI,WAAW,EAAE;AAC3B,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,QAAQ,IAAI,WAAW,EAAE;AAC3B,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,oBAAoB,CAAC,QAAQ,CAAC,EAAE;AAClC,QAAA,OAAO,kCAAkC;IAC3C;AACA,IAAA,IAAI,QAAQ,IAAI,gBAAgB,CAAC,OAAO,EAAE;AACxC,QAA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AC,WAAW,CAAC,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;IAC5G;AACA,IAAA,IAAI,OAAO,YAAY,cAAc,EAAE;AACrC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,QAAA,OAAO,SAAS;IAClB;AACA,IAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,YAAY,EAAE;QACnC,OAAO,CAAA,CAAA,EAAI,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,WAAW,CAAC,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA,CAAA,CAAG;IAC3F;AACA,IAAA,IAAI,OAAO,YAAY,WAAW,EAAE;AAClC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,IAAI,OAAO,YAAY,aAAa,EAAE;AACpC,QAAA,OAAO,QAAQ;IACjB;AACA,IAAA,OAAO,SAAS;AAClB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"imports.js","sources":["../../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\nimport { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\nimport { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'\nimport { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'\nimport { Address, encodeAddress } from '@algorandfoundation/algokit-utils'\nimport { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'\nimport { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\nimport { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\nimport { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,OAAO,GAAA;IACtB,MAAM;;;;;;;;;;GAUL;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"imports.mjs","sources":["../../../src/client/imports.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* imports(): DocumentParts {\n yield `\nimport { type AlgorandClient } from '@algorandfoundation/algokit-utils/types/algorand-client'\nimport { ABIReturn, Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { OnApplicationComplete, TransactionSigner, Transaction } from '@algorandfoundation/algokit-utils/transact'\nimport { SimulateResponse } from '@algorandfoundation/algokit-utils/algod-client'\nimport { Address, encodeAddress } from '@algorandfoundation/algokit-utils'\nimport { AppClientMethodCallParams, AppClientCompilationParams, AppClientDeployParams, CallOnComplete, AppClient as _AppClient, AppClientParams, ResolveAppClientByCreatorAndName, ResolveAppClientByNetwork, AppClientBareCallParams, CloneAppClientParams } from '@algorandfoundation/algokit-utils/types/app-client'\nimport { SendParams,SendTransactionComposerResults } from '@algorandfoundation/algokit-utils/types/transaction'\nimport { AppFactoryCreateMethodCallParams, AppFactoryAppClientParams, AppFactoryDeployParams, AppFactoryParams, AppFactory as _AppFactory, AppFactoryResolveAppClientByCreatorAndNameParams, CreateSchema } from '@algorandfoundation/algokit-utils/types/app-factory'\nimport { TransactionComposer, TransactionComposerConfig, SkipSignaturesSimulateOptions, RawSimulateOptions, SimulateOptions, AppMethodCallTransactionArgument } from '@algorandfoundation/algokit-utils/types/composer'\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,OAAO,GAAA;IACtB,MAAM;;;;;;;;;;GAUL;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"params-factory.js","sources":["../../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { Sanitizer } from '../util/sanitization'\nimport { AppClientMethodContext, MethodArgClientContext, isAbiMethod } from './app-client-context'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.app.name.original} smart contract`)\n yield `export abstract class ${ctx.app.name.makeSafeTypeIdentifier}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n if (!method.callActions.noOp) continue\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(ctx, `Constructs create ABI call params for the ${app.name} smart contract`, app.createMethods, 'create', true)\n yield* operationMethod(ctx, `Constructs update ABI call params for the ${app.name} smart contract`, app.updateMethods, 'update', true)\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, app.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, app.optInMethods, 'optIn')\n yield* operationMethod(ctx, `Constructs close out ABI call params for the ${app.name} smart contract`, app.closeOutMethods, 'closeOut')\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: AppClientMethodContext[],\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, sanitizer, name } = ctx\n if (methods.some((m) => !m.isBare)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${app.name.makeSafeTypeIdentifier}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const method of methods) {\n if (!isAbiMethod(method)) continue\n if (method.baseNameIsUnique) {\n yield `case '${method.name.makeSafeStringTypeLiteral}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(method.signature)}':`\n yield* indent(\n `return ${app.name.makeSafeTypeIdentifier}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(method.uniqueName.original))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const method of methods) {\n if (!isAbiMethod(method)) continue\n const onComplete = verb === 'create' ? method.createActions.inputType : undefined\n\n const uniqueName = method.uniqueName.original\n yield* jsDoc({\n description: `${description} using the ${method.signature} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: method.signature,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''\n }`,\n contractName: name,\n })\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ sanitizer, name }: GeneratorContext, method: AppClientMethodContext) {\n if (!method.callActions.any || !isAbiMethod(method)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${method.signature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: method.uniqueName.makeSafeMethodIdentifier,\n signature: method.signature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: MethodArgClientContext[]\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(a.name?.makeSafePropertyIdentifier ?? `arg${i + 1}`)}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\n yield DecIndent\n yield `}${isNested ? ',' : ''}`\n}\n"],"names":["jsDoc","IncIndent","DecIndent","isAbiMethod","indent","DecIndentAndCloseBlock","NewLine"],"mappings":";;;;;AAKM,UAAW,aAAa,CAAC,GAAqB,EAAA;AAClD,IAAA,OAAOA,YAAK,CAAC,sFAAsF,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAA,eAAA,CAAiB,CAAC;IAC1I,MAAM,CAAA,sBAAA,EAAyB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,sBAAsB,CAAA,eAAA,CAAiB;A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IAAA,MAAMA,gBAAS;AACf,IAAA,MAAM,YAAY;IAClB,MAAM,CAAA,SAAA,EAAY,aAAa,CAAA,WAAA,CAAa;AAC5C,IAAA,MAAM,qDAAqD;SACxD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,WAAA,EAAc,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,EAAE,0BAA0B,IAAI,CAAA,GAAA,EAAM,CAAC,GAAG,CAAC,CAAA,CAAE,CAAC,CAAA,CAAE;AAClH,SAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AACjB,IAAA,MAAMC,gBAAS;AACf,IAAA,MAAM,GAAG;AACT,IAAA,MAAMA,gBAAS;IACf,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAA,CAAE;AACjC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"params-factory.mjs","sources":["../../../src/client/params-factory.ts"],"sourcesContent":["import { DecIndent, DecIndentAndCloseBlock, DocumentParts, IncIndent, indent, jsDoc, NewLine } from '../output/writer'\nimport { GeneratorContext } from './generator-context'\nimport { Sanitizer } from '../util/sanitization'\nimport { AppClientMethodContext, MethodArgClientContext, isAbiMethod } from './app-client-context'\n\nexport function* paramsFactory(ctx: GeneratorContext): DocumentParts {\n yield* jsDoc(`Exposes methods for constructing \\`AppClient\\` params objects for ABI calls to the ${ctx.app.name.original} smart contract`)\n yield `export abstract class ${ctx.app.name.makeSafeTypeIdentifier}ParamsFactory {`\n yield IncIndent\n\n yield* opMethods(ctx)\n\n for (const method of ctx.app.methods) {\n if (!method.callActions.noOp) continue\n yield* callFactoryMethod(ctx, method)\n }\n\n yield DecIndent\n\n yield '}'\n}\n\nfunction* opMethods(ctx: GeneratorContext): DocumentParts {\n const { app } = ctx\n\n if (ctx.mode === 'full') {\n yield* operationMethod(ctx, `Constructs create ABI call params for the ${app.name} smart contract`, app.createMethods, 'create', true)\n yield* operationMethod(ctx, `Constructs update ABI call params for the ${app.name} smart contract`, app.updateMethods, 'update', true)\n yield* operationMethod(ctx, `Constructs delete ABI call params for the ${app.name} smart contract`, app.deleteMethods, 'delete')\n }\n yield* operationMethod(ctx, `Constructs opt-in ABI call params for the ${app.name} smart contract`, app.optInMethods, 'optIn')\n yield* operationMethod(ctx, `Constructs close out ABI call params for the ${app.name} smart contract`, app.closeOutMethods, 'closeOut')\n}\n\nfunction* operationMethod(\n ctx: GeneratorContext,\n description: string,\n methods: AppClientMethodContext[],\n verb: 'create' | 'update' | 'optIn' | 'closeOut' | 'delete',\n includeCompilation?: boolean,\n): DocumentParts {\n const { app, sanitizer, name } = ctx\n if (methods.some((m) => !m.isBare)) {\n yield* jsDoc(`Gets available ${verb} ABI call param factories`)\n yield `static get ${verb}() {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n\n if (['create', 'update', 'delete'].includes(verb)) {\n yield `_resolveByMethod<TParams extends ${app.name.makeSafeTypeIdentifier}${verb[0].toUpperCase()}${verb.substring(1)}CallParams & {method: string}>(params: TParams) {`\n yield IncIndent\n yield `switch(params.method) {`\n yield IncIndent\n\n for (const method of methods) {\n if (!isAbiMethod(method)) continue\n if (method.baseNameIsUnique) {\n yield `case '${method.name.makeSafeStringTypeLiteral}':`\n }\n yield `case '${sanitizer.makeSafeStringTypeLiteral(method.signature)}':`\n yield* indent(\n `return ${app.name.makeSafeTypeIdentifier}ParamsFactory.${verb}${sanitizer.getSafeMemberAccessor(sanitizer.makeSafeMethodIdentifier(method.uniqueName.original))}(params)`,\n )\n }\n yield DecIndentAndCloseBlock\n\n // Ordinarily we'd pop in the params.method value, but we can't here since it knows at compile time the type of params.method is never\n yield `throw new Error(\\`Unknown ' + verb + ' method\\`)`\n yield DecIndent\n yield '},'\n yield NewLine\n }\n\n for (const method of methods) {\n if (!isAbiMethod(method)) continue\n const onComplete = verb === 'create' ? method.createActions.inputType : undefined\n\n const uniqueName = method.uniqueName.original\n yield* jsDoc({\n description: `${description} using the ${method.signature} ABI method`,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: true,\n sanitizer,\n name: sanitizer.makeSafeMethodIdentifier(uniqueName),\n signature: method.signature,\n args: method.args,\n additionalParamTypes: `${includeCompilation ? ' & AppClientCompilationParams' : ''}${\n onComplete?.typeLiteral ? ` & ${onComplete.typeLiteral}` : ''\n }`,\n contractName: name,\n })\n }\n yield DecIndentAndCloseBlock\n yield DecIndentAndCloseBlock\n yield NewLine\n }\n}\n\nfunction* callFactoryMethod({ sanitizer, name }: GeneratorContext, method: AppClientMethodContext) {\n if (!method.callActions.any || !isAbiMethod(method)) return\n\n yield* jsDoc({\n description: `Constructs a no op call for the ${method.signature} ABI method`,\n abiDescription: method.desc,\n params: {\n params: `Parameters for the call`,\n },\n returns: 'An `AppClientMethodCallParams` object for the call',\n })\n yield* factoryMethod({\n isNested: false,\n sanitizer,\n name: method.uniqueName.makeSafeMethodIdentifier,\n signature: method.signature,\n args: method.args,\n additionalParamTypes: ' & CallOnComplete',\n contractName: name,\n })\n}\n\nfunction* factoryMethod(m: {\n isNested: boolean\n name?: string\n signature: string\n args: MethodArgClientContext[]\n additionalParamTypes?: string\n sanitizer: Sanitizer\n contractName: string\n}) {\n const { isNested, name, signature, args, additionalParamTypes, sanitizer, contractName } = m\n const methodSigSafe = sanitizer.makeSafeStringTypeLiteral(signature)\n yield `${isNested ? '' : 'static '}${name}(params: CallParams<${contractName}Args['obj']['${methodSigSafe}'] | ${contractName}Args['tuple']['${methodSigSafe}']>${additionalParamTypes}): AppClientMethodCallParams${additionalParamTypes} {`\n yield IncIndent\n yield `return {`\n yield IncIndent\n yield '...params,'\n yield `method: '${methodSigSafe}' as const,`\n yield `args: Array.isArray(params.args) ? params.args : [${args\n .map((a, i) => `params.args${sanitizer.getSafeMemberAccessor(a.name?.makeSafePropertyIdentifier ?? `arg${i + 1}`)}`)\n .join(', ')}],`\n yield DecIndent\n yield '}'\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QAAQ,GAAG,EAAE,GAAG,SAAS,CAAA,EAAG,IAAI,uBAAuB,YAAY,CAAA,aAAA,EAAgB,aAAa,CAAA,KAAA,EAAQ,YAAY,CAAA,eAAA,EAAkB,aAAa,CAAA,GAAA,EAAM,oBAAoB,CAAA,4BAAA,EAA+B,oBAAoB,CAAA,EAAA,CAAI;AAC7O,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,UAAU;AAChB,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,YAAY;IAClB,MAAM,CAAA,SAAA,EAAY,aAAa,CAAA,WAAA,CAAa;AAC5C,IAAA,MAAM,qDAAqD;SACxD,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,CAAA,WAAA,EAAc,SAAS,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,EAAE,0BAA0B,IAAI,CAAA,GAAA,EAAM,CAAC,GAAG,CAAC,CAAA,CAAE,CAAC,CAAA,CAAE;AAClH,SAAA,IAAI,CAAC,IAAI,CAAC,CAAA,EAAA,CAAI;AACjB,IAAA,MAAM,SAAS;AACf,IAAA,MAAM,GAAG;AACT,IAAA,MAAM,SAAS;IACf,MAAM,CAAA,CAAA,EAAI,QAAQ,GAAG,GAAG,GAAG,EAAE,CAAA,CAAE;AACjC;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utility-types.js","sources":["../../../src/client/utility-types.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* utilityTypes(): DocumentParts {\n yield `\n /**\n * A state record containing binary data\n */\n export interface BinaryState {\n /**\n * Gets the state value as a Uint8Array\n */\n asByteArray(): Uint8Array | undefined\n /**\n * Gets the state value as a string\n */\n asString(): string | undefined\n }\n\n class BinaryStateValue implements BinaryState {\n constructor(private value: Uint8Array | undefined) {}\n\n asByteArray(): Uint8Array | undefined {\n return this.value\n }\n\n asString(): string | undefined {\n return this.value !== undefined ? Buffer.from(this.value).toString('utf-8') : undefined\n }\n }\n\n /**\n * Expands types for IntelliSense so they are more human readable\n * See https://stackoverflow.com/a/69288824\n */\n export type Expand<T> = T extends (...args: infer A) => infer R\n ? (...args: Expand<A>) => Expand<R>\n : T extends infer O\n ? { [K in keyof O]: O[K] }\n : never\n `\n}\n"],"names":[],"mappings":";;AAEM,UAAW,YAAY,GAAA;IAC3B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCL;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"utility-types.mjs","sources":["../../../src/client/utility-types.ts"],"sourcesContent":["import { DocumentParts } from '../output/writer'\n\nexport function* utilityTypes(): DocumentParts {\n yield `\n /**\n * A state record containing binary data\n */\n export interface BinaryState {\n /**\n * Gets the state value as a Uint8Array\n */\n asByteArray(): Uint8Array | undefined\n /**\n * Gets the state value as a string\n */\n asString(): string | undefined\n }\n\n class BinaryStateValue implements BinaryState {\n constructor(private value: Uint8Array | undefined) {}\n\n asByteArray(): Uint8Array | undefined {\n return this.value\n }\n\n asString(): string | undefined {\n return this.value !== undefined ? Buffer.from(this.value).toString('utf-8') : undefined\n }\n }\n\n /**\n * Expands types for IntelliSense so they are more human readable\n * See https://stackoverflow.com/a/69288824\n */\n export type Expand<T> = T extends (...args: infer A) => infer R\n ? (...args: Expand<A>) => Expand<R>\n : T extends infer O\n ? { [K in keyof O]: O[K] }\n : never\n `\n}\n"],"names":[],"mappings":"AAEM,UAAW,YAAY,GAAA;IAC3B,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCL;AACH;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"writer.js","sources":["../../../src/output/writer.ts"],"sourcesContent":["export const IncIndent = Symbol('Increase Indent')\nexport const DecIndent = Symbol('Decrease Indent')\nexport const DecIndentAndCloseBlock = Symbol('Decrease Indent and write a closing brace')\nexport const NewLineMode = Symbol('New Line Mode')\nexport const RestoreLineMode = Symbol('Restore Line Mode')\nexport const PropertyDelimiter = Symbol('Property Delimiter')\nexport const InlineMode = Symbol('Inline Mode')\nexport const NewLine = Symbol('New Line')\n\nexport type Part =\n | string\n | typeof IncIndent\n | typeof DecIndent\n | typeof NewLineMode\n | typeof DecIndentAndCloseBlock\n | typeof InlineMode\n | typeof NewLine\n | typeof RestoreLineMode\n | typeof PropertyDelimiter\nexport type DocumentParts = Generator<Part, void>\n\nexport type WriteOptions = {\n indent?: string\n disableEslint?: boolean\n header?: string\n}\n\ninterface StringWriter {\n write(value: string): void\n get last(): string\n}\n\nexport function writeDocumentPartsToStream(document: DocumentParts, stream: { write(chunk: string): void }, options: WriteOptions = {}) {\n const writer = {\n _last: '',\n write(val: string) {\n this._last = val\n stream.write(val)\n },\n get last() {\n return this._last\n },\n }\n writeDocumentPartsTo(document, options, writer)\n}\n\nexport function writeDocumentPartsToString(document: DocumentParts, options: WriteOptions = {}) {\n const writer = {\n result: [] as string[],\n _last: '',\n write(val: string) {\n this._last = val\n this.result.push(val)\n },\n get last() {\n return this._last\n },\n toString() {\n return this.result.join('')\n },\n }\n writeDocumentPartsTo(document, options, writer)\n return writer.toString()\n}\n\nexport function* inline(...parts: Array<Part | DocumentParts>) {\n yield InlineMode\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield RestoreLineMode\n}\n\nexport function* indent(...parts: Array<Part | DocumentParts>) {\n yield IncIndent\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield DecIndent\n}\n\nexport function* jsDoc(\n docs: string | string[] | { description: string | string[]; abiDescription?: string; params?: Record<string, string>; returns?: string },\n) {\n yield `/**`\n if (typeof docs === 'string' || Array.isArray(docs)) {\n const description = typeof docs === 'string' ? [docs] : docs\n for (const line of description) {\n yield ` * ${line}`\n }\n } else {\n const description = typeof docs.description === 'string' ? [docs.description] : docs.description\n for (const line of description) {\n yield ` * ${line}`\n }\n if (docs.abiDescription) {\n yield ' *'\n yield ` * ${docs.abiDescription}`\n }\n if (docs.params || docs.returns) {\n yield ' *'\n }\n for (const [paramName, paramDesc] of Object.entries(docs.params ?? {})) {\n yield ` * @param ${paramName} ${paramDesc}`\n }\n if (docs.returns) yield ` * @returns ${docs.returns}`\n }\n yield ' */'\n}\n\nfunction writeDocumentPartsTo(document: DocumentParts, { indent = ' ', ...options }: WriteOptions, writer: StringWriter): void {\n if (options.header) writer.write(`${options.header}\\n`)\n if (options.disableEslint) writer.write('/* eslint-disable */\\n')\n\n const lineModes = [NewLineMode]\n const currentLineMode = () => lineModes.at(-1) ?? NewLineMode\n\n let curIndent = ''\n for (const part of document) {\n switch (part) {\n case IncIndent:\n curIndent += indent\n break\n case DecIndent:\n curIndent = curIndent.slice(0, -indent.length)\n break\n case DecIndentAndCloseBlock:\n curIndent = curIndent.slice(0, -indent.length)\n writer.write(`${curIndent}}\\n`)\n break\n case NewLineMode:\n lineModes.push(NewLineMode)\n if (writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case InlineMode:\n lineModes.push(InlineMode)\n break\n case RestoreLineMode:\n lineModes.pop()\n\n if (currentLineMode() === NewLineMode && writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case PropertyDelimiter:\n if (currentLineMode() === NewLineMode) {\n writer.write('\\n')\n } else {\n writer.write(', ')\n }\n break\n case NewLine:\n writer.write('\\n')\n break\n default:\n // Multi-line\n if (part.includes('\\n') || part.includes('\\r')) {\n if (writer.last.slice(-1)[0] !== '\\n') writer.write('\\n')\n const normalisedLineEndings = part.replaceAll(/\\r\\n/g, '\\n').replaceAll(/\\r/g, '\\n').replace(/^\\n/, '').trimEnd()\n const lines = normalisedLineEndings.split('\\n')\n const baseIndent = lines[0].match(/^\\s+/)?.[0] ?? ''\n for (const line of lines) {\n writer.write(curIndent + line.replace(new RegExp(`^${baseIndent}`, ''), '').trimEnd())\n writer.write('\\n')\n }\n } else {\n if (writer.last.slice(-1)[0] === '\\n') writer.write(curIndent)\n writer.write(part)\n }\n if (currentLineMode() === NewLineM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AAC,CAAC,CAAC,CAAC,KAAK,IAAI;AAAE,wBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;oBACzD,MAAM,qBAAqB,GAAG,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE;oBACjH,MAAM,KAAK,GAAG,qBAAqB,CAAC,KAAK,CAAC,IAAI,CAAC;AAC/C,oBAAA,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE;AACpD,oBAAA,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE;wBACxB,MAAM,CAAC,KAAK,CAAC,SAAS,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,IAAI,UAAU,CAAA,CAAE,EAAE,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC;AACtF,wBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;oBACpB;gBACF;qBAAO;AACL,oBAAA,IAAI,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI;AAAE,wBAAA,MAAM,CAAC,KAAK,CAAC,SAAS,CAAC;AAC9D,oBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;gBACpB;gBACA,IAAI,eAAe,EAAE,KAAK,WAAW;AAAE,oBAAA,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC;gBACzD;;IAEN;AACF;;;;;;;;;;;;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"writer.mjs","sources":["../../../src/output/writer.ts"],"sourcesContent":["export const IncIndent = Symbol('Increase Indent')\nexport const DecIndent = Symbol('Decrease Indent')\nexport const DecIndentAndCloseBlock = Symbol('Decrease Indent and write a closing brace')\nexport const NewLineMode = Symbol('New Line Mode')\nexport const RestoreLineMode = Symbol('Restore Line Mode')\nexport const PropertyDelimiter = Symbol('Property Delimiter')\nexport const InlineMode = Symbol('Inline Mode')\nexport const NewLine = Symbol('New Line')\n\nexport type Part =\n | string\n | typeof IncIndent\n | typeof DecIndent\n | typeof NewLineMode\n | typeof DecIndentAndCloseBlock\n | typeof InlineMode\n | typeof NewLine\n | typeof RestoreLineMode\n | typeof PropertyDelimiter\nexport type DocumentParts = Generator<Part, void>\n\nexport type WriteOptions = {\n indent?: string\n disableEslint?: boolean\n header?: string\n}\n\ninterface StringWriter {\n write(value: string): void\n get last(): string\n}\n\nexport function writeDocumentPartsToStream(document: DocumentParts, stream: { write(chunk: string): void }, options: WriteOptions = {}) {\n const writer = {\n _last: '',\n write(val: string) {\n this._last = val\n stream.write(val)\n },\n get last() {\n return this._last\n },\n }\n writeDocumentPartsTo(document, options, writer)\n}\n\nexport function writeDocumentPartsToString(document: DocumentParts, options: WriteOptions = {}) {\n const writer = {\n result: [] as string[],\n _last: '',\n write(val: string) {\n this._last = val\n this.result.push(val)\n },\n get last() {\n return this._last\n },\n toString() {\n return this.result.join('')\n },\n }\n writeDocumentPartsTo(document, options, writer)\n return writer.toString()\n}\n\nexport function* inline(...parts: Array<Part | DocumentParts>) {\n yield InlineMode\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield RestoreLineMode\n}\n\nexport function* indent(...parts: Array<Part | DocumentParts>) {\n yield IncIndent\n for (const part of parts) {\n if (typeof part === 'string' || typeof part === 'symbol') yield part\n else yield* part\n }\n yield DecIndent\n}\n\nexport function* jsDoc(\n docs: string | string[] | { description: string | string[]; abiDescription?: string; params?: Record<string, string>; returns?: string },\n) {\n yield `/**`\n if (typeof docs === 'string' || Array.isArray(docs)) {\n const description = typeof docs === 'string' ? [docs] : docs\n for (const line of description) {\n yield ` * ${line}`\n }\n } else {\n const description = typeof docs.description === 'string' ? [docs.description] : docs.description\n for (const line of description) {\n yield ` * ${line}`\n }\n if (docs.abiDescription) {\n yield ' *'\n yield ` * ${docs.abiDescription}`\n }\n if (docs.params || docs.returns) {\n yield ' *'\n }\n for (const [paramName, paramDesc] of Object.entries(docs.params ?? {})) {\n yield ` * @param ${paramName} ${paramDesc}`\n }\n if (docs.returns) yield ` * @returns ${docs.returns}`\n }\n yield ' */'\n}\n\nfunction writeDocumentPartsTo(document: DocumentParts, { indent = ' ', ...options }: WriteOptions, writer: StringWriter): void {\n if (options.header) writer.write(`${options.header}\\n`)\n if (options.disableEslint) writer.write('/* eslint-disable */\\n')\n\n const lineModes = [NewLineMode]\n const currentLineMode = () => lineModes.at(-1) ?? NewLineMode\n\n let curIndent = ''\n for (const part of document) {\n switch (part) {\n case IncIndent:\n curIndent += indent\n break\n case DecIndent:\n curIndent = curIndent.slice(0, -indent.length)\n break\n case DecIndentAndCloseBlock:\n curIndent = curIndent.slice(0, -indent.length)\n writer.write(`${curIndent}}\\n`)\n break\n case NewLineMode:\n lineModes.push(NewLineMode)\n if (writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case InlineMode:\n lineModes.push(InlineMode)\n break\n case RestoreLineMode:\n lineModes.pop()\n\n if (currentLineMode() === NewLineMode && writer.last.slice(-1)[0] !== '\\n') {\n writer.write('\\n')\n }\n break\n case PropertyDelimiter:\n if (currentLineMode() === NewLineMode) {\n writer.write('\\n')\n } else {\n writer.write(', ')\n }\n break\n case NewLine:\n writer.write('\\n')\n break\n default:\n // Multi-line\n if (part.includes('\\n') || part.includes('\\r')) {\n if (writer.last.slice(-1)[0] !== '\\n') writer.write('\\n')\n const normalisedLineEndings = part.replaceAll(/\\r\\n/g, '\\n').replaceAll(/\\r/g, '\\n').replace(/^\\n/, '').trimEnd()\n const lines = normalisedLineEndings.split('\\n')\n const baseIndent = lines[0].match(/^\\s+/)?.[0] ?? ''\n for (const line of lines) {\n writer.write(curIndent + line.replace(new RegExp(`^${baseIndent}`, ''), '').trimEnd())\n writer.write('\\n')\n }\n } else {\n if (writer.last.slice(-1)[0] === '\\n') writer.write(curIndent)\n writer.write(part)\n }\n if (currentLineMode() === NewLineMode) writer.write('\\n')\n break\n }\n }\n}\n"],"names":[],"mappings":"MAAa,SAAS,GAAG,MAAM,CAAC,iBAAiB;MACpC,SAAS,GAAG,MAAM,CAAC,iBAAiB;MACpC,sBAAsB,GAAG,MAAM,CAAC,2CAA2C;MAC3E,WAAW,GAAG,MAAM,CAAC,eAAe;MACpC,eAAe,GAAG,MAAM,CAAC,mBAAmB;MAC5C,iBAAiB,GAAG,MAAM,CAAC,oBAAoB;MAC/C,UAAU,GAAG,MAAM,CAAC,aAAa;MACjC,OAAO,GAAG,MAAM,CAAC,UAAU;AAyBlC,SAAU,0BAA0B,CAAC,QAAuB,EAAE,MAAsC,EAAE,UAAwB,EAAE,EAAA;AACpI,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,KAAK,CAAC,GAAW,EAAA;AACf,YAAA,IAAI,CAAC,KAAK,GAAG,GAAG;AAChB,YAAA,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC;QACnB,CAAC;AACD,QAAA,IAAI,IAAI,GAAA;YACN,OAAO,IAAI,CAAC,KAAK;QACnB,CAAC;KACF;AACD,IAAA,oBAAoB,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC;AACjD;SAEgB,0BAA0B,CAAC,QAAuB,EAAE,UAAwB,EAAE,EAAA;AAC5F,IAAA,MAAM,MAAM,GAAG;AACb,QAAA,MAAM,EAAE,EAAc;AACtB,QAAA,KAAK,EAAE,EAAE;AACT,QAAA,KAAK,CAAC,GAAW,EAAA;AACf,YAAA,IAAI,CAAC,KAAK,GAAG,GAAG;AAChB,YAAA,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC;QACvB,CAAC;AACD,QAAA,IAAI,IAAI,GAAA;YACN,OAAO,IAAI,CAAC,KAAK;QACnB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Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n let jsonText = fs.readFileSync(appJsonPath, 'utf-8')\n let file = JSON.parse(jsonText)\n // Temporary to get backwards compatibility with TEALScript draft ARC-56\n if (!('contract' in file) /* ARC-56 */) {\n jsonText = jsonText.replace(/ype\":\\s*\"bytes\"/g, 'ype\":\"AVMBytes\"').replace(/import\\(.+?\\)\\./g, '')\n file = JSON.parse(jsonText)\n }\n\n return validateApplicationJson(file, appJsonPath)\n}\n\nexport function validateApplicationJson(json: unknown, appJsonPath: string): Arc56Contract {\n if (typeof json !== 'object') boom(`Could not parse ${appJsonPath} as JSON object`)\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n if ('contract' in (json as any)) {\n // ARC-32\n const arc32Validator = new Validator()\n arc32Validator.addSchema(contractSchema, '/contract.schema.json')\n const arc32Result = arc32Validator.validate(json, arc32Schema as unknown as Schema)\n if (!arc32Result.valid) boom(`Could not parse ${appJsonPath} as ARC-32.\\n${arc32Result}`)\n return arc32ToArc56(json as AppSpec)\n }\n // ARC-56\n const arc56Validator = new Validator()\n const arc56Result = arc56Validator.validate(json, arc56Schema as unknown as Schema)\n if (!arc56Result.valid) boom(`Could not parse ${appJsonPath} as ARC-56.\\n${arc56Result}`)\n return json as Arc56Contract\n}\n"],"names":["boom","Validator","contractSchema","arc32Schema","arc32ToArc56","arc56Schema"],"mappings":";;;;;;;;;AAQO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,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AS,EAAE;IACtC,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAEI,oBAAgC,CAAC;IACnF,IAAI,CAAC,WAAW,CAAC,KAAK;AAAE,QAAAL,SAAI,CAAC,CAAA,gBAAA,EAAmB,WAAW,gBAAgB,WAAW,CAAA,CAAE,CAAC;AACzF,IAAA,OAAO,IAAqB;AAC9B;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"load.mjs","sources":["../../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport arc32Schema from './application.schema.json' with { type: 'json' }\nimport arc56Schema from './arc56.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\nimport { Arc56Contract } from '@algorandfoundation/algokit-utils/abi'\nimport { AppSpec, arc32ToArc56 } from '@algorandfoundation/algokit-utils/types/app-spec'\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<Arc56Contract> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n let jsonText = fs.readFileSync(appJsonPath, 'utf-8')\n let file = JSON.parse(jsonText)\n // Temporary to get backwards compatibility with TEALScript draft ARC-56\n if (!('contract' in file) /* ARC-56 */) {\n jsonText = jsonText.replace(/ype\":\\s*\"bytes\"/g, 'ype\":\"AVMBytes\"').replace(/import\\(.+?\\)\\./g, '')\n file = JSON.parse(jsonText)\n }\n\n return validateApplicationJson(file, appJsonPath)\n}\n\nexport function validateApplicationJson(json: unknown, appJsonPath: string): Arc56Contract {\n if (typeof json !== 'object') boom(`Could not parse ${appJsonPath} as JSON object`)\n\n /* eslint-disable @typescript-eslint/no-explicit-any */\n if ('contract' in (json as any)) {\n // ARC-32\n const arc32Validator = new Validator()\n arc32Validator.addSchema(contractSchema, '/contract.schema.json')\n const arc32Result = arc32Validator.validate(json, arc32Schema as unknown as Schema)\n if (!arc32Result.valid) boom(`Could not parse ${appJsonPath} as ARC-32.\\n${arc32Result}`)\n return arc32ToArc56(json as AppSpec)\n }\n // ARC-56\n const arc56Validator = new Validator()\n const arc56Result = arc56Validator.validate(json, arc56Schema as unknown as Schema)\n if (!arc56Result.valid) boom(`Could not parse ${appJsonPath} as ARC-56.\\n${arc56Result}`)\n return json as Arc56Contract\n}\n"],"names":[],"mappings":";;;;;;;AAQO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC;AAC7B,IAAA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,QAAA,IAAI,CAAC,CAAA,wCAAA,EAA2C,WAAW,CAAA,CAAE,CAAC;IAE/F,IAAI,QAAQ,GAAG,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC;IACpD,IAAI,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;;IAE/B,IAAI,EAAE,UAAU,IAAI,IAAI,CAAC,eAAe;AACtC,QAAA,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;AAClG,QAAA,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B;AAEA,IAAA,OAAO,uBAAuB,CAAC,IAAI,EAAE,WAAW,CAAC;AACnD;AAEM,SAAU,uBAAuB,CAAC,IAAa,EAAE,WAAmB,EAAA;IACxE,IAAI,OAAO,IAAI,KAAK,QAAQ;AAAE,QAAA,IAAI,CAAC,CAAA,gBAAA,EAAmB,WAAW,CAAA,eAAA,CAAiB,CAAC;;AAGnF,IAAA,IAAI,UAAU,IAAK,IAAY,EAAE;;AAE/B,QAAA,MAAM,cAAc,GAAG,IAAI,SAAS,EAAE;AACtC,QAAA,cAAc,CAAC,SAAS,CAAC,cAAc,EAAE,uBAAuB,CAAC;QACjE,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAgC,CAAC;QACnF,IAAI,CAAC,WAAW,CAAC,KAAK;AAAE,YAAA,IAAI,CAAC,CAAA,gBAAA,EAAmB,WAAW,gBAAgB,WAAW,CAAA,CAAE,CAAC;AACzF,QAAA,OAAO,YAAY,CAAC,IAAe,CAAC;IACtC;;AAEA,IAAA,MAAM,cAAc,GAAG,IAAI,SAAS,EAAE;IACtC,MAAM,WAAW,GAAG,cAAc,CAAC,QAAQ,CAAC,IAAI,EAAE,WAAgC,CAAC;IACnF,IAAI,CAAC,WAAW,CAAC,KAAK;AAAE,QAAA,IAAI,CAAC,CAAA,gBAAA,EAAmB,WAAW,gBAAgB,WAAW,CAAA,CAAE,CAAC;AACzF,IAAA,OAAO,IAAqB;AAC9B;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"boom.js","sources":["../../../src/util/boom.ts"],"sourcesContent":["export const boom = (reason: string): never => {\n throw new Error(reason)\n}\n"],"names":[],"mappings":";;AAAO,MAAM,IAAI,GAAG,CAAC,MAAc,KAAW;AAC5C,IAAA,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;AACzB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"boom.mjs","sources":["../../../src/util/boom.ts"],"sourcesContent":["export const boom = (reason: string): never => {\n throw new Error(reason)\n}\n"],"names":[],"mappings":"AAAO,MAAM,IAAI,GAAG,CAAC,MAAc,KAAW;AAC5C,IAAA,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC;AACzB;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-console.js","sources":["../../../src/util/color-console.ts"],"sourcesContent":["import chalk from 'chalk'\n\ntype ColorFn = (text: string) => string\n\nconst createColorFormatter =\n (textColor: ColorFn, argColor: ColorFn, consoleFn: 'log' | 'error' | 'info' | 'warn') =>\n (textParts: TemplateStringsArray, ...args: unknown[]): void => {\n // eslint-disable-next-line no-console\n console[consoleFn](\n textParts\n .flatMap((t, i) => (args.length > i ? [textColor(t), argColor(`${args[i]}`)] : textColor(t)))\n .reduce((acc, cur) => acc + cur, ''),\n )\n }\n\nexport const colorConsole = {\n info: createColorFormatter(chalk.cyan, chalk.blue, 'info'),\n warn: createColorFormatter(chalk.yellow, chalk.yellow.bold, 'warn'),\n success: createColorFormatter(chalk.green, chalk.green.bold, 'info'),\n error: createColorFormatter(chalk.red, chalk.red.bold, 'error'),\n}\n"],"names":[],"mappings":";;;;AAIA,MAAM,oBAAoB,GACxB,CAAC,SAAkB,EAAE,QAAiB,EAAE,SAA4C,KACpF,CAAC,SAA+B,EAAE,GAAG,IAAe,KAAU;;AAE5D,IAAA,OAAO,CAAC,SAAS,CAAC,CAChB;AACG,SAAA,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3F,SAAA,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CACvC;AACH,CAAC;AAEI,MAAM,YAAY,GAAG;AAC1B,IAAA,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;AAC1D,IAAA,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;AACnE,IAAA,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;AACpE,IAAA,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"color-console.mjs","sources":["../../../src/util/color-console.ts"],"sourcesContent":["import chalk from 'chalk'\n\ntype ColorFn = (text: string) => string\n\nconst createColorFormatter =\n (textColor: ColorFn, argColor: ColorFn, consoleFn: 'log' | 'error' | 'info' | 'warn') =>\n (textParts: TemplateStringsArray, ...args: unknown[]): void => {\n // eslint-disable-next-line no-console\n console[consoleFn](\n textParts\n .flatMap((t, i) => (args.length > i ? [textColor(t), argColor(`${args[i]}`)] : textColor(t)))\n .reduce((acc, cur) => acc + cur, ''),\n )\n }\n\nexport const colorConsole = {\n info: createColorFormatter(chalk.cyan, chalk.blue, 'info'),\n warn: createColorFormatter(chalk.yellow, chalk.yellow.bold, 'warn'),\n success: createColorFormatter(chalk.green, chalk.green.bold, 'info'),\n error: createColorFormatter(chalk.red, chalk.red.bold, 'error'),\n}\n"],"names":[],"mappings":";;AAIA,MAAM,oBAAoB,GACxB,CAAC,SAAkB,EAAE,QAAiB,EAAE,SAA4C,KACpF,CAAC,SAA+B,EAAE,GAAG,IAAe,KAAU;;AAE5D,IAAA,OAAO,CAAC,SAAS,CAAC,CAChB;AACG,SAAA,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,MAAM,GAAG,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,CAAA,CAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC;AAC3F,SAAA,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CACvC;AACH,CAAC;AAEI,MAAM,YAAY,GAAG;AAC1B,IAAA,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;AAC1D,IAAA,IAAI,EAAE,oBAAoB,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;AACnE,IAAA,OAAO,EAAE,oBAAoB,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;AACpE,IAAA,KAAK,EAAE,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;;;;;"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"sanitization.js","sources":["../../../src/util/sanitization.ts"],"sourcesContent":["import { camelCase, pascalCase } from 'change-case'\nimport { GeneratorOptions } from '../client/generator-context'\n\nconst replaceInvalidWithUnderscore = (value: string) => value.replace(/[^a-z0-9_$]+/gi, '_')\n\nconst escapeQuotes = (value: string) => value.replace(/['\"]/g, (val) => `\\\\${val}`)\n\nconst removeEnclosingQuotes = (value: string) => value.replace(/^\"|\"$/g, '')\n\nexport interface Sanitizer {\n makeSafeTypeIdentifier(value: string): string\n makeSafeMethodIdentifier(value: string): string\n makeSafeVariableIdentifier(value: string): string\n makeSafePropertyIdentifier(value: string): string\n makeSafeStringTypeLiteral(value: string): string\n getSafeMemberAccessor(value: string): string\n isSafeVariableIdentifier(value: string): boolean\n}\n\nconst defaultSanitiser: Sanitizer = {\n makeSafePropertyIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeTypeIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return pascalCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeMethodIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n isSafeVariableIdentifier(value: string) {\n return /^[a-z$_][a-z0-9_$]*$/i.test(value)\n },\n makeSafeVariableIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeStringTypeLiteral(value: string): string {\n return escapeQuotes(value)\n },\n getSafeMemberAccessor(value: string): string {\n return this.isSafeVariableIdentifier(value) ? `.${value}` : `['${this.makeSafeStringTypeLiteral(value)}']`\n },\n}\n\nconst preservingSanitiser: Sanitizer = {\n isSafeVariableIdentifier(value: string): boolean {\n return /^[a-z$_][a-z0-9_$]*$/i.test(value)\n },\n makeSafeMethodIdentifier(value: string): string {\n return this.isSafeVariableIdentifier(value) ? value : `\"${this.makeSafeStringTypeLiteral(value)}\"`\n },\n makeSafePropertyIdentifier(value: string): string {\n return this.isSafeVariableIdentifier(value) ? value : `\"${this.makeSafeStringTypeLiteral(value)}\"`\n },\n makeSafeTypeIdentifier(value: string): string {\n return replaceInvalidWithUnderscore(value)\n },\n makeSafeVariableIdentifier(value: string): string {\n return replaceInvalidWithUnderscore(value)\n },\n makeSafeStringTypeLiteral(value: string): string {\n return escapeQuotes(value)\n },\n getSafeMemberAccessor(value: string): string {\n return this.isSafeVariableIdentifier(value) ? `.${value}` : `['${removeEnclosingQuotes(value)}']`\n },\n}\n\nexport const getSanitizer = (options: GeneratorOptions) => (options.preserveNames ? preservingSanitiser : defaultSanitiser)\n"],"names":["camelCase","pascalCase"],"mappings":";;;;AAGA,MAAM,4BAA4B,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAC;AAEnF,MAAM,qBAAqB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AAY5E,MAAM,gBAAgB,GAAc;AAClC,IAAA,0BAA0B,CAAC,KAAa,EAAA;QACtC,M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import { camelCase, pascalCase } from 'change-case'\nimport { GeneratorOptions } from '../client/generator-context'\n\nconst replaceInvalidWithUnderscore = (value: string) => value.replace(/[^a-z0-9_$]+/gi, '_')\n\nconst escapeQuotes = (value: string) => value.replace(/['\"]/g, (val) => `\\\\${val}`)\n\nconst removeEnclosingQuotes = (value: string) => value.replace(/^\"|\"$/g, '')\n\nexport interface Sanitizer {\n makeSafeTypeIdentifier(value: string): string\n makeSafeMethodIdentifier(value: string): string\n makeSafeVariableIdentifier(value: string): string\n makeSafePropertyIdentifier(value: string): string\n makeSafeStringTypeLiteral(value: string): string\n getSafeMemberAccessor(value: string): string\n isSafeVariableIdentifier(value: string): boolean\n}\n\nconst defaultSanitiser: Sanitizer = {\n makeSafePropertyIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeTypeIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return pascalCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeMethodIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n isSafeVariableIdentifier(value: string) {\n return /^[a-z$_][a-z0-9_$]*$/i.test(value)\n },\n makeSafeVariableIdentifier(value: string) {\n const options = value.startsWith('_') ? { prefixCharacters: '_' } : {}\n return camelCase(replaceInvalidWithUnderscore(value), options)\n },\n makeSafeStringTypeLiteral(value: string): string {\n return escapeQuotes(value)\n },\n getSafeMemberAccessor(value: string): string {\n return this.isSafeVariableIdentifier(value) ? `.${value}` : `['${this.makeSafeStringTypeLiteral(value)}']`\n },\n}\n\nconst preservingSanitiser: Sanitizer = {\n isSafeVariableIdentifier(value: string): boolean {\n return /^[a-z$_][a-z0-9_$]*$/i.test(value)\n },\n makeSafeMethodIdentifier(value: string): string {\n return this.isSafeVariableIdentifier(value) ? value : `\"${this.makeSafeStringTypeLiteral(value)}\"`\n },\n makeSafePropertyIdentifier(value: string): string {\n return this.isSafeVariableIdentifier(value) ? value : `\"${this.makeSafeStringTypeLiteral(value)}\"`\n },\n makeSafeTypeIdentifier(value: string): string {\n return replaceInvalidWithUnderscore(value)\n },\n makeSafeVariableIdentifier(value: string): string {\n return replaceInvalidWithUnderscore(value)\n },\n makeSafeStringTypeLiteral(value: string): string {\n return escapeQuotes(value)\n },\n getSafeMemberAccessor(value: string): string {\n return this.isSafeVariableIdentifier(value) ? `.${value}` : `['${removeEnclosingQuotes(value)}']`\n },\n}\n\nexport const getSanitizer = (options: GeneratorOptions) => (options.preserveNames ? preservingSanitiser : defaultSanitiser)\n"],"names":[],"mappings":";;AAGA,MAAM,4BAA4B,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,gBAAgB,EAAE,GAAG,CAAC;AAE5F,MAAM,YAAY,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,OAAO,EAAE,CAAC,GAAG,KAAK,CAAA,EAAA,EAAK,GAAG,CAAA,CAAE,CAAC;AAEnF,MAAM,qBAAqB,GAAG,CAAC,KAAa,KAAK,KAAK,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;AAY5E,MAAM,gBAAgB,GAAc;AAClC,IAAA,0BAA0B,CAAC,KAAa,EAAA;QACtC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE;QACtE,OAAO,SAAS,CAAC,4BAA4B,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChE,CAAC;AACD,IAAA,sBAAsB,CAAC,KAAa,EAAA;QAClC,MAAM,OAAO,GAAG,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC,GAAG,EAAE,gBAAgB,EAAE,GAAG,EAAE,GAAG,EAAE;QACtE,OAAO,UAAU,CAAC,4BAA4B,CAAC,KAAK,CAAC,EAAE,OAAO,C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AC,KAAa,EAAA;QACtC,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG,KAAK,GAAG,IAAI,IAAI,CAAC,yBAAyB,CAAC,KAAK,CAAC,CAAA,CAAA,CAAG;IACpG,CAAC;AACD,IAAA,sBAAsB,CAAC,KAAa,EAAA;AAClC,QAAA,OAAO,4BAA4B,CAAC,KAAK,CAAC;IAC5C,CAAC;AACD,IAAA,0BAA0B,CAAC,KAAa,EAAA;AACtC,QAAA,OAAO,4BAA4B,CAAC,KAAK,CAAC;IAC5C,CAAC;AACD,IAAA,yBAAyB,CAAC,KAAa,EAAA;AACrC,QAAA,OAAO,YAAY,CAAC,KAAK,CAAC;IAC5B,CAAC;AACD,IAAA,qBAAqB,CAAC,KAAa,EAAA;QACjC,OAAO,IAAI,CAAC,wBAAwB,CAAC,KAAK,CAAC,GAAG,CAAA,CAAA,EAAI,KAAK,CAAA,CAAE,GAAG,CAAA,EAAA,EAAK,qBAAqB,CAAC,KAAK,CAAC,CAAA,EAAA,CAAI;IACnG,CAAC;CACF;MAEY,YAAY,GAAG,CAAC,OAAyB,MAAM,OAAO,CAAC,aAAa,GAAG,mBAAmB,GAAG,gBAAgB;;;;"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes