@things-factory/shell 9.0.0-beta.8 → 9.0.5

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 (91) hide show
  1. package/_index.html +0 -1
  2. package/client/themes/app-theme.css +4 -0
  3. package/config/config.development.js +1 -1
  4. package/config/config.production.js +1 -14
  5. package/dist-server/graphql-local-client.js +4 -1
  6. package/dist-server/graphql-local-client.js.map +1 -1
  7. package/dist-server/initializers/database.js +8 -2
  8. package/dist-server/initializers/database.js.map +1 -1
  9. package/dist-server/middlewares/domain-middleware.js +3 -3
  10. package/dist-server/middlewares/domain-middleware.js.map +1 -1
  11. package/dist-server/middlewares/index.js +2 -2
  12. package/dist-server/middlewares/index.js.map +1 -1
  13. package/dist-server/migrations/1000000000000-SeedDomain.js +3 -1
  14. package/dist-server/migrations/1000000000000-SeedDomain.js.map +1 -1
  15. package/dist-server/pubsub-log-transport.js +4 -1
  16. package/dist-server/pubsub-log-transport.js.map +1 -1
  17. package/dist-server/pubsub.js +7 -3
  18. package/dist-server/pubsub.js.map +1 -1
  19. package/dist-server/schema.js +24 -5
  20. package/dist-server/schema.js.map +1 -1
  21. package/dist-server/server-dev.js +5 -3
  22. package/dist-server/server-dev.js.map +1 -1
  23. package/dist-server/server.js +6 -4
  24. package/dist-server/server.js.map +1 -1
  25. package/dist-server/service/attribute-set/attribute-set-item-type.d.ts +2 -2
  26. package/dist-server/service/attribute-set/attribute-set-item-type.js +37 -23
  27. package/dist-server/service/attribute-set/attribute-set-item-type.js.map +1 -1
  28. package/dist-server/service/attribute-set/attribute-set-mutation.js +43 -19
  29. package/dist-server/service/attribute-set/attribute-set-mutation.js.map +1 -1
  30. package/dist-server/service/attribute-set/attribute-set-query.js +13 -5
  31. package/dist-server/service/attribute-set/attribute-set-query.js.map +1 -1
  32. package/dist-server/service/attribute-set/attribute-set-type.js +22 -14
  33. package/dist-server/service/attribute-set/attribute-set-type.js.map +1 -1
  34. package/dist-server/service/attribute-set/attribute-set.js +12 -7
  35. package/dist-server/service/attribute-set/attribute-set.js.map +1 -1
  36. package/dist-server/service/common-types/index.js +2 -0
  37. package/dist-server/service/common-types/index.js.map +1 -1
  38. package/dist-server/service/common-types/list-param.js +17 -16
  39. package/dist-server/service/common-types/list-param.js.map +1 -1
  40. package/dist-server/service/common-types/log.js +5 -5
  41. package/dist-server/service/common-types/log.js.map +1 -1
  42. package/dist-server/service/common-types/object-ref.js +6 -4
  43. package/dist-server/service/common-types/object-ref.js.map +1 -1
  44. package/dist-server/service/common-types/scalar-any.js +1 -1
  45. package/dist-server/service/common-types/scalar-any.js.map +1 -1
  46. package/dist-server/service/common-types/scalar-date.js +1 -1
  47. package/dist-server/service/common-types/scalar-date.js.map +1 -1
  48. package/dist-server/service/common-types/scalar-object.js +1 -1
  49. package/dist-server/service/common-types/scalar-object.js.map +1 -1
  50. package/dist-server/service/directive-transaction/transaction.js +5 -3
  51. package/dist-server/service/directive-transaction/transaction.js.map +1 -1
  52. package/dist-server/service/domain/domain-mutation.js +22 -9
  53. package/dist-server/service/domain/domain-mutation.js.map +1 -1
  54. package/dist-server/service/domain/domain-query.d.ts +1 -0
  55. package/dist-server/service/domain/domain-query.js +25 -4
  56. package/dist-server/service/domain/domain-query.js.map +1 -1
  57. package/dist-server/service/domain/domain-types.d.ts +2 -0
  58. package/dist-server/service/domain/domain-types.js +36 -17
  59. package/dist-server/service/domain/domain-types.js.map +1 -1
  60. package/dist-server/service/domain/domain.js +29 -55
  61. package/dist-server/service/domain/domain.js.map +1 -1
  62. package/dist-server/service/subscription-data/data-resolver.js +5 -5
  63. package/dist-server/service/subscription-data/data-resolver.js.map +1 -1
  64. package/dist-server/service/subscription-data/data-types.js +9 -4
  65. package/dist-server/service/subscription-data/data-types.js.map +1 -1
  66. package/dist-server/service/subscription-data/index.js +3 -0
  67. package/dist-server/service/subscription-data/index.js.map +1 -1
  68. package/dist-server/tsconfig.tsbuildinfo +1 -1
  69. package/dist-server/utils/get-domain.d.ts +9 -10
  70. package/dist-server/utils/get-domain.js +65 -72
  71. package/dist-server/utils/get-domain.js.map +1 -1
  72. package/dist-server/utils/get-query-builder-from-list-params.js +4 -5
  73. package/dist-server/utils/get-query-builder-from-list-params.js.map +1 -1
  74. package/dist-server/utils/get-times-for-period.d.ts +24 -4
  75. package/dist-server/utils/get-times-for-period.js +42 -5
  76. package/dist-server/utils/get-times-for-period.js.map +1 -1
  77. package/dist-server/utils/list-params-converter.js +9 -6
  78. package/dist-server/utils/list-params-converter.js.map +1 -1
  79. package/dist-server/utils/list-query-builder.js +8 -9
  80. package/dist-server/utils/list-query-builder.js.map +1 -1
  81. package/package.json +14 -16
  82. package/translations/en.json +2 -0
  83. package/translations/ja.json +2 -0
  84. package/translations/ko.json +3 -1
  85. package/translations/ms.json +2 -0
  86. package/translations/zh.json +2 -0
  87. package/views/public/home.html +0 -1
  88. package/client/scene/scene-components.js +0 -3
  89. package/client/scene/scene-player.js +0 -103
  90. package/client/scene/scene-viewer.js +0 -106
  91. package/client/scene/things-scene-components.import +0 -1
