@sentio/sdk 2.36.1 → 2.37.0-rc.2

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 (74) hide show
  1. package/lib/core/base-context.d.ts +4 -0
  2. package/lib/core/base-context.d.ts.map +1 -1
  3. package/lib/core/base-context.js +20 -4
  4. package/lib/core/base-context.js.map +1 -1
  5. package/lib/core/core-plugin.d.ts.map +1 -1
  6. package/lib/core/core-plugin.js +6 -0
  7. package/lib/core/core-plugin.js.map +1 -1
  8. package/lib/core/database-schema.d.ts +8 -0
  9. package/lib/core/database-schema.d.ts.map +1 -0
  10. package/lib/core/database-schema.js +10 -0
  11. package/lib/core/database-schema.js.map +1 -0
  12. package/lib/core/index.d.ts +1 -0
  13. package/lib/core/index.d.ts.map +1 -1
  14. package/lib/core/index.js +1 -0
  15. package/lib/core/index.js.map +1 -1
  16. package/lib/fuel/fuel-processor.d.ts.map +1 -1
  17. package/lib/fuel/fuel-processor.js +51 -23
  18. package/lib/fuel/fuel-processor.js.map +1 -1
  19. package/lib/store/codegen.d.ts +4 -0
  20. package/lib/store/codegen.d.ts.map +1 -0
  21. package/lib/store/codegen.js +180 -0
  22. package/lib/store/codegen.js.map +1 -0
  23. package/lib/store/context.d.ts +2 -0
  24. package/lib/store/context.d.ts.map +1 -0
  25. package/lib/store/context.js +2 -0
  26. package/lib/store/context.js.map +1 -0
  27. package/lib/store/decorators.d.ts +7 -0
  28. package/lib/store/decorators.d.ts.map +1 -0
  29. package/lib/store/decorators.js +7 -0
  30. package/lib/store/decorators.js.map +1 -0
  31. package/lib/store/entity.d.ts +18 -0
  32. package/lib/store/entity.d.ts.map +1 -0
  33. package/lib/store/entity.js +51 -0
  34. package/lib/store/entity.js.map +1 -0
  35. package/lib/store/index.d.ts +6 -0
  36. package/lib/store/index.d.ts.map +1 -0
  37. package/lib/store/index.js +6 -0
  38. package/lib/store/index.js.map +1 -0
  39. package/lib/store/run.d.ts +2 -0
  40. package/lib/store/run.d.ts.map +1 -0
  41. package/lib/store/run.js +11 -0
  42. package/lib/store/run.js.map +1 -0
  43. package/lib/store/schema.d.ts +7 -0
  44. package/lib/store/schema.d.ts.map +1 -0
  45. package/lib/store/schema.js +30 -0
  46. package/lib/store/schema.js.map +1 -0
  47. package/lib/store/store.d.ts +12 -0
  48. package/lib/store/store.d.ts.map +1 -0
  49. package/lib/store/store.js +61 -0
  50. package/lib/store/store.js.map +1 -0
  51. package/lib/store/types.d.ts +10 -0
  52. package/lib/store/types.d.ts.map +1 -0
  53. package/lib/store/types.js +2 -0
  54. package/lib/store/types.js.map +1 -0
  55. package/lib/testing/test-processor-server.d.ts +2 -5
  56. package/lib/testing/test-processor-server.d.ts.map +1 -1
  57. package/lib/testing/test-processor-server.js +2 -2
  58. package/lib/testing/test-processor-server.js.map +1 -1
  59. package/package.json +8 -5
  60. package/src/core/base-context.ts +22 -4
  61. package/src/core/core-plugin.ts +7 -0
  62. package/src/core/database-schema.ts +11 -0
  63. package/src/core/index.ts +1 -0
  64. package/src/fuel/fuel-processor.ts +64 -39
  65. package/src/store/codegen.ts +213 -0
  66. package/src/store/context.ts +1 -0
  67. package/src/store/decorators.ts +9 -0
  68. package/src/store/entity.ts +61 -0
  69. package/src/store/index.ts +5 -0
  70. package/src/store/run.ts +10 -0
  71. package/src/store/schema.ts +35 -0
  72. package/src/store/store.ts +68 -0
  73. package/src/store/types.ts +10 -0
  74. package/src/testing/test-processor-server.ts +13 -2
