@dedot/codegen 0.0.1-next.f5bf4fc2.1 → 0.1.0

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 (163) hide show
  1. package/{generator → chaintypes/generator}/ApiGen.d.ts +13 -13
  2. package/chaintypes/generator/ConstsGen.d.ts +4 -0
  3. package/{generator → chaintypes/generator}/ConstsGen.js +8 -9
  4. package/chaintypes/generator/ErrorsGen.d.ts +5 -0
  5. package/{generator → chaintypes/generator}/ErrorsGen.js +11 -12
  6. package/chaintypes/generator/EventsGen.d.ts +5 -0
  7. package/{generator → chaintypes/generator}/EventsGen.js +11 -12
  8. package/chaintypes/generator/IndexGen.d.ts +5 -0
  9. package/chaintypes/generator/IndexGen.js +17 -0
  10. package/chaintypes/generator/JsonRpcGen.d.ts +8 -0
  11. package/chaintypes/generator/JsonRpcGen.js +55 -0
  12. package/chaintypes/generator/QueryGen.d.ts +5 -0
  13. package/chaintypes/generator/QueryGen.js +63 -0
  14. package/chaintypes/generator/RuntimeApisGen.d.ts +9 -0
  15. package/{generator → chaintypes/generator}/RuntimeApisGen.js +98 -24
  16. package/chaintypes/generator/TxGen.d.ts +5 -0
  17. package/{generator → chaintypes/generator}/TxGen.js +18 -16
  18. package/chaintypes/generator/TypesGen.d.ts +11 -0
  19. package/chaintypes/generator/TypesGen.js +55 -0
  20. package/chaintypes/generator/index.d.ts +10 -0
  21. package/chaintypes/generator/index.js +10 -0
  22. package/chaintypes/index.d.ts +3 -0
  23. package/chaintypes/index.js +49 -0
  24. package/chaintypes/templates/consts.hbs +7 -0
  25. package/chaintypes/templates/errors.hbs +7 -0
  26. package/chaintypes/templates/events.hbs +7 -0
  27. package/chaintypes/templates/index.hbs +27 -0
  28. package/chaintypes/templates/json-rpc.hbs +5 -0
  29. package/chaintypes/templates/query.hbs +7 -0
  30. package/chaintypes/templates/runtime.hbs +8 -0
  31. package/chaintypes/templates/tx.hbs +9 -0
  32. package/{cjs → chaintypes}/templates/types.hbs +1 -1
  33. package/cjs/{generator → chaintypes/generator}/ConstsGen.js +12 -13
  34. package/cjs/chaintypes/generator/ErrorsGen.js +40 -0
  35. package/cjs/{generator → chaintypes/generator}/EventsGen.js +17 -18
  36. package/cjs/chaintypes/generator/IndexGen.js +21 -0
  37. package/cjs/chaintypes/generator/JsonRpcGen.js +59 -0
  38. package/cjs/chaintypes/generator/QueryGen.js +67 -0
  39. package/cjs/chaintypes/generator/RuntimeApisGen.js +193 -0
  40. package/cjs/{generator → chaintypes/generator}/TxGen.js +27 -25
  41. package/cjs/chaintypes/generator/TypesGen.js +59 -0
  42. package/cjs/chaintypes/generator/index.js +26 -0
  43. package/cjs/chaintypes/index.js +77 -0
  44. package/cjs/chaintypes/templates/consts.hbs +7 -0
  45. package/cjs/chaintypes/templates/errors.hbs +7 -0
  46. package/cjs/chaintypes/templates/events.hbs +7 -0
  47. package/cjs/chaintypes/templates/index.hbs +27 -0
  48. package/cjs/chaintypes/templates/json-rpc.hbs +5 -0
  49. package/cjs/chaintypes/templates/query.hbs +7 -0
  50. package/cjs/chaintypes/templates/runtime.hbs +8 -0
  51. package/cjs/chaintypes/templates/tx.hbs +9 -0
  52. package/{templates → cjs/chaintypes/templates}/types.hbs +1 -1
  53. package/cjs/index.js +4 -62
  54. package/cjs/{generator/TypesGen.js → shared/BaseTypesGen.js} +123 -178
  55. package/cjs/{generator → shared}/TypeImports.js +29 -3
  56. package/cjs/{generator → shared}/index.js +3 -10
  57. package/cjs/{generator → shared}/known-codecs.js +24 -5
  58. package/cjs/typink/generator/ConstructorQueryGen.js +24 -0
  59. package/cjs/typink/generator/ConstructorTxGen.js +24 -0
  60. package/cjs/typink/generator/EventsGen.js +35 -0
  61. package/cjs/typink/generator/IndexGen.js +24 -0
  62. package/cjs/typink/generator/QueryGen.js +72 -0
  63. package/cjs/typink/generator/TxGen.js +25 -0
  64. package/cjs/typink/generator/TypesGen.js +28 -0
  65. package/cjs/typink/generator/index.js +23 -0
  66. package/cjs/typink/index.js +40 -0
  67. package/cjs/typink/templates/constructor-query.hbs +7 -0
  68. package/cjs/typink/templates/constructor-tx.hbs +7 -0
  69. package/cjs/typink/templates/events.hbs +8 -0
  70. package/cjs/typink/templates/index.hbs +16 -0
  71. package/cjs/typink/templates/query.hbs +7 -0
  72. package/cjs/typink/templates/tx.hbs +7 -0
  73. package/cjs/typink/templates/types.hbs +5 -0
  74. package/cjs/{generator/utils.js → utils.js} +34 -5
  75. package/index.d.ts +2 -4
  76. package/index.js +2 -48
  77. package/package.json +15 -18
  78. package/{generator/TypesGen.d.ts → shared/BaseTypesGen.d.ts} +13 -12
  79. package/{generator/TypesGen.js → shared/BaseTypesGen.js} +111 -166
  80. package/{generator → shared}/TypeImports.d.ts +12 -1
  81. package/{generator → shared}/TypeImports.js +29 -3
  82. package/shared/index.d.ts +3 -0
  83. package/shared/index.js +3 -0
  84. package/{generator → shared}/known-codecs.d.ts +1 -1
  85. package/{generator → shared}/known-codecs.js +22 -3
  86. package/typink/generator/ConstructorQueryGen.d.ts +6 -0
  87. package/typink/generator/ConstructorQueryGen.js +20 -0
  88. package/typink/generator/ConstructorTxGen.d.ts +6 -0
  89. package/typink/generator/ConstructorTxGen.js +20 -0
  90. package/typink/generator/EventsGen.d.ts +7 -0
  91. package/typink/generator/EventsGen.js +31 -0
  92. package/typink/generator/IndexGen.d.ts +6 -0
  93. package/typink/generator/IndexGen.js +20 -0
  94. package/typink/generator/QueryGen.d.ts +12 -0
  95. package/typink/generator/QueryGen.js +68 -0
  96. package/typink/generator/TxGen.d.ts +6 -0
  97. package/typink/generator/TxGen.js +21 -0
  98. package/typink/generator/TypesGen.d.ts +7 -0
  99. package/typink/generator/TypesGen.js +24 -0
  100. package/typink/generator/index.d.ts +7 -0
  101. package/typink/generator/index.js +7 -0
  102. package/typink/index.d.ts +2 -0
  103. package/typink/index.js +33 -0
  104. package/typink/templates/constructor-query.hbs +7 -0
  105. package/typink/templates/constructor-tx.hbs +7 -0
  106. package/typink/templates/events.hbs +8 -0
  107. package/typink/templates/index.hbs +16 -0
  108. package/typink/templates/query.hbs +7 -0
  109. package/typink/templates/tx.hbs +7 -0
  110. package/typink/templates/types.hbs +5 -0
  111. package/{generator/utils.d.ts → utils.d.ts} +6 -1
  112. package/{generator/utils.js → utils.js} +32 -4
  113. package/cjs/genSupportedChainTypes.js +0 -83
  114. package/cjs/generator/ErrorsGen.js +0 -41
  115. package/cjs/generator/IndexGen.js +0 -18
  116. package/cjs/generator/QueryGen.js +0 -59
  117. package/cjs/generator/RpcGen.js +0 -176
  118. package/cjs/generator/RuntimeApisGen.js +0 -119
  119. package/cjs/generator/known-types.js +0 -33
  120. package/cjs/packageInfo.js +0 -5
  121. package/cjs/templates/consts.hbs +0 -7
  122. package/cjs/templates/errors.hbs +0 -7
  123. package/cjs/templates/events.hbs +0 -7
  124. package/cjs/templates/index.hbs +0 -22
  125. package/cjs/templates/query.hbs +0 -7
  126. package/cjs/templates/rpc.hbs +0 -7
  127. package/cjs/templates/runtime.hbs +0 -8
  128. package/cjs/templates/tx.hbs +0 -9
  129. package/cjs/types.js +0 -2
  130. package/genSupportedChainTypes.d.ts +0 -1
  131. package/genSupportedChainTypes.js +0 -78
  132. package/generator/ConstsGen.d.ts +0 -4
  133. package/generator/ErrorsGen.d.ts +0 -5
  134. package/generator/EventsGen.d.ts +0 -5
  135. package/generator/IndexGen.d.ts +0 -6
  136. package/generator/IndexGen.js +0 -14
  137. package/generator/QueryGen.d.ts +0 -5
  138. package/generator/QueryGen.js +0 -55
  139. package/generator/RpcGen.d.ts +0 -10
  140. package/generator/RpcGen.js +0 -172
  141. package/generator/RuntimeApisGen.d.ts +0 -9
  142. package/generator/TxGen.d.ts +0 -5
  143. package/generator/index.d.ts +0 -10
  144. package/generator/index.js +0 -10
  145. package/generator/known-types.d.ts +0 -6
  146. package/generator/known-types.js +0 -30
  147. package/packageInfo.d.ts +0 -4
  148. package/packageInfo.js +0 -2
  149. package/templates/consts.hbs +0 -7
  150. package/templates/errors.hbs +0 -7
  151. package/templates/events.hbs +0 -7
  152. package/templates/index.hbs +0 -22
  153. package/templates/query.hbs +0 -7
  154. package/templates/rpc.hbs +0 -7
  155. package/templates/runtime.hbs +0 -8
  156. package/templates/tx.hbs +0 -9
  157. package/types.d.ts +0 -6
  158. package/types.js +0 -1
  159. /package/{generator → chaintypes/generator}/ApiGen.js +0 -0
  160. /package/cjs/{generator → chaintypes/generator}/ApiGen.js +0 -0
  161. /package/cjs/{generator/dirname.js → dirname.js} +0 -0
  162. /package/{generator/dirname.d.ts → dirname.d.ts} +0 -0
  163. /package/{generator/dirname.js → dirname.js} +0 -0