@@ -14,32 +14,35 @@ let AttributeSet = class AttributeSet {
14
14
  exports.AttributeSet = AttributeSet;
15
15
  tslib_1.__decorate([
16
16
  (0, typeorm_1.PrimaryGeneratedColumn)('uuid'),
17
- (0, type_graphql_1.Field)(type => type_graphql_1.ID),
17
+ (0, type_graphql_1.Field)(type => type_graphql_1.ID, { description: 'The unique identifier of the AttributeSet.' }),
18
18
  tslib_1.__metadata("design:type", String)
19
19
  ], AttributeSet.prototype, "id", void 0);
20
20
  tslib_1.__decorate([
21
21
  (0, typeorm_1.Column)({ nullable: true, default: '' }),
22
- (0, type_graphql_1.Field)({ nullable: true }),
22
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The name of the entity this AttributeSet is associated with.' }),
23
23
  tslib_1.__metadata("design:type", String)
24
24
  ], AttributeSet.prototype, "entity", void 0);
25
25
  tslib_1.__decorate([
26
26
  (0, typeorm_1.Column)({ nullable: true, default: '' }),
27
- (0, type_graphql_1.Field)({ nullable: true }),
27
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A description of the AttributeSet.' }),
28
28
  tslib_1.__metadata("design:type", String)
29
29
  ], AttributeSet.prototype, "description", void 0);
30
30
  tslib_1.__decorate([
31
31
  (0, typeorm_1.Column)('simple-json', { nullable: true }),
32
- (0, type_graphql_1.Field)(type => [attribute_set_item_type_js_1.AttributeSetItem], { nullable: true }),
32
+ (0, type_graphql_1.Field)(type => [attribute_set_item_type_js_1.AttributeSetItem], {
33
+ nullable: true,
34
+ description: 'A list of items (attributes) included in this AttributeSet.'
35
+ }),
33
36
  tslib_1.__metadata("design:type", Array)
34
37
  ], AttributeSet.prototype, "items", void 0);
35
38
  tslib_1.__decorate([
36
39
  (0, typeorm_1.CreateDateColumn)(),
37
- (0, type_graphql_1.Field)({ nullable: true }),
40
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when this AttributeSet was created.' }),
38
41
  tslib_1.__metadata("design:type", Date)
39
42
  ], AttributeSet.prototype, "createdAt", void 0);
40
43
  tslib_1.__decorate([
41
44
  (0, typeorm_1.UpdateDateColumn)(),
42
- (0, type_graphql_1.Field)({ nullable: true }),
45
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The date and time when this AttributeSet was last updated.' }),
43
46
  tslib_1.__metadata("design:type", Date)
44
47
  ], AttributeSet.prototype, "updatedAt", void 0);
45
48
  exports.AttributeSet = AttributeSet = tslib_1.__decorate([
@@ -47,6 +50,8 @@ exports.AttributeSet = AttributeSet = tslib_1.__decorate([
47
50
  (0, typeorm_1.Index)('ix_attribute_set_0', (attributeSet) => [attributeSet.entity], {
48
51
  unique: true
49
52
  }),
50
- (0, type_graphql_1.ObjectType)({ description: 'Entity for AttributeSet' })
53
+ (0, type_graphql_1.ObjectType)({
54
+ description: 'Represents an AttributeSet entity, which defines a set of attributes for a specific entity type.'
55
+ })
51
56
  ], AttributeSet);
52
57
  //# sourceMappingURL=attribute-set.js.map
@@ -1 +1 @@
1
- {"version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A0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QAClF,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,yBAAyB,EAAE,CAAC;GAC1C,YAAY,CAwBxB","sourcesContent":["import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { AttributeSetItem } from './attribute-set-item-type.js'\n\n@Entity()\n@Index('ix_attribute_set_0', (attributeSet: AttributeSet) => [attributeSet.entity], {\n unique: true\n})\n@ObjectType({ description: 'Entity for AttributeSet' })\nexport class AttributeSet {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id: string\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n entity: string = ''\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true })\n description: string = ''\n\n @Column('simple-json', { nullable: true })\n @Field(type => [AttributeSetItem], { nullable: true })\n items: AttributeSetItem[]\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n}\n"]}
1
+ {"version":3,"file":"attribute-set.js","sourceRoot":"","sources":["../../../server/service/attribute-set/attribute-set.ts"],"names":[],"mappings":";;;;AAAA,qCAA2G;AAC3G,+CAAoD;AAEpD,6EAA+D;AASxD,IAAM,YAAY,GAAlB,MAAM,YAAY;IAAlB;QAOL,WAAM,GAAW,EAAE,CAAA;QAInB,gBAAW,GAAW,EAAE,CAAA;IAgB1B,CAAC;CAAA,CAAA;AA3BY,oCAAY;AAGd;IAFR,IAAA,gCAAsB,EAAC,MAAM,CAAC;IAC9B,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,4CAA4C,EAAE,CAAC;;wCAC9D;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,8DAA8D,EAAE,CAAC;;4CACpF;AAInB;IAFC,IAAA,gBAAM,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACvC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;iDACrD;AAOxB;IALC,IAAA,gBAAM,EAAC,aAAa,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IACzC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,6CAAgB,CAAC,EAAE;QACjC,QAAQ,EAAE,IAAI;QACd,WAAW,EAAE,6DAA6D;KAC3E,CAAC;;2CACuB;AAIzB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,uDAAuD,EAAE,CAAC;sCACpF,IAAI;+CAAA;AAIhB;IAFC,IAAA,0BAAgB,GAAE;IAClB,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,4DAA4D,EAAE,CAAC;sCACzF,IAAI;+CAAA;uBA1BL,YAAY;IAPxB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,oBAAoB,EAAE,CAAC,YAA0B,EAAE,EAAE,CAAC,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE;QAClF,MAAM,EAAE,IAAI;KACb,CAAC;IACD,IAAA,yBAAU,EAAC;QACV,WAAW,EAAE,kGAAkG;KAChH,CAAC;GACW,YAAY,CA2BxB","sourcesContent":["import { CreateDateColumn, UpdateDateColumn, Entity, Index, Column, PrimaryGeneratedColumn } from 'typeorm'\nimport { ObjectType, Field, ID } from 'type-graphql'\n\nimport { AttributeSetItem } from './attribute-set-item-type.js'\n\n@Entity()\n@Index('ix_attribute_set_0', (attributeSet: AttributeSet) => [attributeSet.entity], {\n unique: true\n})\n@ObjectType({\n description: 'Represents an AttributeSet entity, which defines a set of attributes for a specific entity type.'\n})\nexport class AttributeSet {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID, { description: 'The unique identifier of the AttributeSet.' })\n readonly id: string\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true, description: 'The name of the entity this AttributeSet is associated with.' })\n entity: string = ''\n\n @Column({ nullable: true, default: '' })\n @Field({ nullable: true, description: 'A description of the AttributeSet.' })\n description: string = ''\n\n @Column('simple-json', { nullable: true })\n @Field(type => [AttributeSetItem], {\n nullable: true,\n description: 'A list of items (attributes) included in this AttributeSet.'\n })\n items: AttributeSetItem[]\n\n @CreateDateColumn()\n @Field({ nullable: true, description: 'The date and time when this AttributeSet was created.' })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true, description: 'The date and time when this AttributeSet was last updated.' })\n updatedAt?: Date\n}\n"]}
@@ -1,4 +1,6 @@
1
1
  "use strict";
2
+ // This module provides shared GraphQL types, scalars, and input types for use across the application.
3
+ // It includes flexible scalar types, object references, logging types, and list query parameter types.
2
4
  Object.defineProperty(exports, "__esModule", { value: true });
3
5
  const tslib_1 = require("tslib");
4
6
  tslib_1.__exportStar(require("./list-param.js"), exports);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/common-types/index.ts"],"names":[],"mappings":";;;AAAA,0DAA+B;AAC/B,0DAA+B;AAC/B,2DAAgC;AAChC,6DAAkC;AAClC,0DAA+B;AAC/B,mDAAwB","sourcesContent":["export * from './list-param.js'\nexport * from './scalar-any.js'\nexport * from './scalar-date.js'\nexport * from './scalar-object.js'\nexport * from './object-ref.js'\nexport * from './log.js'\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/common-types/index.ts"],"names":[],"mappings":";AAAA,sGAAsG;AACtG,uGAAuG;;;AAEvG,0DAA+B;AAC/B,0DAA+B;AAC/B,2DAAgC;AAChC,6DAAkC;AAClC,0DAA+B;AAC/B,mDAAwB","sourcesContent":["// This module provides shared GraphQL types, scalars, and input types for use across the application.\n// It includes flexible scalar types, object references, logging types, and list query parameter types.\n\nexport * from './list-param.js'\nexport * from './scalar-any.js'\nexport * from './scalar-date.js'\nexport * from './scalar-object.js'\nexport * from './object-ref.js'\nexport * from './log.js'\n"]}
@@ -11,75 +11,76 @@ var InheritedValueType;
11
11
  InheritedValueType["Include"] = "Include";
12
12
  })(InheritedValueType || (exports.InheritedValueType = InheritedValueType = {}));
13
13
  (0, type_graphql_1.registerEnumType)(InheritedValueType, {
14
- name: 'InheritedValueType'
14
+ name: 'InheritedValueType',
15
+ description: 'Enumeration for inherited value types: None, Only, or Include. Used to specify how values are inherited in queries or filters.'
15
16
  });
16
17
  let Sorting = class Sorting {
17
18
  };
18
19
  exports.Sorting = Sorting;
19
20
  tslib_1.__decorate([
20
- (0, type_graphql_1.Field)({ description: 'Field name to sort by' }),
21
+ (0, type_graphql_1.Field)({ description: 'The field name to sort the results by.' }),
21
22
  tslib_1.__metadata("design:type", String)
22
23
  ], Sorting.prototype, "name", void 0);
23
24
  tslib_1.__decorate([
24
- (0, type_graphql_1.Field)({ nullable: true, description: 'Set to true if descending sort. Default is "false"' }),
25
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Set to true for descending order. Default is false (ascending).' }),
25
26
  tslib_1.__metadata("design:type", Boolean)
26
27
  ], Sorting.prototype, "desc", void 0);
27
28
  exports.Sorting = Sorting = tslib_1.__decorate([
28
- (0, type_graphql_1.InputType)()
29
+ (0, type_graphql_1.InputType)({ description: 'Input type for specifying sorting options in a list query.' })
29
30
  ], Sorting);
30
31
  let Pagination = class Pagination {
31
32
  };
32
33
  exports.Pagination = Pagination;
33
34
  tslib_1.__decorate([
34
- (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
35
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The page number to retrieve.' }),
35
36
  tslib_1.__metadata("design:type", Number)
36
37
  ], Pagination.prototype, "page", void 0);
37
38
  tslib_1.__decorate([
38
- (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true }),
39
+ (0, type_graphql_1.Field)(type => type_graphql_1.Int, { nullable: true, description: 'The maximum number of items per page.' }),
39
40
  tslib_1.__metadata("design:type", Number)
40
41
  ], Pagination.prototype, "limit", void 0);
41
42
  exports.Pagination = Pagination = tslib_1.__decorate([
42
- (0, type_graphql_1.InputType)()
43
+ (0, type_graphql_1.InputType)({ description: 'Input type for specifying pagination options in a list query.' })
43
44
  ], Pagination);
44
45
  let Filter = class Filter {
45
46
  };
46
47
  exports.Filter = Filter;
47
48
  tslib_1.__decorate([
48
- (0, type_graphql_1.Field)(),
49
+ (0, type_graphql_1.Field)({ description: 'The field name to apply the filter on.' }),
49
50
  tslib_1.__metadata("design:type", String)
50
51
  ], Filter.prototype, "name", void 0);
51
52
  tslib_1.__decorate([
52
- (0, type_graphql_1.Field)(),
53
+ (0, type_graphql_1.Field)({ description: 'The operator to use for filtering (e.g., eq, ne, gt, lt, in, etc.).' }),
53
54
  tslib_1.__metadata("design:type", String)
54
55
  ], Filter.prototype, "operator", void 0);
55
56
  tslib_1.__decorate([
56
- (0, type_graphql_1.Field)(type => scalar_any_js_1.ScalarAny, { nullable: true }),
57
+ (0, type_graphql_1.Field)(type => scalar_any_js_1.ScalarAny, { nullable: true, description: 'The value to compare the field against.' }),
57
58
  tslib_1.__metadata("design:type", Object)
58
59
  ], Filter.prototype, "value", void 0);
59
60
  tslib_1.__decorate([
60
- (0, type_graphql_1.Field)({ nullable: true }),
61
+ (0, type_graphql_1.Field)({ nullable: true, description: 'Set to true if the filter applies to a relation field.' }),
61
62
  tslib_1.__metadata("design:type", Boolean)
62
63
  ], Filter.prototype, "relation", void 0);
63
64
  exports.Filter = Filter = tslib_1.__decorate([
64
- (0, type_graphql_1.InputType)()
65
+ (0, type_graphql_1.InputType)({ description: 'Input type for specifying a filter condition in a list query.' })
65
66
  ], Filter);
66
67
  let ListParam = class ListParam {
67
68
  };
68
69
  exports.ListParam = ListParam;
69
70
  tslib_1.__decorate([
70
- (0, type_graphql_1.Field)(type => [Filter], { nullable: true }),
71
+ (0, type_graphql_1.Field)(type => [Filter], { nullable: true, description: 'An array of filter conditions to apply to the list query.' }),
71
72
  tslib_1.__metadata("design:type", Array)
72
73
  ], ListParam.prototype, "filters", void 0);
73
74
  tslib_1.__decorate([
74
- (0, type_graphql_1.Field)(type => Pagination, { nullable: true }),
75
+ (0, type_graphql_1.Field)(type => Pagination, { nullable: true, description: 'Pagination options for the list query.' }),
75
76
  tslib_1.__metadata("design:type", Pagination)
76
77
  ], ListParam.prototype, "pagination", void 0);
77
78
  tslib_1.__decorate([
78
- (0, type_graphql_1.Field)(type => [Sorting], { nullable: true }),
79
+ (0, type_graphql_1.Field)(type => [Sorting], { nullable: true, description: 'Sorting options for the list query.' }),
79
80
  tslib_1.__metadata("design:type", Array)
80
81
  ], ListParam.prototype, "sortings", void 0);
81
82
  tslib_1.__decorate([
82
- (0, type_graphql_1.Field)(type => InheritedValueType, { nullable: true }),
83
+ (0, type_graphql_1.Field)(type => InheritedValueType, { nullable: true, description: 'Inherited value type for the list query.' }),
83
84
  tslib_1.__metadata("design:type", String)
84
85
  ], ListParam.prototype, "inherited", void 0);
85
86
  exports.ListParam = ListParam = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"list-param.js","sourceRoot":"","sources":["../../../server/service/common-types/list-param.ts"],"names":[],"mappings":";;;;AAAA,+CAAgF;AAEhF,mDAA2C;AAE3C,IAAY,kBAIX;AAJD,WAAY,kBAAkB;IAC5B,mCAAa,CAAA;IACb,mCAAa,CAAA;IACb,yCAAmB,CAAA;AACrB,CAAC,EAJW,kBAAkB,kCAAlB,kBAAkB,QAI7B;AAED,IAAA,+BAAgB,EAAC,kBAAk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,QAAQ,EAAE,IAAI,EAAE,CAAC;;0CAC1B;AAGlB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCACjC,UAAU;6CAAA;AAGvB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACzB;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAkB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACxB;oBAXnB,SAAS;IADrB,IAAA,uBAAQ,GAAE;GACE,SAAS,CAYrB","sourcesContent":["import { ArgsType, Field, InputType, Int, registerEnumType } from 'type-graphql'\n\nimport { ScalarAny } from './scalar-any.js'\n\nexport enum InheritedValueType {\n None = 'None',\n Only = 'Only',\n Include = 'Include'\n}\n\nregisterEnumType(InheritedValueType, {\n name: 'InheritedValueType'\n})\n\n@InputType()\nexport class Sorting {\n @Field({ description: 'Field name to sort by' })\n name: string\n\n @Field({ nullable: true, description: 'Set to true if descending sort. Default is \"false\"' })\n desc?: boolean\n}\n\n@InputType()\nexport class Pagination {\n @Field(type => Int, { nullable: true })\n page?: number\n\n @Field(type => Int, { nullable: true })\n limit?: number\n}\n\n@InputType()\nexport class Filter {\n @Field()\n name: string\n\n @Field()\n operator: string\n\n @Field(type => ScalarAny, { nullable: true })\n value?: any\n\n @Field({ nullable: true })\n relation?: boolean\n}\n\n@ArgsType()\nexport class ListParam {\n @Field(type => [Filter], { nullable: true })\n filters?: Filter[]\n\n @Field(type => Pagination, { nullable: true })\n pagination?: Pagination\n\n @Field(type => [Sorting], { nullable: true })\n sortings?: Sorting[]\n\n @Field(type => InheritedValueType, { nullable: true })\n inherited?: InheritedValueType\n}\n"]}
