@algorandfoundation/algokit-client-generator 2.6.0 → 3.0.0-beta.1

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 (140) hide show
  1. package/bin/cli.mjs +4 -0
  2. package/cli.d.ts +0 -1
  3. package/cli.js +47 -49
  4. package/cli.js.map +1 -1
  5. package/cli.mjs +56 -0
  6. package/cli.mjs.map +1 -0
  7. package/client/app-types.d.ts +0 -1
  8. package/client/app-types.js +92 -97
  9. package/client/app-types.js.map +1 -1
  10. package/client/app-types.mjs +135 -0
  11. package/client/app-types.mjs.map +1 -0
  12. package/client/call-client.d.ts +0 -1
  13. package/client/call-client.js +145 -143
  14. package/client/call-client.js.map +1 -1
  15. package/client/call-client.mjs +320 -0
  16. package/client/call-client.mjs.map +1 -0
  17. package/client/call-composer-types.d.ts +0 -1
  18. package/client/call-composer-types.js +60 -62
  19. package/client/call-composer-types.js.map +1 -1
  20. package/client/call-composer-types.mjs +122 -0
  21. package/client/call-composer-types.mjs.map +1 -0
  22. package/client/call-composer.d.ts +0 -1
  23. package/client/call-composer.js +76 -78
  24. package/client/call-composer.js.map +1 -1
  25. package/client/call-composer.mjs +128 -0
  26. package/client/call-composer.mjs.map +1 -0
  27. package/client/call-factory.d.ts +0 -1
  28. package/client/call-factory.js +62 -62
  29. package/client/call-factory.js.map +1 -1
  30. package/client/call-factory.mjs +121 -0
  31. package/client/call-factory.mjs.map +1 -0
  32. package/client/deploy-types.d.ts +1 -2
  33. package/client/deploy-types.js +42 -40
  34. package/client/deploy-types.js.map +1 -1
  35. package/client/deploy-types.mjs +94 -0
  36. package/client/deploy-types.mjs.map +1 -0
  37. package/client/generate.d.ts +2 -2
  38. package/client/generate.js +28 -27
  39. package/client/generate.js.map +1 -1
  40. package/client/generate.mjs +36 -0
  41. package/client/generate.mjs.map +1 -0
  42. package/client/generator-context.d.ts +7 -2
  43. package/client/generator-context.js +39 -38
  44. package/client/generator-context.js.map +1 -1
  45. package/client/generator-context.mjs +21 -0
  46. package/client/generator-context.mjs.map +1 -0
  47. package/client/helpers/get-call-config-summary.d.ts +1 -2
  48. package/client/helpers/get-call-config-summary.js +8 -25
  49. package/client/helpers/get-call-config-summary.js.map +1 -1
  50. package/client/helpers/get-call-config-summary.mjs +55 -0
  51. package/client/helpers/get-call-config-summary.mjs.map +1 -0
  52. package/client/helpers/get-equivalent-type.d.ts +0 -1
  53. package/client/helpers/get-equivalent-type.js +21 -20
  54. package/client/helpers/get-equivalent-type.js.map +1 -1
  55. package/client/helpers/get-equivalent-type.mjs +57 -0
  56. package/client/helpers/get-equivalent-type.mjs.map +1 -0
  57. package/client/imports.d.ts +0 -1
  58. package/client/imports.js +4 -4
  59. package/client/imports.js.map +1 -1
  60. package/client/imports.mjs +28 -0
  61. package/client/imports.mjs.map +1 -0
  62. package/client/utility-types.d.ts +0 -1
  63. package/client/utility-types.js +27 -25
  64. package/client/utility-types.js.map +1 -1
  65. package/client/utility-types.mjs +48 -0
  66. package/client/utility-types.mjs.map +1 -0
  67. package/dev.d.ts +0 -1
  68. package/index.d.ts +0 -1
  69. package/index.js +14 -12
  70. package/index.js.map +1 -1
  71. package/index.mjs +4 -0
  72. package/index.mjs.map +1 -0
  73. package/output/writer.d.ts +0 -1
  74. package/output/writer.js +45 -38
  75. package/output/writer.js.map +1 -1
  76. package/output/writer.mjs +140 -0
  77. package/output/writer.mjs.map +1 -0
  78. package/package.json +9 -4
  79. package/schema/application.schema.json.js +375 -0
  80. package/schema/application.schema.json.js.map +1 -0
  81. package/schema/application.schema.json.mjs +364 -0
  82. package/schema/application.schema.json.mjs.map +1 -0
  83. package/schema/contract.schema.json.js +160 -0
  84. package/schema/contract.schema.json.js.map +1 -0
  85. package/schema/contract.schema.json.mjs +149 -0
  86. package/schema/contract.schema.json.mjs.map +1 -0
  87. package/schema/load.d.ts +0 -1
  88. package/schema/load.js +16 -41
  89. package/schema/load.js.map +1 -1
  90. package/schema/load.mjs +23 -0
  91. package/schema/load.mjs.map +1 -0
  92. package/tests/approval-tests.spec.d.ts +0 -1
  93. package/tests/util.d.ts +1 -0
  94. package/util/boom.d.ts +0 -1
  95. package/util/boom.js +4 -4
  96. package/util/boom.js.map +1 -1
  97. package/util/boom.mjs +6 -0
  98. package/util/boom.mjs.map +1 -0
  99. package/util/color-console.d.ts +0 -1
  100. package/util/color-console.js +12 -13
  101. package/util/color-console.js.map +1 -1
  102. package/util/color-console.mjs +17 -0
  103. package/util/color-console.mjs.map +1 -0
  104. package/util/not-falsy.d.ts +0 -1
  105. package/util/sanitization.d.ts +12 -6
  106. package/util/sanitization.js +54 -15
  107. package/util/sanitization.js.map +1 -1
  108. package/util/sanitization.mjs +54 -0
  109. package/util/sanitization.mjs.map +1 -0
  110. package/bin/cli.js +0 -4
  111. package/cli.d.ts.map +0 -1
  112. package/client/app-types.d.ts.map +0 -1
  113. package/client/call-client.d.ts.map +0 -1
  114. package/client/call-composer-types.d.ts.map +0 -1
  115. package/client/call-composer.d.ts.map +0 -1
  116. package/client/call-factory.d.ts.map +0 -1
  117. package/client/deploy-types.d.ts.map +0 -1
  118. package/client/generate.d.ts.map +0 -1
  119. package/client/generator-context.d.ts.map +0 -1
  120. package/client/helpers/get-call-config-summary.d.ts.map +0 -1
  121. package/client/helpers/get-equivalent-type.d.ts.map +0 -1
  122. package/client/imports.d.ts.map +0 -1
  123. package/client/utility-types.d.ts.map +0 -1
  124. package/dev.d.ts.map +0 -1
  125. package/dev.js +0 -5
  126. package/dev.js.map +0 -1
  127. package/index.d.ts.map +0 -1
  128. package/output/writer.d.ts.map +0 -1
  129. package/schema/application.schema.json +0 -354
  130. package/schema/contract.schema.json +0 -139
  131. package/schema/load.d.ts.map +0 -1
  132. package/tests/approval-tests.spec.d.ts.map +0 -1
  133. package/tests/approval-tests.spec.js +0 -24
  134. package/tests/approval-tests.spec.js.map +0 -1
  135. package/util/boom.d.ts.map +0 -1
  136. package/util/color-console.d.ts.map +0 -1
  137. package/util/not-falsy.d.ts.map +0 -1
  138. package/util/not-falsy.js +0 -6
  139. package/util/not-falsy.js.map +0 -1
  140. package/util/sanitization.d.ts.map +0 -1