@@ -0,0 +1,51 @@
1
+ export class Entity {
2
+ get id() {
3
+ return this.get('id');
4
+ }
5
+ _store;
6
+ data = {};
7
+ constructor(data) {
8
+ Object.entries(data).forEach(([key, value]) => {
9
+ if (Array.isArray(value)) {
10
+ this.data[key] = value.map((v) => this.getIdFromEntity(v));
11
+ }
12
+ else {
13
+ this.data[key] = this.getIdFromEntity(value);
14
+ }
15
+ });
16
+ }
17
+ getIdFromEntity(entity) {
18
+ if (entity instanceof Entity) {
19
+ return entity.id;
20
+ }
21
+ else if (typeof entity === 'object' && entity.id) {
22
+ return entity.id;
23
+ }
24
+ return entity;
25
+ }
26
+ set store(store) {
27
+ this._store = store;
28
+ }
29
+ get(field) {
30
+ return this.data[field];
31
+ }
32
+ set(field, value) {
33
+ if (Array.isArray(value) && value instanceof Entity) {
34
+ this.data[field] = value.map((v) => v.id);
35
+ }
36
+ else if (value instanceof Entity) {
37
+ this.data[field] = value.id;
38
+ }
39
+ this.data[field] = value;
40
+ }
41
+ getFieldObject(entity, field) {
42
+ const id = this.data[field];
43
+ return id ? this._store?.get(entity, id) : Promise.resolve(undefined);
44
+ }
45
+ getFieldObjectArray(entity, field) {
46
+ const ids = this.data[field];
47
+ const promises = ids.map((id) => this._store?.get(entity, id));
48
+ return Promise.all(promises);
49
+ }
50
+ }
51
+ //# sourceMappingURL=entity.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity.js","sourceRoot":"","sources":["../../src/store/entity.ts"],"names":[],"mappings":"AAOA,MAAM,OAAgB,MAAM;IAC1B,IAAI,EAAE;QACJ,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAA;IACvB,CAAC;IAEO,MAAM,CAAmB;IACjC,IAAI,GAAwB,EAAE,CAAA;IAC9B,YAAsB,IAAyB;QAC7C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;YAC5C,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC,CAAA;YAC5D,CAAC;iBAAM,CAAC;gBACN,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAA;YAC9C,CAA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,CAAmB,MAAsB,EAAE,KAAa;QACnF,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;QAC5B,MAAM,QAAQ,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC,EAAU,EAAE,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,CAAA;QACtE,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAiB,CAAA;IAC9C,CAAC;CACF"}
@@ -0,0 +1,6 @@
1
+ export * from './decorators.js';
2
+ export * from './types.js';
3
+ export * from './entity.js';
4
+ export * from './store.js';
5
+ export * from './context.js';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,6 @@
1
+ export * from './decorators.js';
2
+ export * from './types.js';
3
+ export * from './entity.js';
4
+ export * from './store.js';
5
+ export * from './context.js';
6
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/store/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAA;AAC/B,cAAc,YAAY,CAAA;AAC1B,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,cAAc,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=run.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/store/run.ts"],"names":[],"mappings":""}
@@ -0,0 +1,11 @@
1
+ import { codegen } from './codegen.js';
2
+ if (process.argv.length > 3) {
3
+ const srcFile = process.argv[2];
4
+ const targetDir = process.argv[3];
5
+ await codegen(srcFile, targetDir);
6
+ }
7
+ else {
8
+ console.error('Not enough argument');
9
+ process.exit(1);
10
+ }
11
+ //# sourceMappingURL=run.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/store/run.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,IAAI,OAAO,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;IAC5B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjC,MAAM,OAAO,CAAC,OAAO,EAAE,SAAS,CAAC,CAAA;AACnC,CAAC;KAAM,CAAC;IACN,OAAO,CAAC,KAAK,CAAC,qBAAqB,CAAC,CAAA;IACpC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;AACjB,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { DocumentNode, GraphQLSchema } from 'graphql/index.js';
2
+ export declare function buildSchema(doc: DocumentNode): GraphQLSchema;
3
+ export declare function schemaFromFile(filePath: string): {
4
+ schema: GraphQLSchema;
5
+ source: string;
6
+ };
7
+ //# sourceMappingURL=schema.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/store/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,YAAY,EAAgB,aAAa,EAAyB,MAAM,kBAAkB,CAAA;AAqBnH,wBAAgB,WAAW,CAAC,GAAG,EAAE,YAAY,GAAG,aAAa,CAO5D;AAED,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM;;;EAI9C"}
@@ -0,0 +1,30 @@
1
+ import { buildASTSchema, extendSchema, parse, validateSchema } from 'graphql/index.js';
2
+ import * as fs from 'node:fs';
3
+ const customScalars = ['BigInt', 'BigDecimal', 'DateTime', 'JSON', 'Bytes', 'ID'];
4
+ const baseSchema = buildASTSchema(parse(`
5
+ directive @entity on OBJECT
6
+ directive @query on INTERFACE
7
+ directive @derivedFrom(field: String!) on FIELD_DEFINITION
8
+ directive @unique on FIELD_DEFINITION
9
+ directive @index(fields: [String!] unique: Boolean) repeatable on OBJECT | FIELD_DEFINITION
10
+ directive @fulltext(query: String!) on FIELD_DEFINITION
11
+ directive @cardinality(value: Int!) on OBJECT | FIELD_DEFINITION
12
+ directive @byteWeight(value: Float!) on FIELD_DEFINITION
13
+ directive @variant on OBJECT # legacy
14
+ directive @jsonField on OBJECT # legacy
15
+ ${customScalars.map((name) => 'scalar ' + name).join('\n')}
16
+ `));
17
+ export function buildSchema(doc) {
18
+ const schema = extendSchema(baseSchema, doc);
19
+ const errors = validateSchema(schema).filter((err) => !/query root/i.test(err.message));
20
+ if (errors.length > 0) {
21
+ throw errors[0];
22
+ }
23
+ return schema;
24
+ }
25
+ export function schemaFromFile(filePath) {
26
+ const source = fs.readFileSync(filePath, 'utf-8');
27
+ const doc = parse(source);
28
+ return { schema: buildSchema(doc), source };
29
+ }
30
+ //# sourceMappingURL=schema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/store/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAgB,YAAY,EAAiB,KAAK,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AACnH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAA;AAE7B,MAAM,aAAa,GAAG,CAAC,QAAQ,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,CAAC,CAAA;AAEjF,MAAM,UAAU,GAAG,cAAc,CAC/B,KAAK,CAAC;;;;;;;;;;;MAWF,aAAa,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;CAC7D,CAAC,CACD,CAAA;AAED,MAAM,UAAU,WAAW,CAAC,GAAiB;IAC3C,MAAM,MAAM,GAAG,YAAY,CAAC,UAAU,EAAE,GAAG,CAAC,CAAA;IAC5C,MAAM,MAAM,GAAG,cAAc,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAA;IACvF,IAAI,MAAM,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACtB,MAAM,MAAM,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;IACD,OAAO,MAAM,CAAA;AACf,CAAC;AAED,MAAM,UAAU,cAAc,CAAC,QAAgB;IAC7C,MAAM,MAAM,GAAG,EAAE,CAAC,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAA;IACjD,MAAM,GAAG,GAAG,KAAK,CAAC,MAAM,CAAC,CAAA;IACzB,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,CAAA;AAC7C,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Entity, EntityClass } from './entity.js';
2
+ import { StoreContext } from './context.js';
3
+ export declare class Store {
4
+ private readonly context;
5
+ constructor(context: StoreContext);
6
+ get<T extends Entity>(entity: EntityClass<T> | string, id: string): Promise<T | undefined>;
7
+ delete(entity: EntityClass<any>, id: string | string[]): Promise<void>;
8
+ upsert<T extends Entity>(entity: T | T[]): Promise<T>;
9
+ list<T extends Entity>(entity: EntityClass<T>, limit?: number, offset?: number): Promise<T[]>;
10
+ private newEntity;
11
+ }
12
+ //# sourceMappingURL=store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.d.ts","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,aAAa,CAAA;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAE3C,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,YAAY;IAE5C,GAAG,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,GAAG,SAAS,CAAC;IAe1F,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;IAStE,MAAM,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,EAAE,GAAG,OAAO,CAAC,CAAC,CAAC;IAiBrD,IAAI,CAAC,CAAC,SAAS,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,EAAE,CAAC;IAenG,OAAO,CAAC,SAAS;CAKlB"}
@@ -0,0 +1,61 @@
1
+ export class Store {
2
+ context;
3
+ constructor(context) {
4
+ this.context = context;
5
+ }
6
+ async get(entity, id) {
7
+ const promise = this.context.sendRequest({
8
+ get: {
9
+ entity: typeof entity == 'string' ? entity : entity.name,
10
+ id
11
+ }
12
+ });
13
+ const data = (await promise);
14
+ if (data?.['id'] != null) {
15
+ return this.newEntity(entity, data);
16
+ }
17
+ return undefined;
18
+ }
19
+ async delete(entity, id) {
20
+ await this.context.sendRequest({
21
+ delete: {
22
+ entity: entity.name,
23
+ id: Array.isArray(id) ? id : [id]
24
+ }
25
+ });
26
+ }
27
+ async upsert(entity) {
28
+ const promise = this.context.sendRequest({
29
+ upsert: {
30
+ entity: entity.constructor.name,
31
+ data: Array.isArray(entity) ? entity.map((e) => e.data) : [entity.data]
32
+ }
33
+ });
34
+ if (Array.isArray(entity)) {
35
+ entity.forEach((e) => (e.store = this));
36
+ }
37
+ else {
38
+ entity.store = this;
39
+ }
40
+ return promise;
41
+ }
42
+ async list(entity, limit, offset) {
43
+ const promise = this.context.sendRequest({
44
+ list: {
45
+ entity: entity.name,
46
+ limit,
47
+ offset
48
+ }
49
+ });
50
+ const list = (await promise);
51
+ return list.map((data) => {
52
+ return this.newEntity(entity, data);
53
+ });
54
+ }
55
+ newEntity(entity, data) {
56
+ const e = new entity(data);
57
+ e.store = this;
58
+ return e;
59
+ }
60
+ }
61
+ //# sourceMappingURL=store.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store.js","sourceRoot":"","sources":["../../src/store/store.ts"],"names":[],"mappings":"AAGA,MAAM,OAAO,KAAK;IACa;IAA7B,YAA6B,OAAqB;QAArB,YAAO,GAAP,OAAO,CAAc;IAAG,CAAC;IAEtD,KAAK,CAAC,GAAG,CAAmB,MAA+B,EAAE,EAAU;QACrE,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YACvC,GAAG,EAAE;gBACH,MAAM,EAAE,OAAO,MAAM,IAAI,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI;gBACxD,EAAE;aACH;SACF,CAAC,CAAA;QAEF,MAAM,IAAI,GAAG,CAAC,MAAM,OAAO,CAAQ,CAAA;QACnC,IAAI,IAAI,EAAE,CAAC,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACzB,OAAO,IAAI,CAAC,SAAS,CAAC,MAAwB,EAAE,IAAI,CAAC,CAAA;QACvD,CAAC;QACD,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAwB,EAAE,EAAqB;QAC1D,MAAM,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC;YAC7B,MAAM,EAAE;gBACN,MAAM,EAAE,MAAM,CAAC,IAAI;gBACnB,EAAE,EAAE,KAA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;IACJ,CAAC;IAEO,SAAS,CAAmB,MAAsB,EAAE,IAAS;QACnE,MAAM,CAAC,GAAG,IAAK,MAAyB,CAAC,IAAI,CAAC,CAAA;QAC9C,CAAC,CAAC,KAAK,GAAG,IAAI,CAAA;QACd,OAAO,CAAC,CAAA;IACV,CAAC;CACF"}
@@ -0,0 +1,10 @@
1
+ export type { BigDecimal } from '@sentio/bigdecimal';
2
+ export type ID = string;
3
+ export type String = string;
4
+ export type Int = number;
5
+ export type Float = number;
6
+ export type Boolean = boolean;
7
+ export type DateTime = Date;
8
+ export type Json = any;
9
+ export type Bytes = Uint8Array;
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AAEpD,MAAM,MAAM,EAAE,GAAG,MAAM,CAAA;AACvB,MAAM,MAAM,MAAM,GAAG,MAAM,CAAA;AAC3B,MAAM,MAAM,GAAG,GAAG,MAAM,CAAA;AACxB,MAAM,MAAM,KAAK,GAAG,MAAM,CAAA;AAC1B,MAAM,MAAM,OAAO,GAAG,OAAO,CAAA;AAC7B,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAA;AAC3B,MAAM,MAAM,IAAI,GAAG,GAAG,CAAA;AACtB,MAAM,MAAM,KAAK,GAAG,UAAU,CAAA"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/store/types.ts"],"names":[],"mappings":""}
@@ -1,4 +1,4 @@
1
- import { AccountConfig, ContractConfig, DataBinding, Empty, ProcessBindingResponse, ProcessBindingsRequest, ProcessConfigRequest, ProcessConfigResponse, ProcessorServiceImplementation, StartRequest } from '@sentio/protos';
1
+ import { AccountConfig, ContractConfig, DataBinding, DeepPartial, Empty, ProcessBindingResponse, ProcessBindingsRequest, ProcessConfigRequest, ProcessConfigResponse, ProcessorServiceImplementation, ProcessStreamRequest, ProcessStreamResponse, ServerStreamingMethodResult, StartRequest } from '@sentio/protos';
2
2
  import { CallContext } from 'nice-grpc-common';