1
+ {"version":3,"file":"list-param.js","sourceRoot":"","sources":["../../../server/service/common-types/list-param.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heritedValueType {\n None = 'None',\n Only = 'Only',\n Include = 'Include'\n}\n\nregisterEnumType(InheritedValueType, {\n name: 'InheritedValueType',\n description:\n 'Enumeration for inherited value types: None, Only, or Include. Used to specify how values are inherited in queries or filters.'\n})\n\n@InputType({ description: 'Input type for specifying sorting options in a list query.' })\nexport class Sorting {\n @Field({ description: 'The field name to sort the results by.' })\n name: string\n\n @Field({ nullable: true, description: 'Set to true for descending order. Default is false (ascending).' })\n desc?: boolean\n}\n\n@InputType({ description: 'Input type for specifying pagination options in a list query.' })\nexport class Pagination {\n @Field(type => Int, { nullable: true, description: 'The page number to retrieve.' })\n page?: number\n\n @Field(type => Int, { nullable: true, description: 'The maximum number of items per page.' })\n limit?: number\n}\n\n@InputType({ description: 'Input type for specifying a filter condition in a list query.' })\nexport class Filter {\n @Field({ description: 'The field name to apply the filter on.' })\n name: string\n\n @Field({ description: 'The operator to use for filtering (e.g., eq, ne, gt, lt, in, etc.).' })\n operator: string\n\n @Field(type => ScalarAny, { nullable: true, description: 'The value to compare the field against.' })\n value?: any\n\n @Field({ nullable: true, description: 'Set to true if the filter applies to a relation field.' })\n relation?: boolean\n}\n\n@ArgsType()\nexport class ListParam {\n @Field(type => [Filter], { nullable: true, description: 'An array of filter conditions to apply to the list query.' })\n filters?: Filter[]\n\n @Field(type => Pagination, { nullable: true, description: 'Pagination options for the list query.' })\n pagination?: Pagination\n\n @Field(type => [Sorting], { nullable: true, description: 'Sorting options for the list query.' })\n sortings?: Sorting[]\n\n @Field(type => InheritedValueType, { nullable: true, description: 'Inherited value type for the list query.' })\n inherited?: InheritedValueType\n}\n"]}
@@ -8,22 +8,22 @@ let Log = class Log {
8
8
  };
9
9
  exports.Log = Log;
10
10
  tslib_1.__decorate([
11
- (0, type_graphql_1.Field)(() => scalar_object_js_1.ScalarObject, { description: 'the source of the log' }),
11
+ (0, type_graphql_1.Field)(() => scalar_object_js_1.ScalarObject, { description: 'The source object or context from which the log originated.' }),
12
12
  tslib_1.__metadata("design:type", Object)
13
13
  ], Log.prototype, "source", void 0);
14
14
  tslib_1.__decorate([
15
- (0, type_graphql_1.Field)({ description: 'log level (error, warning, info, ..)' }),
15
+ (0, type_graphql_1.Field)({ description: 'The severity level of the log entry (e.g., error, warning, info).' }),
16
16
  tslib_1.__metadata("design:type", String)
17
17
  ], Log.prototype, "level", void 0);
18
18
  tslib_1.__decorate([
19
- (0, type_graphql_1.Field)({ description: 'log body message' }),
19
+ (0, type_graphql_1.Field)({ description: 'The main message or content of the log entry.' }),
20
20
  tslib_1.__metadata("design:type", String)
21
21
  ], Log.prototype, "message", void 0);