@@ -1,172 +0,0 @@
1
- import { findAliasRpcSpec, findRpcSpec, isUnsubscribeMethod } from '@dedot/specs';
2
- import { isNativeType } from '@dedot/utils';
3
- import { ApiGen } from '../generator';
4
- import { beautifySourceCode, commentBlock, compileTemplate, TUPLE_TYPE_REGEX, WRAPPER_TYPE_REGEX } from './utils';
5
- import { findKnownCodecType } from './known-codecs';
6
- const HIDDEN_RPCS = [
7
- // Ref: https://github.com/paritytech/polkadot-sdk/blob/43415ef58c143b985e09015cd000dbd65f6d3997/substrate/client/rpc-servers/src/lib.rs#L152C9-L158
8
- 'rpc_methods',
9
- ];
10
- export class RpcGen extends ApiGen {
11
- typesGen;
12
- rpcMethods;
13
- constructor(typesGen, rpcMethods) {
14
- super(typesGen);
15
- this.typesGen = typesGen;
16
- this.rpcMethods = rpcMethods;
17
- HIDDEN_RPCS.filter((one) => !rpcMethods.includes(one)).forEach((one) => rpcMethods.push(one));
18
- rpcMethods.sort();
19
- }
20
- generate() {
21
- this.typesGen.clearCache();
22
- this.typesGen.typeImports.addKnownType('GenericRpcCalls', 'Unsub', 'Callback', 'GenericRpcCall');
23
- const specsByModule = this.rpcMethods
24
- .filter((one) => !findAliasRpcSpec(one)) // we'll ignore alias rpc for now if defined in the specs! TODO should we generate alias rpc as well?
25
- .filter((one) => !isUnsubscribeMethod(one)) // we'll ignore unsubscribe method as well
26
- .map((one) => {
27
- const spec = findRpcSpec(one);
28
- if (spec) {
29
- return spec;
30
- }
31
- const [module, ...methodParts] = one.split('_');
32
- const method = methodParts.join('_');
33
- return {
34
- params: [],
35
- type: 'GenericRpcCall',
36
- module,
37
- method,
38
- };
39
- })
40
- .reduce((o, spec) => {
41
- const { module, method } = spec;
42
- // ignore if rpc name does not confront with the general convention
43
- if (!module || !method) {
44
- return o;
45
- }
46
- return {
47
- ...o,
48
- [module]: o[module] ? [...o[module], spec] : [spec],
49
- };
50
- }, {});
51
- let rpcCallsOut = '';
52
- Object.keys(specsByModule).forEach((module) => {
53
- const specs = specsByModule[module];
54
- // TODO add alias info to docs block!
55
- rpcCallsOut += `${module}: {
56
- ${specs.map((spec) => this.#generateMethodDef(spec)).join(',\n')},
57
-
58
- [method: string]: GenericRpcCall,
59
- },`;
60
- });
61
- // TODO include & define external types
62
- const importTypes = this.typesGen.typeImports.toImports();
63
- const template = compileTemplate('rpc.hbs');
64
- return beautifySourceCode(template({ importTypes, rpcCallsOut }));
65
- }
66
- #generateMethodDef(spec) {
67
- const { name, type, module, method, docs = [], params, pubsub, deprecated } = spec;
68
- const rpcName = name || `${module}_${method}`;
69
- let defaultDocs = [`@rpcname: ${rpcName}`];
70
- if (deprecated) {
71
- defaultDocs.push(`@deprecated: ${deprecated}`);
72
- }
73
- if (type === 'GenericRpcCall' && params.length === 0) {
74
- return `${commentBlock(defaultDocs)}${method}: GenericRpcCall`;
75
- }
76
- this.addTypeImport(type, false);
77
- params.forEach(({ type, isScale }) => {
78
- this.addTypeImport(type, !!isScale);
79
- });
80
- const typedParams = params.map((param) => ({
81
- ...param,
82
- plainType: this.getGeneratedTypeName(param.type, !!param.isScale),
83
- }));
84
- const isSubscription = !!pubsub;
85
- const paramsOut = typedParams.map(({ name, type, isOptional, isScale, plainType }) => `${name}${isOptional ? '?' : ''}: ${plainType}`);
86
- const paramsDoc = typedParams.map(({ name, plainType }) => `@param {${plainType}} ${name}`);
87
- const typeOut = this.getGeneratedTypeName(type, false);
88
- if (isSubscription) {
89
- defaultDocs.shift();
90
- defaultDocs.unshift(`@pubsub: ${pubsub?.join(', ')}`);
91
- paramsOut.push(`callback: Callback<${typeOut}>`);
92
- return `${commentBlock(docs, '\n', defaultDocs, paramsDoc)}${method}: GenericRpcCall<(${paramsOut.join(', ')}) => Promise<Unsub>>`;
93
- }
94
- else {
95
- return `${commentBlock(docs, '\n', defaultDocs, paramsDoc)}${method}: GenericRpcCall<(${paramsOut.join(', ')}) => Promise<${typeOut}>>`;
96
- }
97
- }
98
- // TODO check typeIn, typeOut if param type, or rpc type isScale
99
- addTypeImport(type, toTypeIn = true) {
100
- if (Array.isArray(type)) {
101
- type.forEach((one) => this.addTypeImport(one, toTypeIn));
102
- return;
103
- }
104
- type = type.trim();
105
- if (isNativeType(type)) {
106
- return;
107
- }
108
- // Handle generic wrapper types
109
- const matchArray = type.match(WRAPPER_TYPE_REGEX);
110
- if (matchArray) {
111
- const [_, $1, $2] = matchArray;
112
- this.addTypeImport($1, toTypeIn);
113
- if ($2.match(WRAPPER_TYPE_REGEX) || $2.match(TUPLE_TYPE_REGEX)) {
114
- this.addTypeImport($2, toTypeIn);
115
- }
116
- else {
117
- this.addTypeImport($2.split(','), toTypeIn);
118
- }
119
- return;
120
- }
121
- // Check tuple type
122
- if (type.match(TUPLE_TYPE_REGEX)) {
123
- this.addTypeImport(type.slice(1, -1).split(','), toTypeIn);
124
- return;
125
- }
126
- if (type.includes(' | ')) {
127
- this.addTypeImport(type.split(' | ').map((one) => one.trim()), toTypeIn);
128
- return;
129
- }
130
- try {
131
- const codecType = this.#getCodecType(type, toTypeIn);
132
- if (isNativeType(codecType))
133
- return;
134
- this.typesGen.typeImports.addCodecType(codecType);
135
- return;
136
- }
137
- catch (e) { }
138
- this.typesGen.addTypeImport(type);
139
- }
140
- getGeneratedTypeName(type, toTypeIn = true) {
141
- try {
142
- const matchArray = type.match(WRAPPER_TYPE_REGEX);
143
- if (matchArray) {
144
- const [_, $1, $2] = matchArray;
145
- const wrapperTypeName = this.#getCodecType($1, toTypeIn);
146
- if ($2.match(WRAPPER_TYPE_REGEX) || $2.match(TUPLE_TYPE_REGEX)) {
147
- return `${wrapperTypeName}<${this.getGeneratedTypeName($2, toTypeIn)}>`;
148
- }
149
- const innerTypeNames = $2
150
- .split(',')
151
- .map((one) => this.getGeneratedTypeName(one.trim(), toTypeIn))
152
- .join(', ');
153
- return `${wrapperTypeName}<${innerTypeNames}>`;
154
- }
155
- else if (type.match(TUPLE_TYPE_REGEX)) {
156
- const innerTypeNames = type
157
- .slice(1, -1)
158
- .split(',')
159
- .map((one) => this.getGeneratedTypeName(one.trim(), toTypeIn))
160
- .join(', ');
161
- return `[${innerTypeNames}]`;
162
- }
163
- return this.#getCodecType(type, toTypeIn);
164
- }
165
- catch (e) { }
166
- return type;
167
- }
168
- #getCodecType(type, toTypeIn = true) {
169
- const { typeIn, typeOut } = findKnownCodecType(type);
170
- return toTypeIn ? typeIn : typeOut;
171
- }
172
- }
@@ -1,9 +0,0 @@
1
- import { TypesGen } from './TypesGen';
2
- import { RpcGen } from './RpcGen';
3
- export declare class RuntimeApisGen extends RpcGen {
4
- #private;
5
- readonly typesGen: TypesGen;
6
- readonly runtimeApis: [string, number][];
7
- constructor(typesGen: TypesGen, runtimeApis: [string, number][]);
8
- generate(): Promise<string>;
9
- }
@@ -1,5 +0,0 @@
1
- import { ApiGen } from '../generator';
2
- export declare class TxGen extends ApiGen {
3
- #private;
4
- generate(): Promise<string>;
5
- }
@@ -1,10 +0,0 @@
1
- export * from './TypesGen';
2
- export * from './ApiGen';
3
- export * from './ConstsGen';
4
- export * from './QueryGen';
5
- export * from './RpcGen';
6
- export * from './IndexGen';
7
- export * from './ErrorsGen';
8
- export * from './EventsGen';
9
- export * from './TxGen';
10
- export * from './RuntimeApisGen';
@@ -1,10 +0,0 @@
1
- export * from './TypesGen';
2
- export * from './ApiGen';
3
- export * from './ConstsGen';
4
- export * from './QueryGen';
5
- export * from './RpcGen';
6
- export * from './IndexGen';
7
- export * from './ErrorsGen';
8
- export * from './EventsGen';
9
- export * from './TxGen';
10
- export * from './RuntimeApisGen';
@@ -1,6 +0,0 @@
1
- /**
2
- * Known type names registered in @dedot/types
3
- * Since TS interfaces are trim-off when compiling,
4
- * So we need to register them explicitly here for RPC codegen process
5
- */
6
- export declare const knownTypes: string[];
@@ -1,30 +0,0 @@
1
- /**
2
- * Known type names registered in @dedot/types
3
- * Since TS interfaces are trim-off when compiling,
4
- * So we need to register them explicitly here for RPC codegen process
5
- */
6
- export const knownTypes = [
7
- 'ExtrinsicOrHash',
8
- 'EpochAuthorship',
9
- 'BlockStats',
10
- 'Prevotes',
11
- 'Precommits',
12
- 'RoundState',
13
- 'ReportedRoundStates',
14
- 'JustificationNotification',
15
- 'EncodedFinalityProofs',
16
- 'LeavesProof',
17
- 'StorageKind',
18
- 'RpcMethods',
19
- 'ReadProof',
20
- 'StorageChangeSet',
21
- 'TraceBlockResponse',
22
- 'MigrationStatusResult',
23
- 'ChainType',
24
- 'ChainProperties',
25
- 'Health',
26
- 'SyncState',
27
- 'PeerInfo',
28
- 'NodeRole',
29
- 'NetworkState',
30
- ];
package/packageInfo.d.ts DELETED
@@ -1,4 +0,0 @@
1
- export declare const packageInfo: {
2
- name: string;
3
- version: string;
4
- };
package/packageInfo.js DELETED
@@ -1,2 +0,0 @@
1
- // THIS FILE IS AUTO-GENERATED, DO NOT EDIT!
2
- export const packageInfo = { name: '@dedot/codegen', version: '0.0.1-alpha.27' };
@@ -1,7 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface ChainConsts extends GenericChainConsts {
6
- {{{ defTypeOut }}}
7
- }
@@ -1,7 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface ChainErrors extends GenericChainErrors {
6
- {{{ defTypeOut }}}
7
- }
@@ -1,7 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface ChainEvents extends GenericChainEvents {
6
- {{{ defTypeOut }}}
7
- }
@@ -1,22 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- import { GenericSubstrateApi } from '@dedot/types';
4
- import { ChainConsts } from './consts';
5
- import { ChainStorage } from './query';
6
- import { RpcCalls } from './rpc';
7
- import { ChainErrors } from './errors';
8
- import { ChainEvents } from './events';
9
- import { RuntimeApis } from './runtime';
10
- import { ChainTx } from './tx';
11
-
12
- export * from './types';
13
-
14
- export interface {{{interfaceName}}}Api extends GenericSubstrateApi {
15
- rpc: RpcCalls;
16
- consts: ChainConsts;
17
- query: ChainStorage;
18
- errors: ChainErrors;
19
- events: ChainEvents;
20
- call: RuntimeApis;
21
- tx: ChainTx;
22
- }
@@ -1,7 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface ChainStorage extends GenericChainStorage {
6
- {{{ defTypeOut }}}
7
- }
package/templates/rpc.hbs DELETED
@@ -1,7 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface RpcCalls extends GenericRpcCalls {
6
- {{{rpcCallsOut}}}
7
- }
@@ -1,8 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- export interface RuntimeApis extends GenericRuntimeApis {
6
- {{{ runtimeCallsOut }}}
7
- }
8
-
package/templates/tx.hbs DELETED
@@ -1,9 +0,0 @@
1
- // Generated by @dedot/codegen
2
-
3
- {{{ importTypes }}}
4
-
5
- {{{ defTypes }}}
6
-
7
- export interface ChainTx extends GenericChainTx<TxCall> {
8
- {{{ txDefsOut }}}
9
- }
package/types.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export type NetworkInfo = {
2
- chain: string;
3
- endpoint?: string;
4
- metadataHex?: string;
5
- rpcMethods?: string[];
6
- };
package/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
File without changes
File without changes
File without changes
File without changes