3
3
  import { ProcessorServiceImpl } from '@sentio/runtime';
4
4
  import { AptosFacet } from './aptos-facet.js';
@@ -23,9 +23,6 @@ export declare class TestProcessorServer implements ProcessorServiceImplementati
23
23
  getConfig(request: ProcessConfigRequest, context?: CallContext): Promise<ProcessConfigResponse>;
24
24
  processBindings(request: ProcessBindingsRequest, context?: CallContext): Promise<ProcessBindingResponse>;
25
25
  processBinding(request: DataBinding, context?: CallContext): Promise<ProcessBindingResponse>;
26
- processBindingsStream(request: AsyncIterable<DataBinding>, context: CallContext): AsyncGenerator<{
27
- result: import("@sentio/protos").ProcessResult;
28
- configUpdated: boolean;
29
- }, void, unknown>;
26
+ processBindingsStream(requests: AsyncIterable<ProcessStreamRequest>, context: CallContext): ServerStreamingMethodResult<DeepPartial<ProcessStreamResponse>>;
30
27
  }
31
28
  //# sourceMappingURL=test-processor-server.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-processor-server.d.ts","sourceRoot":"","sources":["../../src/testing/test-processor-server.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,aAAa,EACb,cAAc,EACd,WAAW,EACX,KAAK,EACL,sBAAsB,EACtB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,EACrB,8BAA8B,EAC9B,YAAY,EACb,MAAM,gBAAgB,CAAA;AACvB,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAa,oBAAoB,EAAS,MAAM,iBAAiB,CAAA;AAGxE,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,Q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GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIhG,eAAe,CACb,OAAO,EAAE,sBAAsB,EAC/B,OAAO,GAAE,WAA0B,GAClC,OAAO,CAAC,sBAAsB,CAAC;IAIlC,cAAc,CAAC,OAAO,EAAE,WAAW,EAAE,OAAO,GAAE,WAA0B,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI1G,qBAAqB,CACnB,QAAQ,EAAE,aAAa,CAAC,oBAAoB,CAAC,EAC7C,OAAO,EAAE,WAAW,GACnB,2BAA2B,CAAC,WAAW,CAAC,qBAAqB,CAAC,CAAC;CAOnE"}