22
22
  tslib_1.__decorate([
23
- (0, type_graphql_1.Field)({ description: 'timestamp the log occurred' }),
23
+ (0, type_graphql_1.Field)({ description: 'The timestamp indicating when the log entry was created.' }),
24
24
  tslib_1.__metadata("design:type", String)
25
25
  ], Log.prototype, "timestamp", void 0);
26
26
  exports.Log = Log = tslib_1.__decorate([
27
- (0, type_graphql_1.ObjectType)()
27
+ (0, type_graphql_1.ObjectType)({ description: 'Represents a log entry, including its source, level, message, and timestamp.' })
28
28
  ], Log);
29
29
  //# sourceMappingURL=log.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../server/service/common-types/log.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,yDAAiD;AAG1C,IAAM,GAAG,GAAT,MAAM,GAAG;CAYf,CAAA;AAZY,kBAAG;AAEd;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,+BAAY,EAAE,EAAE,WAAW,EAAE,uBAAuB,EAAE,CAAC;;mCACtD;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,sCAAsC,EAAE,CAAC;;kCAClD;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,kBAAkB,EAAE,CAAC;;oCAC5B;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,4BAA4B,EAAE,CAAC;;sCACpC;cAXN,GAAG;IADf,IAAA,yBAAU,GAAE;GACA,GAAG,CAYf","sourcesContent":["import { ObjectType, Field } from 'type-graphql'\nimport { ScalarObject } from './scalar-object.js'\n\n@ObjectType()\nexport class Log {\n @Field(() => ScalarObject, { description: 'the source of the log' })\n source: object\n\n @Field({ description: 'log level (error, warning, info, ..)' })\n level: string\n\n @Field({ description: 'log body message' })\n message: string\n\n @Field({ description: 'timestamp the log occurred' })\n timestamp: string\n}\n"]}
1
+ {"version":3,"file":"log.js","sourceRoot":"","sources":["../../../server/service/common-types/log.ts"],"names":[],"mappings":";;;;AAAA,+CAAgD;AAChD,yDAAiD;AAG1C,IAAM,GAAG,GAAT,MAAM,GAAG;CAYf,CAAA;AAZY,kBAAG;AAEd;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,+BAAY,EAAE,EAAE,WAAW,EAAE,6DAA6D,EAAE,CAAC;;mCAC5F;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,mEAAmE,EAAE,CAAC;;kCAC/E;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,+CAA+C,EAAE,CAAC;;oCACzD;AAGf;IADC,IAAA,oBAAK,EAAC,EAAE,WAAW,EAAE,0DAA0D,EAAE,CAAC;;sCAClE;cAXN,GAAG;IADf,IAAA,yBAAU,EAAC,EAAE,WAAW,EAAE,8EAA8E,EAAE,CAAC;GAC/F,GAAG,CAYf","sourcesContent":["import { ObjectType, Field } from 'type-graphql'\nimport { ScalarObject } from './scalar-object.js'\n\n@ObjectType({ description: 'Represents a log entry, including its source, level, message, and timestamp.' })\nexport class Log {\n @Field(() => ScalarObject, { description: 'The source object or context from which the log originated.' })\n source: object\n\n @Field({ description: 'The severity level of the log entry (e.g., error, warning, info).' })\n level: string\n\n @Field({ description: 'The main message or content of the log entry.' })\n message: string\n\n @Field({ description: 'The timestamp indicating when the log entry was created.' })\n timestamp: string\n}\n"]}
@@ -7,18 +7,20 @@ let ObjectRef = class ObjectRef {
7
7
  };
8
8
  exports.ObjectRef = ObjectRef;
9
9
  tslib_1.__decorate([
10
- (0, type_graphql_1.Field)(() => type_graphql_1.ID, { description: 'Field id' }),
10
+ (0, type_graphql_1.Field)(() => type_graphql_1.ID, { description: 'The unique identifier of the referenced object.' }),
11
11
  tslib_1.__metadata("design:type", String)
12
12
  ], ObjectRef.prototype, "id", void 0);
13
13
  tslib_1.__decorate([
14
- (0, type_graphql_1.Field)({ nullable: true, description: 'Field name' }),
14
+ (0, type_graphql_1.Field)({ nullable: true, description: 'The name of the referenced object.' }),
15
15
  tslib_1.__metadata("design:type", String)
16
16
  ], ObjectRef.prototype, "name", void 0);
17
17
  tslib_1.__decorate([
18
- (0, type_graphql_1.Field)({ nullable: true, description: 'Field description' }),
18
+ (0, type_graphql_1.Field)({ nullable: true, description: 'A description of the referenced object.' }),
19
19
  tslib_1.__metadata("design:type", String)
20
20
  ], ObjectRef.prototype, "description", void 0);
21
21
  exports.ObjectRef = ObjectRef = tslib_1.__decorate([
22
- (0, type_graphql_1.InputType)()
22
+ (0, type_graphql_1.InputType)({
23
+ description: 'Input type for referencing another object by its unique identifier, with optional name and description.'
24
+ })
23
25
  ], ObjectRef);
24
26
  //# sourceMappingURL=object-ref.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"object-ref.js","sourceRoot":"","sources":["../../../server/service/common-types/object-ref.ts"],"names":[],"mappings":";;;;AAAA,+CAAmD;AAG5C,IAAM,SAAS,GAAf,MAAM,SAAS;CASrB,CAAA;AATY,8BAAS;AAEpB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,UAAU,EAAE,CAAC;;qCACnC;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,YAAY,EAAE,CAAC;;uCACxC;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;;8CACxC;oBART,SAAS;IADrB,IAAA,wBAAS,GAAE;GACC,SAAS,CASrB","sourcesContent":["import { InputType, Field, ID } from 'type-graphql'\n\n@InputType()\nexport class ObjectRef {\n @Field(() => ID, { description: 'Field id' })\n id: string\n\n @Field({ nullable: true, description: 'Field name' })\n name?: string\n\n @Field({ nullable: true, description: 'Field description' })\n description?: string\n}\n"]}
1
+ {"version":3,"file":"object-ref.js","sourceRoot":"","sources":["../../../server/service/common-types/object-ref.ts"],"names":[],"mappings":";;;;AAAA,+CAAmD;AAK5C,IAAM,SAAS,GAAf,MAAM,SAAS;CASrB,CAAA;AATY,8BAAS;AAEpB;IADC,IAAA,oBAAK,EAAC,GAAG,EAAE,CAAC,iBAAE,EAAE,EAAE,WAAW,EAAE,iDAAiD,EAAE,CAAC;;qCAC1E;AAGV;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,oCAAoC,EAAE,CAAC;;uCAChE;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,yCAAyC,EAAE,CAAC;;8CAC9D;oBART,SAAS;IAHrB,IAAA,wBAAS,EAAC;QACT,WAAW,EAAE,yGAAyG;KACvH,CAAC;GACW,SAAS,CASrB","sourcesContent":["import { InputType, Field, ID } from 'type-graphql'\n\n@InputType({\n description: 'Input type for referencing another object by its unique identifier, with optional name and description.'\n})\nexport class ObjectRef {\n @Field(() => ID, { description: 'The unique identifier of the referenced object.' })\n id: string\n\n @Field({ nullable: true, description: 'The name of the referenced object.' })\n name?: string\n\n @Field({ nullable: true, description: 'A description of the referenced object.' })\n description?: string\n}\n"]}
@@ -29,7 +29,7 @@ function parseAst(ast) {
29
29
  }