@@ -0,0 +1 @@
1
+ {"version":3,"file":"application.schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,160 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var $schema = "http://json-schema.org/draft-07/schema";
6
+ var title = "AbiContract";
7
+ var type = "object";
8
+ var required = [
9
+ "name",
10
+ "methods"
11
+ ];
12
+ var additionalProperties = true;
13
+ var properties = {
14
+ name: {
15
+ type: "string"
16
+ },
17
+ desc: {
18
+ type: "string"
19
+ },
20
+ methods: {
21
+ type: "array",
22
+ items: {
23
+ $ref: "#/definitions/ContractMethod"
24
+ }
25
+ },
26
+ events: {
27
+ type: "array",
28
+ items: {
29
+ $ref: "#/definitions/Event"
30
+ }
31
+ },
32
+ networks: {
33
+ type: "object",
34
+ additionalProperties: {
35
+ type: "object",
36
+ required: [
37
+ "appID"
38
+ ],
39
+ additionalProperties: true,
40
+ properties: {
41
+ appID: {
42
+ type: "number"
43
+ }
44
+ }
45
+ }
46
+ }
47
+ };
48
+ var definitions = {
49
+ ContractMethod: {
50
+ type: "object",
51
+ additionalProperties: true,
52
+ required: [
53
+ "name",
54
+ "args",
55
+ "returns"
56
+ ],
57
+ properties: {
58
+ name: {
59
+ type: "string"
60
+ },
61
+ args: {
62
+ type: "array",
63
+ items: {
64
+ $ref: "#/definitions/ContractMethodArg"
65
+ }
66
+ },
67
+ desc: {
68
+ type: "string"
69
+ },
70
+ returns: {
71
+ type: "object",
72
+ additionalProperties: true,
73
+ required: [
74
+ "type"
75
+ ],
76
+ properties: {
77
+ desc: {
78
+ type: "string"
79
+ },
80
+ type: {
81
+ $ref: "#/definitions/ABIType"
82
+ }
83
+ }
84
+ },
85
+ readonly: {
86
+ type: "boolean"
87
+ },
88
+ events: {
89
+ type: "array",
90
+ items: {
91
+ $ref: "#/definitions/Event"
92
+ }
93
+ }
94
+ }
95
+ },
96
+ Event: {
97
+ type: "object",
98
+ additionalProperties: true,
99
+ required: [
100
+ "name",
101
+ "args"
102
+ ],
103
+ properties: {
104
+ name: {
105
+ type: "string"
106
+ },
107
+ args: {
108
+ type: "array",
109
+ items: {
110
+ $ref: "#/definitions/ContractMethodArg"
111
+ }
112
+ },
113
+ desc: {
114
+ type: "string"
115
+ }
116
+ }
117
+ },
118
+ ContractMethodArg: {
119
+ type: "object",
120
+ additionalProperties: true,
121
+ required: [
122
+ "name",
123
+ "type"
124
+ ],
125
+ properties: {
126
+ desc: {
127
+ type: "string"
128
+ },
129
+ type: {
130
+ $ref: "#/definitions/ABIType"
131
+ },
132
+ name: {
133
+ type: "string"
134
+ }
135
+ }
136
+ },
137
+ ABIType: {
138
+ description: "Catch all for fixed length arrays and tuples",
139
+ type: "string"
140
+ }
141
+ };
142
+ var contractSchema = {
143
+ $schema: $schema,
144
+ title: title,
145
+ type: type,
146
+ required: required,
147
+ additionalProperties: additionalProperties,
148
+ properties: properties,
149
+ definitions: definitions
150
+ };
151
+
152
+ exports.$schema = $schema;
153
+ exports.additionalProperties = additionalProperties;
154
+ exports.default = contractSchema;
155
+ exports.definitions = definitions;
156
+ exports.properties = properties;
157
+ exports.required = required;
158
+ exports.title = title;
159
+ exports.type = type;
160
+ //# sourceMappingURL=contract.schema.json.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.schema.json.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,149 @@
1
+ var $schema = "http://json-schema.org/draft-07/schema";
2
+ var title = "AbiContract";
3
+ var type = "object";
4
+ var required = [
5
+ "name",
6
+ "methods"
7
+ ];
8
+ var additionalProperties = true;
9
+ var properties = {
10
+ name: {
11
+ type: "string"
12
+ },
13
+ desc: {
14
+ type: "string"
15
+ },
16
+ methods: {
17
+ type: "array",
18
+ items: {
19
+ $ref: "#/definitions/ContractMethod"
20
+ }
21
+ },
22
+ events: {
23
+ type: "array",
24
+ items: {
25
+ $ref: "#/definitions/Event"
26
+ }
27
+ },
28
+ networks: {
29
+ type: "object",
30
+ additionalProperties: {
31
+ type: "object",
32
+ required: [
33
+ "appID"
34
+ ],
35
+ additionalProperties: true,
36
+ properties: {
37
+ appID: {
38
+ type: "number"
39
+ }
40
+ }
41
+ }
42
+ }
43
+ };
44
+ var definitions = {
45
+ ContractMethod: {
46
+ type: "object",
47
+ additionalProperties: true,
48
+ required: [
49
+ "name",
50
+ "args",
51
+ "returns"
52
+ ],
53
+ properties: {
54
+ name: {
55
+ type: "string"
56
+ },
57
+ args: {
58
+ type: "array",
59
+ items: {
60
+ $ref: "#/definitions/ContractMethodArg"
61
+ }
62
+ },
63
+ desc: {
64
+ type: "string"
65
+ },
66
+ returns: {
67
+ type: "object",
68
+ additionalProperties: true,
69
+ required: [
70
+ "type"
71
+ ],
72
+ properties: {
73
+ desc: {
74
+ type: "string"
75
+ },
76
+ type: {
77
+ $ref: "#/definitions/ABIType"
78
+ }
79
+ }
80
+ },
81
+ readonly: {
82
+ type: "boolean"
83
+ },
84
+ events: {
85
+ type: "array",
86
+ items: {
87
+ $ref: "#/definitions/Event"
88
+ }
89
+ }
90
+ }
91
+ },
92
+ Event: {
93
+ type: "object",
94
+ additionalProperties: true,
95
+ required: [
96
+ "name",
97
+ "args"
98
+ ],
99
+ properties: {
100
+ name: {
101
+ type: "string"
102
+ },
103
+ args: {
104
+ type: "array",
105
+ items: {
106
+ $ref: "#/definitions/ContractMethodArg"
107
+ }
108
+ },
109
+ desc: {
110
+ type: "string"
111
+ }
112
+ }
113
+ },
114
+ ContractMethodArg: {
115
+ type: "object",
116
+ additionalProperties: true,
117
+ required: [
118
+ "name",
119
+ "type"
120
+ ],
121
+ properties: {
122
+ desc: {
123
+ type: "string"
124
+ },
125
+ type: {
126
+ $ref: "#/definitions/ABIType"
127
+ },
128
+ name: {
129
+ type: "string"
130
+ }
131
+ }
132
+ },
133
+ ABIType: {
134
+ description: "Catch all for fixed length arrays and tuples",
135
+ type: "string"
136
+ }
137
+ };
138
+ var contractSchema = {
139
+ $schema: $schema,
140
+ title: title,
141
+ type: type,
142
+ required: required,
143
+ additionalProperties: additionalProperties,
144
+ properties: properties,
145
+ definitions: definitions
146
+ };
147
+
148
+ export { $schema, additionalProperties, contractSchema as default, definitions, properties, required, title, type };
149
+ //# sourceMappingURL=contract.schema.json.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract.schema.json.mjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
package/schema/load.d.ts CHANGED
@@ -1,4 +1,3 @@
1
1
  import { AlgoAppSpec } from './application';
2
2
  export declare function loadApplicationJson(appJsonPath: string): Promise<AlgoAppSpec>;
3
3
  export declare function validateApplicationJson(json: unknown): AlgoAppSpec;
4
- //# sourceMappingURL=load.d.ts.map
package/schema/load.js CHANGED
@@ -1,51 +1,26 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.validateApplicationJson = exports.loadApplicationJson = void 0;
30
- const jsonschema_1 = require("jsonschema");
31
- const boom_1 = require("../util/boom");
32
- const application_schema_json_1 = __importDefault(require("./application.schema.json"));
33
- const contract_schema_json_1 = __importDefault(require("./contract.schema.json"));
1
+ 'use strict';
2
+
3
+ var jsonschema = require('jsonschema');
4
+ var boom = require('../util/boom.js');
5
+ var application_schema = require('./application.schema.json.js');
6
+ var contract_schema = require('./contract.schema.json.js');
7
+
34
8
  async function loadApplicationJson(appJsonPath) {
35
- const fs = await Promise.resolve().then(() => __importStar(require('fs')));
9
+ const fs = await import('fs');
36
10
  if (!fs.existsSync(appJsonPath))
37
- (0, boom_1.boom)(`Could not find application.json file at ${appJsonPath}`);
11
+ boom.boom(`Could not find application.json file at ${appJsonPath}`);
38
12
  const file = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'));
39
13
  return validateApplicationJson(file);
40
14
  }
41
- exports.loadApplicationJson = loadApplicationJson;
42
15
  function validateApplicationJson(json) {
43
- const validator = new jsonschema_1.Validator();
44
- validator.addSchema(contract_schema_json_1.default, '/contract.schema.json');
45
- const result = validator.validate(json, application_schema_json_1.default);
16
+ const validator = new jsonschema.Validator();
17
+ validator.addSchema(contract_schema.default, '/contract.schema.json');
18
+ const result = validator.validate(json, application_schema.default);
46
19
  if (!result.valid)
47
- (0, boom_1.boom)(result.toString());
20
+ boom.boom(result.toString());
48
21
  return json;
49
22
  }
23
+
24
+ exports.loadApplicationJson = loadApplicationJson;
50
25
  exports.validateApplicationJson = validateApplicationJson;
51
- //# sourceMappingURL=load.js.map
26
+ //# sourceMappingURL=load.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/schema/load.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2CAA8C;AAC9C,uCAAmC;AAEnC,wFAAqD;AACrD,kFAAmD;AAE5C,KAAK,UAAU,mBAAmB,CAAC,WAAmB;IAC3D,MAAM,EAAE,GAAG,wDAAa,IAAI,GAAC,CAAA;IAC7B,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;QAAE,IAAA,WAAI,EAAC,2CAA2C,WAAW,EAAE,CAAC,CAAA;IAE/F,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;IAC9D,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC;AAND,kDAMC;AAED,SAAgB,uBAAuB,CAAC,IAAa;IACnD,MAAM,SAAS,GAAG,IAAI,sBAAS,EAAE,CAAA;IACjC,SAAS,CAAC,SAAS,CAAC,8BAAc,EAAE,uBAAuB,CAAC,CAAA;IAE5D,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,iCAAkC,CAAC,CAAA;IAE3E,IAAI,CAAC,MAAM,CAAC,KAAK;QAAE,IAAA,WAAI,EAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;IAE1C,OAAO,IAAmB,CAAA;AAC5B,CAAC;AATD,0DASC"}
1
+ {"version":3,"file":"load.js","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport { AlgoAppSpec } from './application'\nimport appJsonSchema from './application.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<AlgoAppSpec> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n const file = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'))\n return validateApplicationJson(file)\n}\n\nexport function validateApplicationJson(json: unknown): AlgoAppSpec {\n const validator = new Validator()\n validator.addSchema(contractSchema, '/contract.schema.json')\n\n const result = validator.validate(json, appJsonSchema as unknown as Schema)\n\n if (!result.valid) boom(result.toString())\n\n return json as AlgoAppSpec\n}\n"],"names":["boom","Validator","contractSchema","appJsonSchema"],"mappings":";;;;;;;AAMO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC,CAAA;AAC7B,IAAA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,QAAAA,SAAI,CAAC,CAAA,wCAAA,EAA2C,WAAW,CAAA,CAAE,CAAC,CAAA;AAE/F,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;AAC9D,IAAA,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC;AAEK,SAAU,uBAAuB,CAAC,IAAa,EAAA;AACnD,IAAA,MAAM,SAAS,GAAG,IAAIC,oBAAS,EAAE,CAAA;AACjC,IAAA,SAAS,CAAC,SAAS,CAACC,uBAAc,EAAE,uBAAuB,CAAC,CAAA;IAE5D,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAEC,0BAAkC,CAAC,CAAA;IAE3E,IAAI,CAAC,MAAM,CAAC,KAAK;AAAE,QAAAH,SAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;AAE1C,IAAA,OAAO,IAAmB,CAAA;AAC5B;;;;;"}
@@ -0,0 +1,23 @@
1
+ import { Validator } from 'jsonschema';
2
+ import { boom } from '../util/boom.mjs';
3
+ import appJsonSchema from './application.schema.json.mjs';
4
+ import contractSchema from './contract.schema.json.mjs';
5
+
6
+ async function loadApplicationJson(appJsonPath) {
7
+ const fs = await import('fs');
8
+ if (!fs.existsSync(appJsonPath))
9
+ boom(`Could not find application.json file at ${appJsonPath}`);
10
+ const file = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'));
11
+ return validateApplicationJson(file);
12
+ }
13
+ function validateApplicationJson(json) {
14
+ const validator = new Validator();
15
+ validator.addSchema(contractSchema, '/contract.schema.json');
16
+ const result = validator.validate(json, appJsonSchema);
17
+ if (!result.valid)
18
+ boom(result.toString());
19
+ return json;
20
+ }
21
+
22
+ export { loadApplicationJson, validateApplicationJson };
23
+ //# sourceMappingURL=load.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"load.mjs","sources":["../../src/schema/load.ts"],"sourcesContent":["import { Schema, Validator } from 'jsonschema'\nimport { boom } from '../util/boom'\nimport { AlgoAppSpec } from './application'\nimport appJsonSchema from './application.schema.json' with { type: 'json' }\nimport contractSchema from './contract.schema.json' with { type: 'json' }\n\nexport async function loadApplicationJson(appJsonPath: string): Promise<AlgoAppSpec> {\n const fs = await import('fs')\n if (!fs.existsSync(appJsonPath)) boom(`Could not find application.json file at ${appJsonPath}`)\n\n const file = JSON.parse(fs.readFileSync(appJsonPath, 'utf-8'))\n return validateApplicationJson(file)\n}\n\nexport function validateApplicationJson(json: unknown): AlgoAppSpec {\n const validator = new Validator()\n validator.addSchema(contractSchema, '/contract.schema.json')\n\n const result = validator.validate(json, appJsonSchema as unknown as Schema)\n\n if (!result.valid) boom(result.toString())\n\n return json as AlgoAppSpec\n}\n"],"names":[],"mappings":";;;;;AAMO,eAAe,mBAAmB,CAAC,WAAmB,EAAA;AAC3D,IAAA,MAAM,EAAE,GAAG,MAAM,OAAO,IAAI,CAAC,CAAA;AAC7B,IAAA,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,WAAW,CAAC;AAAE,QAAA,IAAI,CAAC,CAAA,wCAAA,EAA2C,WAAW,CAAA,CAAE,CAAC,CAAA;AAE/F,IAAA,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC,CAAA;AAC9D,IAAA,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAA;AACtC,CAAC;AAEK,SAAU,uBAAuB,CAAC,IAAa,EAAA;AACnD,IAAA,MAAM,SAAS,GAAG,IAAI,SAAS,EAAE,CAAA;AACjC,IAAA,SAAS,CAAC,SAAS,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAA;IAE5D,MAAM,MAAM,GAAG,SAAS,CAAC,QAAQ,CAAC,IAAI,EAAE,aAAkC,CAAC,CAAA;IAE3E,IAAI,CAAC,MAAM,CAAC,KAAK;AAAE,QAAA,IAAI,CAAC,MAAM,CAAC,QAAQ,EAAE,CAAC,CAAA;AAE1C,IAAA,OAAO,IAAmB,CAAA;AAC5B;;;;"}
@@ -1,2 +1 @@
1
1
  export {};