@@ -50,8 +50,8 @@ export class TestProcessorServer {
50
50
  processBinding(request, context = TEST_CONTEXT) {
51
51
  return this.service.processBindings({ bindings: [request] }, context);
52
52
  }
53
- processBindingsStream(request, context) {
54
- return this.service.processBindingsStream(request, context);
53
+ processBindingsStream(requests, context) {
54
+ throw new Error('Method not implemented.');
55
55
  }
56
56
  }
57
57
  //# sourceMappingURL=test-processor-server.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"test-processor-server.js","sourceRoot":"","sources":["../../src/testing/test-processor-server.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAA;AACxE,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAA;AAEzC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAA;AAE3C,MAAM,CAAC,MAAM,YAAY,GAA6B,EAAE,CAAA;AAExD,MAAM,UAAU,SAAS;IACvB,KAAK,CAAC,KAAK,EAAE,CAAA;AACf,CAAC;AAED,MAAM,O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AAC,CAAA;QACvC,IAAI,CAAC,eAAe,GAAG,MAAM,CAAC,eAAe,CAAA;QAC7C,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,cAAc,CAAA;QAC3C,OAAO,GAAG,CAAA;IACZ,CAAC;IAED,IAAI,CAAC,OAAc,EAAE,OAAO,GAAG,YAAY;QACzC,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IAC5C,CAAC;IAED,SAAS,CAAC,OAA6B,EAAE,OAAO,GAAG,YAAY;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACjD,CAAC;IAED,eAAe,CACb,OAA+B,EAC/B,UAAuB,YAAY;QAEnC,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;IACvD,CAAC;IAED,cAAc,CAAC,OAAoB,EAAE,UAAuB,YAAY;QACtE,OAAO,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,EAAE,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,EAAE,OAAO,CAAC,CAAA;IACvE,CAAC;IAED,qBAAqB,CACnB,QAA6C,EAC7C,OAAoB;QAEpB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAA;IAC5C,CAAC;CAKF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sentio/sdk",
3
- "version": "2.36.1",
3
+ "version": "2.37.0-rc.2",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "exports": {
@@ -35,7 +35,9 @@
35
35
  "./sui/builtin/0x2": "./lib/sui/builtin/0x2.js",
36
36
  "./sui/builtin/0x3": "./lib/sui/builtin/0x3.js",
37
37
  "./fuel": "./lib/fuel/index.js",
38
- "./fuel/codegen": "./lib/fuel/codegen/index.js"
38
+ "./fuel/codegen": "./lib/fuel/codegen/index.js",
39
+ "./store": "./lib/store/index.js",
40
+ "./store/codegen": "./lib/store/codegen.js"
39
41
  },
40
42
  "files": [
41
43
  "{lib,src}",
@@ -77,8 +79,8 @@
77
79
  "typedoc": "^0.25.7",
78
80
  "utility-types": "^3.11.0",
79
81
  "yaml": "^2.3.4",
80
- "@sentio/runtime": "^2.36.1",
81
- "@sentio/protos": "2.36.1"
82
+ "@sentio/protos": "2.37.0-rc.2",
83
+ "@sentio/runtime": "^2.37.0-rc.2"
82
84
  },
83
85
  "peerDependencies": {
84
86
  "tsup": "npm:@sentio/tsup@^6.7.2"
@@ -97,7 +99,7 @@
97
99
  "build": "pnpm gen && pnpm compile",
98
100
  "build:all": "pnpm --filter=$(node -p \"require('./package.json').name\")... build",
99
101
  "compile": "tsc && cp src/utils/*.csv lib/utils && cp src/tsup.config.ts lib",
100
- "gen": "pnpm gen:eth && pnpm gen:aptos && pnpm gen:sui && pnpm gen:solana && pnpm gen:fuel",
102
+ "gen": "pnpm gen:eth && pnpm gen:aptos && pnpm gen:sui && pnpm gen:solana && pnpm gen:fuel && pnpm gen:store",
101
103
  "gen:aptos": "tsx src/aptos/codegen/run.ts src/aptos/abis src/aptos/builtin && pnpm gen:aptos_test",
102
104
  "gen:aptos_test": "tsx src/aptos/codegen/run.ts src/aptos/tests/abis src/aptos/tests/types",
103
105
  "gen:docs": "typedoc --options typedoc.json",
@@ -106,6 +108,7 @@
106
108
  "gen:fuel": "tsx src/fuel/codegen/run.ts src/fuel/abis src/sui/builtin && pnpm gen:fuel_test",
107
109
  "gen:fuel_test": "tsx src/fuel/codegen/run.ts src/fuel/tests/abis src/fuel/tests/types",
108
110
  "gen:solana": "tsx src/solana/codegen/run.ts src/solana/tests/abis src/solana/tests/types",
111
+ "gen:store": "tsx src/store/run.ts src/store/tests src/store/tests/generated",
109
112
  "gen:sui": "tsx src/sui/codegen/run.ts src/sui/abis src/sui/builtin && pnpm gen:sui_test",
110
113
  "gen:sui_test": "tsx src/sui/codegen/run.ts src/sui/tests/abis src/sui/tests/types",
111
114
  "test": "NODE_OPTIONS=--experimental-vm-modules pnpm jest --runInBand --detectOpenHandles"
@@ -2,13 +2,15 @@ import { ProcessResult, RecordMetaData } from '@sentio/protos'
2
2
  import { EventLoggerBinding } from './event-logger.js'
3
3
  import { Meter, Labels } from './meter.js'
4
4
  import { ChainId } from '@sentio/chain'
5
- import { mergeProcessResults } from '@sentio/runtime'
5
+ import { mergeProcessResults, PluginManager } from '@sentio/runtime'
6
6
  import { Required } from 'utility-types'
7
7
  import { ServerError, Status } from 'nice-grpc'
8
+ import { Store } from '../store/store.js'
8
9
 
9
10
  export abstract class BaseContext {
10
11
  meter: Meter
11
12
  eventLogger: EventLoggerBinding
13
+ private _store: Store
12
14
  protected baseLabels: Labels
13
15
  private active: boolean
14
16
 
@@ -18,8 +20,8 @@ export abstract class BaseContext {
18
20
  exports: [],
19
21
  gauges: [],
20
22
  states: {
21
- configUpdated: false,
22
- },
23
+ configUpdated: false
24
+ }
23
25
  }
24
26
 
25
27
  public update(res: Partial<ProcessResult>) {
@@ -35,6 +37,7 @@ export abstract class BaseContext {
35
37
  this.eventLogger = new EventLoggerBinding(this)
36
38
  this.baseLabels = baseLabels || {}
37
39
  this.active = true
40
+ this.initStore()
38
41
  }
39
42
 
40
43
  stopAndGetResult(): ProcessResult {
@@ -49,11 +52,26 @@ export abstract class BaseContext {
49
52
  getMetaData(name: string, labels: Labels): RecordMetaData {
50
53
  return {
51
54
  ...this.baseLabels,
52
- ...this.getMetaDataInternal(name, labels),
55
+ ...this.getMetaDataInternal(name, labels)
53
56
  }
54
57
  }
55
58
 
56
59
  protected abstract getMetaDataInternal(name: string, labels: Labels): RecordMetaData
57
60
 
58
61
  abstract getChainId(): ChainId
62
+
63
+ get store() {
64
+ if (this._store == null) {
65
+ console.warn('Store is not set, please initialize the processor with your database schema first.')
66
+ }
67
+ return this._store
68
+ }
69
+
70
+ // this method must be called within the dbContextLocalStorage scope
71
+ initStore() {
72
+ const dbContext = PluginManager.INSTANCE.dbContextLocalStorage.getStore()
73
+ if (dbContext) {
74
+ this._store = new Store(dbContext)
75
+ }
76
+ }
59
77
  }
@@ -6,6 +6,7 @@ import { ExporterState } from './exporter.js'
6
6
  import { EventTrackerState } from './event-tracker.js'
7
7
  import { TemplateInstanceState } from './template.js'
8
8
  import { EventLoggerState } from './event-logger.js'
9
+ import { DatabaseSchemaState } from './database-schema.js'
9
10
 
10
11
  export class CorePlugin extends Plugin {
11
12
  name: string = 'CorePlugin'
@@ -44,6 +45,12 @@ export class CorePlugin extends Plugin {
44
45
  channel: exporter.channel
45
46
  })
46
47
  }
48
+
49
+ if (DatabaseSchemaState.INSTANCE.getValues().length > 0) {
50
+ config.dbSchema = {
51
+ gqlSchema: DatabaseSchemaState.INSTANCE.getValues().join('\n\n')
52
+ }
53
+ }
47
54
  }
48
55
  }
49
56
 
@@ -0,0 +1,11 @@
1
+ import { ListStateStorage } from '@sentio/runtime'
2
+
3
+ export class DatabaseSchemaState extends ListStateStorage<string> {
4
+ static INSTANCE = new DatabaseSchemaState()
5
+ }
6
+
7
+ export class DatabaseSchema {
8
+ static register(schema: string) {
9
+ DatabaseSchemaState.INSTANCE.addValue(schema)
10
+ }
11
+ }
package/src/core/index.ts CHANGED
@@ -10,3 +10,4 @@ export * from './event-logger.js'
10
10
  export { type Numberish, toBigInteger, toMetricValue } from './numberish.js'
11
11
 
12
12
  export { CorePlugin } from './core-plugin.js'
13
+ export { DatabaseSchema } from './database-schema.js'
@@ -89,30 +89,42 @@ export class FuelProcessor implements FuelBaseProcessor<FuelProcessorConfig> {
89
89
 
90
90
  const callHandler = {
91
91
  handler: async (call: Data_FuelCall) => {
92
- const contract = new Contract(this.config.address, abi, this.provider)
93
- const gqlTransaction = call.transaction
94
- const tx = decodeFuelTransactionWithAbi(gqlTransaction, { [this.config.address]: abi }, this.provider)
92
+ try {
93
+ const contract = new Contract(this.config.address, abi, this.provider)
94
+ const gqlTransaction = call.transaction
95
+ const tx = decodeFuelTransactionWithAbi(gqlTransaction, { [this.config.address]: abi }, this.provider)
95
96
 
96
- const ctx = new FuelContext(
97
- this.config.chainId,
98
- this.config.address,
99
- this.config.name ?? this.config.address,
100
- tx
101
- )
102
- for (const op of tx.operations) {
103
- for (const call of op.calls || []) {
104
- if (names.has(call.functionName)) {
105
- const fn = contract.functions[call.functionName]
106
- const args = Object.values(call.argumentsProvided || {})
107
- const scope = fn(...args)
108
- const invocationResult = new FuelCall(scope, tx, false, call.argumentsProvided, tx.logs)
109
-
110
- await handler(invocationResult, ctx)
97
+ const ctx = new FuelContext(
98
+ this.config.chainId,
99
+ this.config.address,
100
+ this.config.name ?? this.config.address,
101
+ tx
102
+ )
103
+ for (const op of tx.operations) {
104
+ for (const call of op.calls || []) {
105
+ if (names.has(call.functionName)) {
106
+ const fn = contract.functions[call.functionName]
107
+ const args = Object.values(call.argumentsProvided || {})
108
+ const scope = fn(...args)
109
+ const invocationResult = new FuelCall(scope, tx, false, call.argumentsProvided, tx.logs)
110
+ await handler(invocationResult, ctx)
111
+ }
111
112
  }
112
113
  }
113
- }
114
114
 
115
- return ctx.stopAndGetResult()
115
+ return ctx.stopAndGetResult()
116
+ } catch (e) {
117
+ console.error(e)
118
+ return {
119
+ gauges: [],
120
+ counters: [],
121
+ events: [],
122
+ exports: [],
123
+ states: {
124
+ configUpdated: false
125
+ }
126
+ }
127
+ }
116
128
  },
117
129
  fetchConfig: {
118
130
  filters: Object.values(filters)
@@ -130,27 +142,40 @@ export class FuelProcessor implements FuelBaseProcessor<FuelProcessorConfig> {
130
142
 
131
143
  const callHandler = {
132
144
  handler: async (call: Data_FuelCall) => {
133
- const gqlTransaction = call.transaction
134
- const tx = decodeFuelTransactionWithAbi(
135
- gqlTransaction,
136
- { [this.config.address]: this.config.abi! },
137
- this.provider
138
- )
139
-
140
- const results: ProcessResult[] = []
141
- const logs = (tx.logs || []).filter((log) => logIds.has(log.logId))
142
- for (const log of logs) {
143
- const ctx = new FuelContext(
144
- this.config.chainId,
145
- this.config.address,
146
- this.config.name ?? this.config.address,
147
- tx
145
+ try {
146
+ const gqlTransaction = call.transaction
147
+ const tx = decodeFuelTransactionWithAbi(
148
+ gqlTransaction,
149
+ { [this.config.address]: this.config.abi! },
150
+ this.provider
148
151
  )
149
- ctx.setLogIndex(log.receiptIndex)
150
- await handler(log, ctx)
151
- results.push(ctx.stopAndGetResult())
152
+
153
+ const results: ProcessResult[] = []
154
+ const logs = (tx.logs || []).filter((log) => logIds.has(log.logId))
155
+ for (const log of logs) {
156
+ const ctx = new FuelContext(
157
+ this.config.chainId,
158
+ this.config.address,
159
+ this.config.name ?? this.config.address,
160
+ tx
161
+ )
162
+ ctx.setLogIndex(log.receiptIndex)
163
+ await handler(log, ctx)
164
+ results.push(ctx.stopAndGetResult())
165
+ }
166
+ return mergeProcessResults(results)
167
+ } catch (e) {
168
+ console.error(e)
169
+ return {
170
+ gauges: [],
171
+ counters: [],
172
+ events: [],
173
+ exports: [],
174
+ states: {
175
+ configUpdated: false
176
+ }
177
+ }
152
178
  }
153
- return mergeProcessResults(results)
154
179
  },
155
180
  logConfig: {
156
181
  logIds: Array.from(logIds)