30
30
  exports.ScalarAny = new graphql_1.GraphQLScalarType({
31
31
  name: 'Any',
32
- description: 'Any Scalar type (String, Boolean, Int, Float, Object, List)',
32
+ description: 'A flexible scalar type that can represent any GraphQL value, including String, Boolean, Int, Float, Object, or List. Use this type for fields or arguments that may accept or return various data types.',
33
33
  serialize(value) {
34
34
  // Implement your own behavior here by setting the 'result' variable
35
35
  return value;
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-any.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-any.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEjD,SAAS,WAAW,CAAC,GAAG;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACjC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,GAAG;IACnB,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,cAAI,CAAC,GAAG;YACX,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC5B,KAAK,cAAI,CAAC,KAAK;YACb,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,cAAI,CAAC,OAAO;YACf,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,IAAI;YACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACjC,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QACzB;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAEY,QAAA,SAAS,GAAG,IAAI,2BAAiB,CAAC;IAC7C,IAAI,EAAE,KAAK;IACX,WAAW,EAAE,6DAA6D;IAC1E,SAAS,CAAC,KAAK;QACb,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,UAAU,CAAC,KAAK;QACd,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\n\nfunction parseObject(ast) {\n const value = Object.create(null)\n ast.fields.forEach(field => {\n value[field.name.value] = parseAst(field.value)\n })\n return value\n}\n\nfunction parseAst(ast) {\n switch (ast.kind) {\n case Kind.INT:\n return parseInt(ast.value)\n case Kind.FLOAT:\n return parseFloat(ast.value)\n case Kind.BOOLEAN:\n return ast.value\n case Kind.STRING:\n return ast.value\n case Kind.LIST:\n return ast.values.map(parseAst)\n case Kind.OBJECT:\n return parseObject(ast)\n default:\n return null\n }\n}\n\nexport const ScalarAny = new GraphQLScalarType({\n name: 'Any',\n description: 'Any Scalar type (String, Boolean, Int, Float, Object, List)',\n serialize(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseValue(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseLiteral(ast) {\n return parseAst(ast)\n }\n})\n"]}
1
+ {"version":3,"file":"scalar-any.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-any.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEjD,SAAS,WAAW,CAAC,GAAG;IACtB,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAA;IACjC,GAAG,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE;QACzB,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;IACjD,CAAC,CAAC,CAAA;IACF,OAAO,KAAK,CAAA;AACd,CAAC;AAED,SAAS,QAAQ,CAAC,GAAG;IACnB,QAAQ,GAAG,CAAC,IAAI,EAAE,CAAC;QACjB,KAAK,cAAI,CAAC,GAAG;YACX,OAAO,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC5B,KAAK,cAAI,CAAC,KAAK;YACb,OAAO,UAAU,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA;QAC9B,KAAK,cAAI,CAAC,OAAO;YACf,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,GAAG,CAAC,KAAK,CAAA;QAClB,KAAK,cAAI,CAAC,IAAI;YACZ,OAAO,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;QACjC,KAAK,cAAI,CAAC,MAAM;YACd,OAAO,WAAW,CAAC,GAAG,CAAC,CAAA;QACzB;YACE,OAAO,IAAI,CAAA;IACf,CAAC;AACH,CAAC;AAEY,QAAA,SAAS,GAAG,IAAI,2BAAiB,CAAC;IAC7C,IAAI,EAAE,KAAK;IACX,WAAW,EACT,0MAA0M;IAC5M,SAAS,CAAC,KAAK;QACb,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,UAAU,CAAC,KAAK;QACd,oEAAoE;QACpE,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,QAAQ,CAAC,GAAG,CAAC,CAAA;IACtB,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\n\nfunction parseObject(ast) {\n const value = Object.create(null)\n ast.fields.forEach(field => {\n value[field.name.value] = parseAst(field.value)\n })\n return value\n}\n\nfunction parseAst(ast) {\n switch (ast.kind) {\n case Kind.INT:\n return parseInt(ast.value)\n case Kind.FLOAT:\n return parseFloat(ast.value)\n case Kind.BOOLEAN:\n return ast.value\n case Kind.STRING:\n return ast.value\n case Kind.LIST:\n return ast.values.map(parseAst)\n case Kind.OBJECT:\n return parseObject(ast)\n default:\n return null\n }\n}\n\nexport const ScalarAny = new GraphQLScalarType({\n name: 'Any',\n description:\n 'A flexible scalar type that can represent any GraphQL value, including String, Boolean, Int, Float, Object, or List. Use this type for fields or arguments that may accept or return various data types.',\n serialize(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseValue(value) {\n // Implement your own behavior here by setting the 'result' variable\n return value\n },\n parseLiteral(ast) {\n return parseAst(ast)\n }\n})\n"]}
@@ -4,7 +4,7 @@ exports.ScalarDate = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  exports.ScalarDate = new graphql_1.GraphQLScalarType({
6
6
  name: 'Date',
7
- description: 'Date custom scalar type',
7
+ description: 'A custom scalar type for representing date values. Accepts and serializes dates as either timestamps (milliseconds since epoch) or ISO date strings. Use this type for fields or arguments that require date-only values without time components.',
8
8
  parseValue(value) {
9
9
  return new Date(value); // value from the client
10
10
  },
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,yBAAyB;IACtC,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,KAAY,CAAC,CAAC,OAAO,EAAE,CAAA,CAAC,2BAA2B;IACrE,CAAC;IACD,YAAY,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,IAAI,KAAK,cAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;QACrE,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\n\nexport const ScalarDate = new GraphQLScalarType({\n name: 'Date',\n description: 'Date custom scalar type',\n parseValue(value) {\n return new Date(value as string | number) // value from the client\n },\n serialize(value) {\n /**\n * Note: Allow value to be date only like \"2021-01-31\" to be serialize before passing data to clientside for TypeGraphql.\n * Usage: When database column datatype is \"date\" and data do not contain any time component.\n */\n return new Date(value as any).getTime() // value sent to the client\n },\n parseLiteral(ast) {\n if (ast.kind === Kind.INT) {\n return new Date(+ast.value) // ast value is always in string format\n }\n return null\n }\n})\n"]}
1
+ {"version":3,"file":"scalar-date.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-date.ts"],"names":[],"mappings":";;;AAAA,qCAAiD;AAEpC,QAAA,UAAU,GAAG,IAAI,2BAAiB,CAAC;IAC9C,IAAI,EAAE,MAAM;IACZ,WAAW,EACT,mPAAmP;IACrP,UAAU,CAAC,KAAK;QACd,OAAO,IAAI,IAAI,CAAC,KAAwB,CAAC,CAAA,CAAC,wBAAwB;IACpE,CAAC;IACD,SAAS,CAAC,KAAK;QACb;;;WAGG;QACH,OAAO,IAAI,IAAI,CAAC,KAAY,CAAC,CAAC,OAAO,EAAE,CAAA,CAAC,2BAA2B;IACrE,CAAC;IACD,YAAY,CAAC,GAAG;QACd,IAAI,GAAG,CAAC,IAAI,KAAK,cAAI,CAAC,GAAG,EAAE,CAAC;YAC1B,OAAO,IAAI,IAAI,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAA,CAAC,uCAAuC;QACrE,CAAC;QACD,OAAO,IAAI,CAAA;IACb,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType, Kind } from 'graphql'\n\nexport const ScalarDate = new GraphQLScalarType({\n name: 'Date',\n description:\n 'A custom scalar type for representing date values. Accepts and serializes dates as either timestamps (milliseconds since epoch) or ISO date strings. Use this type for fields or arguments that require date-only values without time components.',\n parseValue(value) {\n return new Date(value as string | number) // value from the client\n },\n serialize(value) {\n /**\n * Note: Allow value to be date only like \"2021-01-31\" to be serialize before passing data to clientside for TypeGraphql.\n * Usage: When database column datatype is \"date\" and data do not contain any time component.\n */\n return new Date(value as any).getTime() // value sent to the client\n },\n parseLiteral(ast) {\n if (ast.kind === Kind.INT) {\n return new Date(+ast.value) // ast value is always in string format\n }\n return null\n }\n})\n"]}
@@ -4,7 +4,7 @@ exports.ScalarObject = void 0;
4
4
  const graphql_1 = require("graphql");
5
5
  exports.ScalarObject = new graphql_1.GraphQLScalarType({
6
6
  name: 'Object',
7
- description: 'Can be anything',
7
+ description: 'A custom scalar type for representing arbitrary JSON objects. Use this type for fields or arguments that require flexible, structured data beyond standard GraphQL scalar types.',
8
8
  parseValue(value) {
9
9
  return value;
10
10
  },
@@ -1 +1 @@
1
- {"version":3,"file":"scalar-object.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-object.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAE9B,QAAA,YAAY,GAAG,IAAI,2BAAiB,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,WAAW,EAAE,iBAAiB;IAC9B,UAAU,CAAC,KAAK;QACd,OAAO,KAAK,CAAA;IACd,CAAC;IACD,SAAS,CAAC,KAAK;QACb,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,GAAG,CAAA;IACZ,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType } from 'graphql'\n\nexport const ScalarObject = new GraphQLScalarType({\n name: 'Object',\n description: 'Can be anything',\n parseValue(value) {\n return value\n },\n serialize(value) {\n return value\n },\n parseLiteral(ast) {\n return ast\n }\n})\n"]}
1
+ {"version":3,"file":"scalar-object.js","sourceRoot":"","sources":["../../../server/service/common-types/scalar-object.ts"],"names":[],"mappings":";;;AAAA,qCAA2C;AAE9B,QAAA,YAAY,GAAG,IAAI,2BAAiB,CAAC;IAChD,IAAI,EAAE,QAAQ;IACd,WAAW,EACT,kLAAkL;IACpL,UAAU,CAAC,KAAK;QACd,OAAO,KAAK,CAAA;IACd,CAAC;IACD,SAAS,CAAC,KAAK;QACb,OAAO,KAAK,CAAA;IACd,CAAC;IACD,YAAY,CAAC,GAAG;QACd,OAAO,GAAG,CAAA;IACZ,CAAC;CACF,CAAC,CAAA","sourcesContent":["import { GraphQLScalarType } from 'graphql'\n\nexport const ScalarObject = new GraphQLScalarType({\n name: 'Object',\n description:\n 'A custom scalar type for representing arbitrary JSON objects. Use this type for fields or arguments that require flexible, structured data beyond standard GraphQL scalar types.',\n parseValue(value) {\n return value\n },\n serialize(value) {\n return value\n },\n parseLiteral(ast) {\n return ast\n }\n})\n"]}
@@ -12,15 +12,17 @@ exports.transactionDirectiveTypeDefs = (0, graphql_tag_1.default) `
12
12
  `;
13
13
  const transactionDirectiveResolver = (schema) => (0, utils_1.mapSchema)(schema, {
14
14
  [utils_1.MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName) => {
15
- var _a;
16
- const transactionDirective = (_a = (0, utils_1.getDirective)(schema, fieldConfig, DIRECTIVE)) === null || _a === void 0 ? void 0 : _a[0];
15
+ const transactionDirective = (0, utils_1.getDirective)(schema, fieldConfig, DIRECTIVE)?.[0];
17
16
  if (transactionDirective) {
18
17
  const { resolve = graphql_1.defaultFieldResolver } = fieldConfig;
19
18
  fieldConfig.resolve = async function (source, args, context, info) {
20
19
  return await (0, database_js_1.getDataSource)('tx').transaction(async (tx) => {
21
20
  /* local-graphql-client로부터 invoke인 경우에는 context.req, context.res 가 없으므로, 빈 오브젝트로 대체해준다. */
22
21
  let wrap = context.app.createContext(context.req || {}, context.res || {});
23
- wrap.state = Object.assign(Object.assign({}, context.state), { tx });
22
+ wrap.state = {
23
+ ...context.state,
24
+ tx
25
+ };
24
26
  wrap.t = context.t;
25
27
  let result = await resolve.call(this, source, args, wrap, info);
26
28
  return result;
@@ -1 +1 @@
1
- {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,qCAA6D;A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CAAC;CACF,CAAC,CAAA;AA3BS,QAAA,4BAA4B,gCA2BrC","sourcesContent":["import { defaultFieldResolver, GraphQLSchema } from 'graphql'\nimport gql from 'graphql-tag'\n\nimport { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'\n\nimport { getDataSource } from '../../initializers/database.js'\n\nconst DIRECTIVE = 'transaction'\n\nexport const transactionDirectiveTypeDefs = gql`\n directive @${DIRECTIVE} on FIELD_DEFINITION\n `\nexport const transactionDirectiveResolver = (schema: GraphQLSchema) =>\n mapSchema(schema, {\n [MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName) => {\n const transactionDirective = getDirective(schema, fieldConfig, DIRECTIVE)?.[0]\n if (transactionDirective) {\n const { resolve = defaultFieldResolver } = fieldConfig\n\n fieldConfig.resolve = async function (source, args, context, info) {\n return await getDataSource('tx').transaction(async tx => {\n /* local-graphql-client로부터 invoke인 경우에는 context.req, context.res 가 없으므로, 빈 오브젝트로 대체해준다. */\n let wrap = context.app.createContext(context.req || {}, context.res || {})\n\n wrap.state = {\n ...context.state,\n tx\n }\n wrap.t = context.t\n\n let result = await resolve.call(this, source, args, wrap, info)\n\n return result\n })\n }\n\n return fieldConfig\n }\n }\n })\n"]}
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../../server/service/directive-transaction/transaction.ts"],"names":[],"mappings":";;;;AAAA,qCAA6D;AAC7D,sEAA6B;AAE7B,gDAA0E;AAE1E,gEAA8D;AAE9D,MAAM,SAAS,GAAG,aAAa,CAAA;AAElB,QAAA,4BAA4B,GAAG,IAAA,qBAAG,EAAA;iBAC9B,SAAS;GACvB,CAAA;AACI,MAAM,4BAA4B,GAAG,CAAC,MAAqB,EAAE,EAAE,CACpE,IAAA,iBAAS,EAAC,MAAM,EAAE;IAChB,CAAC,kBAAU,CAAC,YAAY,CAAC,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,EAAE;QACpD,MAAM,oBAAoB,GAAG,IAAA,oBAAY,EAAC,MAAM,EAAE,WAAW,EAAE,SAAS,CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;QAC9E,IAAI,oBAAoB,EAAE,CAAC;YACzB,MAAM,EAAE,OAAO,GAAG,8BAAoB,EAAE,GAAG,WAAW,CAAA;YAEtD,WAAW,CAAC,OAAO,GAAG,KAAK,WAAW,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI;gBAC/D,OAAO,MAAM,IAAA,2BAAa,EAAC,IAAI,CAAC,CAAC,WAAW,CAAC,KAAK,EAAC,EAAE,EAAC,EAAE;oBACtD,0FAA0F;oBAC1F,IAAI,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,IAAI,EAAE,EAAE,OAAO,CAAC,GAAG,IAAI,EAAE,CAAC,CAAA;oBAE1E,IAAI,CAAC,KAAK,GAAG;wBACX,GAAG,OAAO,CAAC,KAAK;wBAChB,EAAE;qBACH,CAAA;oBACD,IAAI,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAA;oBAElB,IAAI,MAAM,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAA;oBAE/D,OAAO,MAAM,CAAA;gBACf,CAAC,CAAC,CAAA;YACJ,CAAC,CAAA;YAED,OAAO,WAAW,CAAA;QACpB,CAAC;IACH,CAAC;CACF,CAAC,CAAA;AA3BS,QAAA,4BAA4B,gCA2BrC","sourcesContent":["import { defaultFieldResolver, GraphQLSchema } from 'graphql'\nimport gql from 'graphql-tag'\n\nimport { getDirective, MapperKind, mapSchema } from '@graphql-tools/utils'\n\nimport { getDataSource } from '../../initializers/database.js'\n\nconst DIRECTIVE = 'transaction'\n\nexport const transactionDirectiveTypeDefs = gql`\n directive @${DIRECTIVE} on FIELD_DEFINITION\n `\nexport const transactionDirectiveResolver = (schema: GraphQLSchema) =>\n mapSchema(schema, {\n [MapperKind.OBJECT_FIELD]: (fieldConfig, fieldName) => {\n const transactionDirective = getDirective(schema, fieldConfig, DIRECTIVE)?.[0]\n if (transactionDirective) {\n const { resolve = defaultFieldResolver } = fieldConfig\n\n fieldConfig.resolve = async function (source, args, context, info) {\n return await getDataSource('tx').transaction(async tx => {\n /* local-graphql-client로부터 invoke인 경우에는 context.req, context.res 가 없으므로, 빈 오브젝트로 대체해준다. */\n let wrap = context.app.createContext(context.req || {}, context.res || {})\n\n wrap.state = {\n ...context.state,\n tx\n }\n wrap.t = context.t\n\n let result = await resolve.call(this, source, args, wrap, info)\n\n return result\n })\n }\n\n return fieldConfig\n }\n }\n })\n"]}
@@ -34,7 +34,10 @@ let DomainMutation = class DomainMutation {
34
34
  if (patch.parent && patch.parent.id == domain.id) {
35
35
  delete patch.parent;
36
36
  }
37
- return await repository.save(Object.assign(Object.assign({}, domain), patch));
37
+ return await repository.save({
38
+ ...domain,
39
+ ...patch
40
+ });
38
41
  }
39
42
  async updateDomains(patches) {
40
43
  const domainRepo = (0, database_js_1.getRepository)(domain_js_1.Domain);
@@ -48,7 +51,10 @@ let DomainMutation = class DomainMutation {
48
51
  if (updateRecord.parent && updateRecord.parent.id == domain.id) {
49
52
  delete updateRecord.parent;
50
53
  }
51
- await domainRepo.save(Object.assign(Object.assign({}, domain), updateRecord));
54
+ await domainRepo.save({
55
+ ...domain,
56
+ ...updateRecord
57
+ });
52
58
  });
53
59
  }
54
60
  return true;
@@ -57,7 +63,10 @@ let DomainMutation = class DomainMutation {
57
63
  const { domain } = context.state;
58
64
  const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
59
65
  // const domain: Domain = await repository.findOneBy({ id })
60
- const { iplist: result } = await repository.save(Object.assign(Object.assign({}, domain), { iplist }));
66
+ const { iplist: result } = await repository.save({
67
+ ...domain,
68
+ iplist
69
+ });
61
70
  return result;
62
71
  }
63
72
  };
@@ -65,8 +74,10 @@ exports.DomainMutation = DomainMutation;
65
74
  tslib_1.__decorate([
66
75
  (0, type_graphql_1.Directive)('@transaction'),
67
76
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
68
- (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To create domain (Only superuser is granted this privilege.)' }),
69
- tslib_1.__param(0, (0, type_graphql_1.Arg)('domainInput')),
77
+ (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, {
78
+ description: 'Creates a new domain entity. Only superusers are granted this privilege. Use this mutation to register a new domain with a unique subdomain.'
79
+ }),
80
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('domainInput', { description: 'The input object containing the new domain details.' })),
70
81
  tslib_1.__metadata("design:type", Function),
71
82
  tslib_1.__metadata("design:paramtypes", [domain_types_js_1.DomainPatch]),
72
83
  tslib_1.__metadata("design:returntype", Promise)
@@ -74,8 +85,10 @@ tslib_1.__decorate([
74
85
  tslib_1.__decorate([
75
86
  (0, type_graphql_1.Directive)('@transaction'),
76
87
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
77
- (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' }),
78
- tslib_1.__param(0, (0, type_graphql_1.Arg)('name')),
88
+ (0, type_graphql_1.Mutation)(returns => domain_js_1.Domain, {
89
+ description: 'Deletes a domain entity by its name. Only superusers are granted this privilege. Use this mutation to permanently remove a domain.'
90
+ }),
91
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('name', { description: 'The name of the domain to delete.' })),
79
92
  tslib_1.__metadata("design:type", Function),
80
93
  tslib_1.__metadata("design:paramtypes", [String]),
81
94
  tslib_1.__metadata("design:returntype", Promise)
@@ -84,9 +97,9 @@ tslib_1.__decorate([
84
97
  (0, type_graphql_1.Directive)('@transaction'),
85
98
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
86
99
  (0, type_graphql_1.Mutation)(returns => Boolean, {
87
- description: 'To delete multiple domains (Only superuser is granted this privilege.)'
100
+ description: 'Deletes multiple domain entities by their names. Only superusers are granted this privilege. Use this mutation to remove several domains at once.'
88
101
  }),
89
- tslib_1.__param(0, (0, type_graphql_1.Arg)('names', () => [String])),
102
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('names', () => [String], { description: 'An array of domain names to delete.' })),
90
103
  tslib_1.__metadata("design:type", Function),
91
104
  tslib_1.__metadata("design:paramtypes", [Array]),
92
105
  tslib_1.__metadata("design:returntype", Promise)
@@ -1 +1 @@
1
- {"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA+C;AAE/C,gEAA8D;AAE9D,2CAA4C;AAC5C,uDAA+C;AAC/C,uEAA+D;AAGxD,IAAM,cAAc,GAApB,MAAM,cAAc;IAInB,AAAN,KAAK,CAAC,YAAY,CAAqB,WAAwB;QAC7D,MAAM,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,WAAW,CAAA;QACzC,MAAM,UAAU,GAAuB,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAC5D,MAAM,SAAS,GAAW,IAAA,eAAO,EAAC,IAAI,CAAC,CAAA;QAEvC,MAAM,MAAM,GAAW,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,SAAS,EAAE,CAAC,CAAA;QAChE,IAAI,MAAM,EAAE,CAAC;YACX,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAA;QACzC,CAAC;QAED,OAAO,MAAM,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAA;IAChE,CAAC;IAKK,AAAN,KAAK,CAAC,YAAY,CAAc,IAAY;QAC1C,OAAO,MAAM,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAA;IACrD,CAAC;IAOK,AAAN,KAAK,CAAC,aAAa,CAA+B,KAAe;QAC/D,MAAM,OAAO,GAAa,MAAM,IAAA,2BA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,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,qCAAqC,EAAE,CAAC;IAEvG,mBAAA,IAAA,kBAAG,EAAC,QAAQ,EAAE,IAAI,CAAC,EAAE,CAAC,+BAAY,CAAC,CAAA;IACnC,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;wDAYP;yBA1GU,cAAc;IAD1B,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,cAAc,CA2G1B","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database.js'\n\nimport { Domain, IPList } from './domain.js'\nimport { DomainPatch } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To create domain (Only superuser is granted this privilege.)' })\n async createDomain(@Arg('domainInput') domainInput: DomainPatch) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, { description: 'To delete domain (Only superuser is granted this privilege.)' })\n async deleteDomain(@Arg('name') name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To delete multiple domains (Only superuser is granted this privilege.)'\n })\n async deleteDomains(@Arg('names', () => [String]) names: string[]) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n if (patch.parent && patch.parent.id == domain.id) {\n delete patch.parent\n }\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n if (updateRecord.parent && updateRecord.parent.id == domain.id) {\n delete updateRecord.parent\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Directive(\n '@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)'\n )\n @Mutation(returns => ScalarObject, { nullable: true, description: 'To update secure IP list for domain' })\n async updateSecureIPList(\n @Arg('iplist', type => ScalarObject) iplist: IPList,\n @Ctx() context: any\n ): Promise<IPList | null> {\n const { domain } = context.state\n const repository = getRepository(Domain)\n // const domain: Domain = await repository.findOneBy({ id })\n\n const { iplist: result } = await repository.save({\n ...domain,\n iplist\n } as any)\n\n return result\n }\n}\n"]}
1
+ {"version":3,"file":"domain-mutation.js","sourceRoot":"","sources":["../../../server/service/domain/domain-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAyF;AACzF,qCAAwC;AAExC,iDAA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A,uBAAQ,EAAC,kBAAM,CAAC;GACJ,cAAc,CAsH1B","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, Root } from 'type-graphql'\nimport { In, Repository } from 'typeorm'\n\nimport { slugger } from '@things-factory/utils'\n\nimport { getRepository } from '../../initializers/database.js'\n\nimport { Domain, IPList } from './domain.js'\nimport { DomainPatch } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainMutation {\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description:\n 'Creates a new domain entity. Only superusers are granted this privilege. Use this mutation to register a new domain with a unique subdomain.'\n })\n async createDomain(\n @Arg('domainInput', { description: 'The input object containing the new domain details.' }) domainInput: DomainPatch\n ) {\n const { name, description } = domainInput\n const domainRepo: Repository<Domain> = getRepository(Domain)\n const subdomain: string = slugger(name)\n\n const domain: Domain = await domainRepo.findOneBy({ subdomain })\n if (domain) {\n throw new Error('domain is duplicated')\n }\n\n return await domainRepo.save({ name, description, subdomain })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description:\n 'Deletes a domain entity by its name. Only superusers are granted this privilege. Use this mutation to permanently remove a domain.'\n })\n async deleteDomain(@Arg('name', { description: 'The name of the domain to delete.' }) name: string) {\n return await getRepository(Domain).delete({ name })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description:\n 'Deletes multiple domain entities by their names. Only superusers are granted this privilege. Use this mutation to remove several domains at once.'\n })\n async deleteDomains(\n @Arg('names', () => [String], { description: 'An array of domain names to delete.' }) names: string[]\n ) {\n const domains: Domain[] = await getRepository(Domain).find({ where: { name: In(names) } })\n const domainIds: string[] = domains.map(domain => domain.id)\n\n await getRepository(Domain).delete({ id: In(domainIds) })\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Domain, {\n description: 'To update domain (Only superuser is granted this privilege.)'\n })\n async updateDomain(@Arg('name') name: string, @Arg('patch', () => DomainPatch) patch: DomainPatch) {\n const repository = getRepository(Domain)\n const domain: Domain = await repository.findOneBy({ name })\n\n if (patch.parent && patch.parent.id == domain.id) {\n delete patch.parent\n }\n\n return await repository.save({\n ...domain,\n ...patch\n } as any)\n }\n\n @Directive('@transaction')\n @Directive('@privilege(superUserGranted: true)')\n @Mutation(returns => Boolean, {\n description: 'To update multiple domains (Only superuser is granted this privilege.)'\n })\n async updateDomains(@Arg('patches', () => [DomainPatch]) patches: DomainPatch[]): Promise<boolean> {\n const domainRepo: Repository<Domain> = getRepository(Domain)\n\n const patchIds = patches.filter((patch: any) => patch.id)\n\n if (patchIds.length > 0) {\n patchIds.forEach(async updateRecord => {\n const domain: Domain = await domainRepo.findOne({ where: { id: updateRecord.id } })\n\n if (updateRecord.name) {\n updateRecord.subdomain = slugger(updateRecord.name)\n }\n\n if (updateRecord.parent && updateRecord.parent.id == domain.id) {\n delete updateRecord.parent\n }\n\n await domainRepo.save({\n ...domain,\n ...updateRecord\n } as any)\n })\n }\n\n return true\n }\n\n @Directive('@transaction')\n @Directive(\n '@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true, superUserGranted: true)'\n )\n @Mutation(returns => ScalarObject, { nullable: true, description: 'To update secure IP list for domain' })\n async updateSecureIPList(\n @Arg('iplist', type => ScalarObject) iplist: IPList,\n @Ctx() context: any\n ): Promise<IPList | null> {\n const { domain } = context.state\n const repository = getRepository(Domain)\n // const domain: Domain = await repository.findOneBy({ id })\n\n const { iplist: result } = await repository.save({\n ...domain,\n iplist\n } as any)\n\n return result\n }\n}\n"]}
@@ -2,6 +2,7 @@ import { ListParam } from '../common-types/list-param.js';
2
2
  import { Domain, IPList } from './domain.js';
3
3
  import { DomainList } from './domain-types.js';
4
4
  export declare class DomainQuery {
5
+ domainTypes(context: any): Promise<String[]>;
5
6
  domain(id: string, context: any): Promise<Domain>;
6
7
  domains(params: ListParam, context: any): Promise<DomainList>;
7
8
  secureIPList(context: any): Promise<IPList | null>;
@@ -9,7 +9,11 @@ const list_param_js_1 = require("../common-types/list-param.js");
9
9
  const domain_js_1 = require("./domain.js");
10
10
  const domain_types_js_1 = require("./domain-types.js");
11
11
  const scalar_object_js_1 = require("../common-types/scalar-object.js");
12
+ const env_1 = require("@things-factory/env");
12
13
  let DomainQuery = class DomainQuery {
14
+ async domainTypes(context) {
15
+ return env_1.config.get('domainTypes') || ['domain'];
16
+ }
13
17
  async domain(id, context) {
14
18
  const repository = (0, database_js_1.getRepository)(domain_js_1.Domain);
15
19
  return await repository.findOneBy({ id });
@@ -35,8 +39,20 @@ let DomainQuery = class DomainQuery {
35
39
  exports.DomainQuery = DomainQuery;
36
40
  tslib_1.__decorate([
37
41
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
38
- (0, type_graphql_1.Query)(returns => domain_js_1.Domain, { description: 'To fetch domain' }),
39
- tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
42
+ (0, type_graphql_1.Query)(returns => [String], {
43
+ description: 'Fetches the list of available domain types from configuration. Only superusers are granted this privilege.'
44
+ }),
45
+ tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
46
+ tslib_1.__metadata("design:type", Function),
47
+ tslib_1.__metadata("design:paramtypes", [Object]),
48
+ tslib_1.__metadata("design:returntype", Promise)
49
+ ], DomainQuery.prototype, "domainTypes", null);
50
+ tslib_1.__decorate([
51
+ (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
52
+ (0, type_graphql_1.Query)(returns => domain_js_1.Domain, {
53
+ description: 'Fetches a single domain entity by its unique identifier. Only superusers are granted this privilege.'
54
+ }),
55
+ tslib_1.__param(0, (0, type_graphql_1.Arg)('id', { description: 'The unique identifier of the domain to fetch.' })),
40
56
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
41
57
  tslib_1.__metadata("design:type", Function),
42
58
  tslib_1.__metadata("design:paramtypes", [String, Object]),
@@ -44,7 +60,9 @@ tslib_1.__decorate([
44
60
  ], DomainQuery.prototype, "domain", null);
45
61
  tslib_1.__decorate([
46
62
  (0, type_graphql_1.Directive)('@privilege(superUserGranted: true)'),
47
- (0, type_graphql_1.Query)(returns => domain_types_js_1.DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' }),
63
+ (0, type_graphql_1.Query)(returns => domain_types_js_1.DomainList, {
64
+ description: 'Fetches all domain entities with pagination and filtering options. Only superusers are granted this privilege.'
65
+ }),
48
66
  tslib_1.__param(0, (0, type_graphql_1.Args)(type => list_param_js_1.ListParam)),
49
67
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
50
68
  tslib_1.__metadata("design:type", Function),
@@ -53,7 +71,10 @@ tslib_1.__decorate([
53
71
  ], DomainQuery.prototype, "domains", null);
54
72
  tslib_1.__decorate([
55
73
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
56
- (0, type_graphql_1.Query)(returns => scalar_object_js_1.ScalarObject, { nullable: true, description: 'To fetch domain' }),
74
+ (0, type_graphql_1.Query)(returns => scalar_object_js_1.ScalarObject, {
75
+ nullable: true,
76
+ description: 'Fetches the secure IP list (whitelist, blacklist, etc.) for the current domain. Only domain owners and superusers are granted this privilege.'
77
+ }),
57
78
  tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
58
79
  tslib_1.__metadata("design:type", Function),
59
80
  tslib_1.__metadata("design:paramtypes", [Object]),
@@ -1 +1 @@
1
- {"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAGxD,IAAM,WAAW,GAAjB,MAAM,WAAW;IAGhB,AAAN,KAAK,CAAC,MAAM,CAAY,EAAU,EAAS,OAAY;QACrD,MAAM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CAAoC,CAAC;IAC/C,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,4BAAU,EAAE,EAAE,WAAW,EAAE,kEAAkE,EAAE,CAAC;IACnG,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAIK;IAFL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAE,iBAAiB,EAAE,CAAC;IAC/D,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAlCU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAmCvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\n\nimport { getRepository } from '../../initializers/database.js'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params.js'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, { description: 'To fetch domain' })\n async domain(@Arg('id') id: string, @Ctx() context: any): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, { description: 'To fetch all domains (Only superuser is granted this privilege.)' })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, { nullable: true, description: 'To fetch domain' })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}
1
+ {"version":3,"file":"domain-query.js","sourceRoot":"","sources":["../../../server/service/domain/domain-query.ts"],"names":[],"mappings":";;;;AAAA,+CAAwG;AAExG,gEAA8D;AAC9D,6GAAiG;AAEjG,iEAAyD;AACzD,2CAA4C;AAC5C,uDAA8C;AAC9C,uEAA+D;AAC/D,6CAA4C;AAGrC,IAAM,WAAW,GAAjB,MAAM,WAAW;IAMhB,AAAN,KAAK,CAAC,WAAW,CAAQ,OAAY;QACnC,OAAO,YAAM,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAA;IAChD,CAAC;IAMK,AAAN,KAAK,CAAC,MAAM,CACmE,EAAU,EAChF,OAAY;QAEnB,MAAM,UAAU,GAAG,IAAA,2BAAa,EAAC,kBAAM,CAAC,CAAA;QAExC,OAAO,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,CAAC,CAAA;IAC3C,CAAC;IAOK,AAAN,KAAK,CAAC,OAAO,CAA0B,MAAiB,EAAS,OAAY;QAC3E,MAAM,YAAY,GAAG,MAAM,IAAA,qEAA6B,EAAC;YACvD,UAAU,EAAE,IAAA,2BAAa,EAAC,kBAAM,CAAC;YACjC,KAAK,EAAE,cAAc;YACrB,MAAM;YACN,WAAW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HAAgH;KACnH,CAAC;IACa,mBAAA,IAAA,mBAAI,EAAC,IAAI,CAAC,EAAE,CAAC,yBAAS,CAAC,CAAA;IAAqB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;6CAAjB,yBAAS;;0CAWvD;AAQK;IANL,IAAA,wBAAS,EAAC,wGAAwG,CAAC;IACnH,IAAA,oBAAK,EAAC,OAAO,CAAC,EAAE,CAAC,+BAAY,EAAE;QAC9B,QAAQ,EAAE,IAAI;QACd,WAAW,EACT,+IAA+I;KAClJ,CAAC;IACkB,mBAAA,IAAA,kBAAG,GAAE,CAAA;;;;+CAGxB;AAGK;IADL,IAAA,4BAAa,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAM,CAAC;IAChB,mBAAA,IAAA,mBAAI,GAAE,CAAA;;6CAAS,kBAAM;;yCAElC;sBAvDU,WAAW;IADvB,IAAA,uBAAQ,EAAC,kBAAM,CAAC;GACJ,WAAW,CAwDvB","sourcesContent":["import { Arg, Args, Ctx, Directive, Mutation, Query, Resolver, FieldResolver, Root } from 'type-graphql'\n\nimport { getRepository } from '../../initializers/database.js'\nimport { getQueryBuilderFromListParams } from '../../utils/get-query-builder-from-list-params.js'\n\nimport { ListParam } from '../common-types/list-param.js'\nimport { Domain, IPList } from './domain.js'\nimport { DomainList } from './domain-types.js'\nimport { ScalarObject } from '../common-types/scalar-object.js'\nimport { config } from '@things-factory/env'\n\n@Resolver(Domain)\nexport class DomainQuery {\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => [String], {\n description:\n 'Fetches the list of available domain types from configuration. Only superusers are granted this privilege.'\n })\n async domainTypes(@Ctx() context: any): Promise<String[]> {\n return config.get('domainTypes') || ['domain']\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => Domain, {\n description: 'Fetches a single domain entity by its unique identifier. Only superusers are granted this privilege.'\n })\n async domain(\n @Arg('id', { description: 'The unique identifier of the domain to fetch.' }) id: string,\n @Ctx() context: any\n ): Promise<Domain> {\n const repository = getRepository(Domain)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(superUserGranted: true)')\n @Query(returns => DomainList, {\n description:\n 'Fetches all domain entities with pagination and filtering options. Only superusers are granted this privilege.'\n })\n async domains(@Args(type => ListParam) params: ListParam, @Ctx() context: any): Promise<DomainList> {\n const queryBuilder = await getQueryBuilderFromListParams({\n repository: getRepository(Domain),\n alias: 'ContactPoint',\n params,\n searchables: ['name', 'description', 'subdomain']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ScalarObject, {\n nullable: true,\n description:\n 'Fetches the secure IP list (whitelist, blacklist, etc.) for the current domain. Only domain owners and superusers are granted this privilege.'\n })\n async secureIPList(@Ctx() context: any): Promise<IPList | null> {\n const { domain } = context.state\n return domain.iplist\n }\n\n @FieldResolver(type => Domain)\n async parent(@Root() domain: Domain): Promise<Domain> {\n return domain.parentId && (await getRepository(Domain).findOneBy({ id: domain.parentId }))\n }\n}\n"]}