2
- //# sourceMappingURL=approval-tests.spec.d.ts.map
@@ -0,0 +1 @@
1
+ export declare const setUpLocalnet: () => Promise<import("@algorandfoundation/algokit-utils/types/testing").AlgorandFixture>;
package/util/boom.d.ts CHANGED
@@ -1,2 +1 @@
1
1
  export declare const boom: (reason: string) => never;
2
- //# sourceMappingURL=boom.d.ts.map
package/util/boom.js CHANGED
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.boom = void 0;
1
+ 'use strict';
2
+
4
3
  const boom = (reason) => {
5
4
  throw new Error(reason);
6
5
  };
6
+
7
7
  exports.boom = boom;
8
- //# sourceMappingURL=boom.js.map
8
+ //# sourceMappingURL=boom.js.map
package/util/boom.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"boom.js","sourceRoot":"","sources":["../../src/util/boom.ts"],"names":[],"mappings":";;;AAAO,MAAM,IAAI,GAAG,CAAC,MAAc,EAAS,EAAE;IAC5C,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAA;AACzB,CAAC,CAAA;AAFY,QAAA,IAAI,QAEhB"}
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":";;AAAa,MAAA,IAAI,GAAG,CAAC,MAAc,KAAW;AAC5C,IAAA,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAA;AACzB;;;;"}
package/util/boom.mjs ADDED
@@ -0,0 +1,6 @@
1
+ const boom = (reason) => {
2
+ throw new Error(reason);
3
+ };
4
+
5
+ export { boom };
6
+ //# sourceMappingURL=boom.mjs.map
@@ -0,0 +1 @@
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":"AAAa,MAAA,IAAI,GAAG,CAAC,MAAc,KAAW;AAC5C,IAAA,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAA;AACzB;;;;"}
@@ -4,4 +4,3 @@ export declare const colorConsole: {
4
4
  success: (textParts: TemplateStringsArray, ...args: unknown[]) => void;
5
5
  error: (textParts: TemplateStringsArray, ...args: unknown[]) => void;
6
6
  };
7
- //# sourceMappingURL=color-console.d.ts.map
@@ -1,20 +1,19 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.colorConsole = void 0;
7
- const chalk_1 = __importDefault(require("chalk"));
1
+ 'use strict';
2
+
3
+ var chalk = require('chalk');
4
+
8
5
  const createColorFormatter = (textColor, argColor, consoleFn) => (textParts, ...args) => {
9
6
  // eslint-disable-next-line no-console
10
7
  console[consoleFn](textParts
11
8
  .flatMap((t, i) => (args.length > i ? [textColor(t), argColor(`${args[i]}`)] : textColor(t)))
12
9
  .reduce((acc, cur) => acc + cur, ''));
13
10
  };
14
- exports.colorConsole = {
15
- info: createColorFormatter(chalk_1.default.cyan, chalk_1.default.blue, 'info'),
16
- warn: createColorFormatter(chalk_1.default.yellow, chalk_1.default.yellow.bold, 'warn'),
17
- success: createColorFormatter(chalk_1.default.green, chalk_1.default.green.bold, 'info'),
18
- error: createColorFormatter(chalk_1.default.red, chalk_1.default.red.bold, 'error'),
11
+ const colorConsole = {
12
+ info: createColorFormatter(chalk.cyan, chalk.blue, 'info'),
13
+ warn: createColorFormatter(chalk.yellow, chalk.yellow.bold, 'warn'),
14
+ success: createColorFormatter(chalk.green, chalk.green.bold, 'info'),
15
+ error: createColorFormatter(chalk.red, chalk.red.bold, 'error'),
19
16
  };
20
- //# sourceMappingURL=color-console.js.map
17
+
18
+ exports.colorConsole = colorConsole;
19
+ //# sourceMappingURL=color-console.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"color-console.js","sourceRoot":"","sources":["../../src/util/color-console.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyB;AAIzB,MAAM,oBAAoB,GACxB,CAAC,SAAkB,EAAE,QAAiB,EAAE,SAA4C,EAAE,EAAE,CACxF,CAAC,SAA+B,EAAE,GAAG,IAAe,EAAQ,EAAE;IAC5D,sCAAsC;IACtC,OAAO,CAAC,SAAS,CAAC,CAChB,SAAS;SACN,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;SAC5F,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CACvC,CAAA;AACH,CAAC,CAAA;AAEU,QAAA,YAAY,GAAG;IAC1B,IAAI,EAAE,oBAAoB,CAAC,eAAK,CAAC,IAAI,EAAE,eAAK,CAAC,IAAI,EAAE,MAAM,CAAC;IAC1D,IAAI,EAAE,oBAAoB,CAAC,eAAK,CAAC,MAAM,EAAE,eAAK,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC;IACnE,OAAO,EAAE,oBAAoB,CAAC,eAAK,CAAC,KAAK,EAAE,eAAK,CAAC,KAAK,CAAC,IAAI,EAAE,MAAM,CAAC;IACpE,KAAK,EAAE,oBAAoB,CAAC,eAAK,CAAC,GAAG,EAAE,eAAK,CAAC,GAAG,CAAC,IAAI,EAAE,OAAO,CAAC;CAChE,CAAA"}
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,SAAS;AACN,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,CAAC;AAC5F,SAAA,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CACvC,CAAA;AACH,CAAC,CAAA;AAEU,MAAA,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;;;;;"}
@@ -0,0 +1,17 @@
1
+ import chalk from 'chalk';
2
+
3
+ const createColorFormatter = (textColor, argColor, consoleFn) => (textParts, ...args) => {
4
+ // eslint-disable-next-line no-console
5
+ console[consoleFn](textParts
6
+ .flatMap((t, i) => (args.length > i ? [textColor(t), argColor(`${args[i]}`)] : textColor(t)))
7
+ .reduce((acc, cur) => acc + cur, ''));
8
+ };
9
+ const colorConsole = {
10
+ info: createColorFormatter(chalk.cyan, chalk.blue, 'info'),
11
+ warn: createColorFormatter(chalk.yellow, chalk.yellow.bold, 'warn'),
12
+ success: createColorFormatter(chalk.green, chalk.green.bold, 'info'),
13
+ error: createColorFormatter(chalk.red, chalk.red.bold, 'error'),
14
+ };
15
+
16
+ export { colorConsole };
17
+ //# sourceMappingURL=color-console.mjs.map
@@ -0,0 +1 @@
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,SAAS;AACN,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,CAAC;AAC5F,SAAA,MAAM,CAAC,CAAC,GAAG,EAAE,GAAG,KAAK,GAAG,GAAG,GAAG,EAAE,EAAE,CAAC,CACvC,CAAA;AACH,CAAC,CAAA;AAEU,MAAA,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,2 +1 @@
1
1
  export declare const notFalsy: <T>(value: T) => value is Exclude<T, false | "" | 0 | null | undefined>;
2
- //# sourceMappingURL=not-falsy.d.ts.map
@@ -1,6 +1,12 @@
1
- export declare const makeSafeTypeIdentifier: (value: string) => string;
2
- export declare const makeSafeMethodIdentifier: (value: string) => string;
3
- export declare const isSafeVariableIdentifier: (value: string) => boolean;
4
- export declare const makeSafeVariableIdentifier: (value: string) => string;
5
- export declare const makeSafePropertyIdentifier: (value: string) => string;
6
- //# sourceMappingURL=sanitization.d.ts.map
1
+ export interface Sanitizer {
2
+ makeSafeTypeIdentifier(value: string): string;
3
+ makeSafeMethodIdentifier(value: string): string;
4
+ makeSafeVariableIdentifier(value: string): string;
5
+ makeSafePropertyIdentifier(value: string): string;
6
+ makeSafeStringTypeLiteral(value: string): string;
7
+ getSafeMemberAccessor(value: string): string;
8
+ isSafeVariableIdentifier(value: string): boolean;
9
+ }
10
+ export declare const getSanitizer: ({ preserveNames }: {
11
+ preserveNames: boolean;
12
+ }) => Sanitizer;
@@ -1,17 +1,56 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.makeSafePropertyIdentifier = exports.makeSafeVariableIdentifier = exports.isSafeVariableIdentifier = exports.makeSafeMethodIdentifier = exports.makeSafeTypeIdentifier = void 0;
4
- const change_case_1 = require("change-case");
1
+ 'use strict';
2
+
3
+ var changeCase = require('change-case');
4
+
5
5
  const replaceInvalidWithUnderscore = (value) => value.replace(/[^a-z0-9_$]+/gi, '_');
6
- const makeSafeTypeIdentifier = (value) => (0, change_case_1.pascalCase)(replaceInvalidWithUnderscore(value));
7
- exports.makeSafeTypeIdentifier = makeSafeTypeIdentifier;
8
- const makeSafeMethodIdentifier = (value) => (0, change_case_1.camelCase)(replaceInvalidWithUnderscore(value));
9
- exports.makeSafeMethodIdentifier = makeSafeMethodIdentifier;
10
- const isSafeVariableIdentifier = (value) => /^[a-z$_][a-z0-9_$]*$/i.test(value);
11
- exports.isSafeVariableIdentifier = isSafeVariableIdentifier;
12
- const makeSafeVariableIdentifier = (value) => (0, exports.isSafeVariableIdentifier)(value) ? value : (0, change_case_1.camelCase)(replaceInvalidWithUnderscore(value)) || 'arg';
13
- exports.makeSafeVariableIdentifier = makeSafeVariableIdentifier;
14
6
  const escapeQuotes = (value) => value.replace(/['"]/g, (val) => `\\${val}`);
15
- const makeSafePropertyIdentifier = (value) => ((0, exports.isSafeVariableIdentifier)(value) ? value : `'${escapeQuotes(value)}'`);
16
- exports.makeSafePropertyIdentifier = makeSafePropertyIdentifier;
17
- //# sourceMappingURL=sanitization.js.map
7
+ const defaultSanitiser = {
8
+ makeSafePropertyIdentifier(value) {
9
+ return changeCase.camelCase(replaceInvalidWithUnderscore(value));
10
+ },
11
+ makeSafeTypeIdentifier(value) {
12
+ return changeCase.pascalCase(replaceInvalidWithUnderscore(value));
13
+ },
14
+ makeSafeMethodIdentifier(value) {
15
+ return changeCase.camelCase(replaceInvalidWithUnderscore(value));
16
+ },
17
+ isSafeVariableIdentifier(value) {
18
+ return /^[a-z$_][a-z0-9_$]*$/i.test(value);
19
+ },
20
+ makeSafeVariableIdentifier(value) {
21
+ return changeCase.camelCase(replaceInvalidWithUnderscore(value));
22
+ },
23
+ makeSafeStringTypeLiteral(value) {
24
+ return escapeQuotes(value);
25
+ },
26
+ getSafeMemberAccessor(value) {
27
+ return this.isSafeVariableIdentifier(value) ? `.${value}` : `[${value}]`;
28
+ },
29
+ };
30
+ const preservingSanitiser = {
31
+ isSafeVariableIdentifier(value) {
32
+ return /^[a-z$_][a-z0-9_$]*$/i.test(value);
33
+ },
34
+ makeSafeMethodIdentifier(value) {
35
+ return this.isSafeVariableIdentifier(value) ? value : `"${escapeQuotes(value)}"`;
36
+ },
37
+ makeSafePropertyIdentifier(value) {
38
+ return this.isSafeVariableIdentifier(value) ? value : `"${escapeQuotes(value)}"`;
39
+ },
40
+ makeSafeTypeIdentifier(value) {
41
+ return replaceInvalidWithUnderscore(value);
42
+ },
43
+ makeSafeVariableIdentifier(value) {
44
+ return replaceInvalidWithUnderscore(value);
45
+ },
46
+ makeSafeStringTypeLiteral(value) {
47
+ return escapeQuotes(value);
48
+ },
49
+ getSafeMemberAccessor(value) {
50
+ return this.isSafeVariableIdentifier(value) ? `.${value}` : `[${value}]`;
51
+ },
52
+ };
53
+ const getSanitizer = ({ preserveNames }) => (preserveNames ? preservingSanitiser : defaultSanitiser);
54
+
55
+ exports.getSanitizer = getSanitizer;
56
+ //# sourceMappingURL=sanitization.js.map