@hamak/ui-remote-resource 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (91) hide show
  1. package/dist/api/actions/entity-action-factory.d.ts +28 -0
  2. package/dist/api/actions/entity-action-factory.d.ts.map +1 -0
  3. package/dist/api/actions/entity-action-factory.js +62 -0
  4. package/dist/api/actions/entity-action-types.d.ts +104 -0
  5. package/dist/api/actions/entity-action-types.d.ts.map +1 -0
  6. package/dist/api/actions/entity-action-types.js +16 -0
  7. package/dist/api/actions/resource-action-factory.d.ts +40 -0
  8. package/dist/api/actions/resource-action-factory.d.ts.map +1 -0
  9. package/dist/api/actions/resource-action-factory.js +93 -0
  10. package/dist/api/actions/resource-action-types.d.ts +105 -0
  11. package/dist/api/actions/resource-action-types.d.ts.map +1 -0
  12. package/dist/api/actions/resource-action-types.js +13 -0
  13. package/dist/api/constants.d.ts +6 -0
  14. package/dist/api/constants.d.ts.map +1 -0
  15. package/dist/api/constants.js +5 -0
  16. package/dist/api/contracts/i-entity-registry.d.ts +19 -0
  17. package/dist/api/contracts/i-entity-registry.d.ts.map +1 -0
  18. package/dist/api/contracts/i-entity-registry.js +1 -0
  19. package/dist/api/contracts/i-resource-registry.d.ts +19 -0
  20. package/dist/api/contracts/i-resource-registry.d.ts.map +1 -0
  21. package/dist/api/contracts/i-resource-registry.js +1 -0
  22. package/dist/api/index.d.ts +12 -0
  23. package/dist/api/index.d.ts.map +1 -0
  24. package/dist/api/index.js +15 -0
  25. package/dist/api/types/action-types.d.ts +34 -0
  26. package/dist/api/types/action-types.d.ts.map +1 -0
  27. package/dist/api/types/action-types.js +1 -0
  28. package/dist/api/types/resource-attributes.d.ts +43 -0
  29. package/dist/api/types/resource-attributes.d.ts.map +1 -0
  30. package/dist/api/types/resource-attributes.js +1 -0
  31. package/dist/api/types/resource-types.d.ts +20 -0
  32. package/dist/api/types/resource-types.d.ts.map +1 -0
  33. package/dist/api/types/resource-types.js +1 -0
  34. package/dist/api/utils/resource-attributes-util.d.ts +183 -0
  35. package/dist/api/utils/resource-attributes-util.d.ts.map +1 -0
  36. package/dist/api/utils/resource-attributes-util.js +280 -0
  37. package/dist/impl/autosave/index.d.ts +5 -0
  38. package/dist/impl/autosave/index.d.ts.map +1 -0
  39. package/dist/impl/autosave/index.js +4 -0
  40. package/dist/impl/autosave/resource-autosave-provider.d.ts +49 -0
  41. package/dist/impl/autosave/resource-autosave-provider.d.ts.map +1 -0
  42. package/dist/impl/autosave/resource-autosave-provider.js +112 -0
  43. package/dist/impl/index.d.ts +20 -0
  44. package/dist/impl/index.d.ts.map +1 -0
  45. package/dist/impl/index.js +20 -0
  46. package/dist/impl/middleware/entity-middleware.d.ts +13 -0
  47. package/dist/impl/middleware/entity-middleware.d.ts.map +1 -0
  48. package/dist/impl/middleware/entity-middleware.js +221 -0
  49. package/dist/impl/middleware/entity-sync-middleware.d.ts +7 -0
  50. package/dist/impl/middleware/entity-sync-middleware.d.ts.map +1 -0
  51. package/dist/impl/middleware/entity-sync-middleware.js +32 -0
  52. package/dist/impl/middleware/resource-middleware.d.ts +13 -0
  53. package/dist/impl/middleware/resource-middleware.d.ts.map +1 -0
  54. package/dist/impl/middleware/resource-middleware.js +97 -0
  55. package/dist/impl/middleware/sync-middleware.d.ts +12 -0
  56. package/dist/impl/middleware/sync-middleware.d.ts.map +1 -0
  57. package/dist/impl/middleware/sync-middleware.js +80 -0
  58. package/dist/impl/plugin/resource-plugin-factory.d.ts +31 -0
  59. package/dist/impl/plugin/resource-plugin-factory.d.ts.map +1 -0
  60. package/dist/impl/plugin/resource-plugin-factory.js +131 -0
  61. package/dist/impl/providers/mock-resource-provider.d.ts +147 -0
  62. package/dist/impl/providers/mock-resource-provider.d.ts.map +1 -0
  63. package/dist/impl/providers/mock-resource-provider.js +242 -0
  64. package/dist/impl/providers/rest-resource-provider.d.ts +51 -0
  65. package/dist/impl/providers/rest-resource-provider.d.ts.map +1 -0
  66. package/dist/impl/providers/rest-resource-provider.js +128 -0
  67. package/dist/impl/registry/entity-registry.d.ts +54 -0
  68. package/dist/impl/registry/entity-registry.d.ts.map +1 -0
  69. package/dist/impl/registry/entity-registry.js +51 -0
  70. package/dist/impl/registry/resource-registry.d.ts +80 -0
  71. package/dist/impl/registry/resource-registry.d.ts.map +1 -0
  72. package/dist/impl/registry/resource-registry.js +74 -0
  73. package/dist/index.d.ts +6 -0
  74. package/dist/index.d.ts.map +1 -0
  75. package/dist/index.js +5 -0
  76. package/dist/spi/config/endpoint-definition.d.ts +46 -0
  77. package/dist/spi/config/endpoint-definition.d.ts.map +1 -0
  78. package/dist/spi/config/endpoint-definition.js +1 -0
  79. package/dist/spi/config/entity-definition.d.ts +50 -0
  80. package/dist/spi/config/entity-definition.d.ts.map +1 -0
  81. package/dist/spi/config/entity-definition.js +1 -0
  82. package/dist/spi/config/plugin-config.d.ts +21 -0
  83. package/dist/spi/config/plugin-config.d.ts.map +1 -0
  84. package/dist/spi/config/plugin-config.js +1 -0
  85. package/dist/spi/index.d.ts +6 -0
  86. package/dist/spi/index.d.ts.map +1 -0
  87. package/dist/spi/index.js +7 -0
  88. package/dist/spi/providers/i-resource-provider.d.ts +42 -0
  89. package/dist/spi/providers/i-resource-provider.d.ts.map +1 -0
  90. package/dist/spi/providers/i-resource-provider.js +1 -0
  91. package/package.json +71 -0
@@ -0,0 +1,28 @@
1
+ import type { FetchEntityAction, UpdateEntityAction, DeleteEntityAction, CreateEntityAction, InvalidateEntityAction } from './entity-action-types';
2
+ import type { EntityKey } from '../types/resource-types';
3
+ /**
4
+ * Factory class for creating entity actions
5
+ */
6
+ export declare class EntityActionFactory {
7
+ /**
8
+ * Fetch entity by keys
9
+ */
10
+ fetch(entityId: string, keys: EntityKey, params?: any, path?: string | string[], id?: string): FetchEntityAction;
11
+ /**
12
+ * Update entity by path
13
+ */
14
+ update(entityId: string, path: string | string[], data: any, params?: any, id?: string): UpdateEntityAction;
15
+ /**
16
+ * Delete entity by path
17
+ */
18
+ delete(entityId: string, path: string | string[], params?: any, id?: string): DeleteEntityAction;
19
+ /**
20
+ * Create new entity
21
+ */
22
+ create(entityId: string, data: any, keys?: EntityKey, path?: string | string[], params?: any, id?: string): CreateEntityAction;
23
+ /**
24
+ * Invalidate entity cache
25
+ */
26
+ invalidate(entityId: string, path: string | string[], id?: string): InvalidateEntityAction;
27
+ }
28
+ //# sourceMappingURL=entity-action-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-action-factory.d.ts","sourceRoot":"","sources":["../../../src/api/actions/entity-action-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,kBAAkB,EAClB,sBAAsB,EACvB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AASzD;;GAEG;AACH,qBAAa,mBAAmB;IAC9B;;OAEG;IACH,KAAK,CACH,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,SAAS,EACf,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,iBAAiB;IAQpB;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,IAAI,EAAE,GAAG,EACT,MAAM,CAAC,EAAE,GAAG,EACZ,EAAE,CAAC,EAAE,MAAM,GACV,kBAAkB;IAQrB;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,MAAM,CAAC,EAAE,GAAG,EACZ,EAAE,CAAC,EAAE,MAAM,GACV,kBAAkB;IAQrB;;OAEG;IACH,MAAM,CACJ,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,GAAG,EACT,IAAI,CAAC,EAAE,SAAS,EAChB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,MAAM,CAAC,EAAE,GAAG,EACZ,EAAE,CAAC,EAAE,MAAM,GACV,kBAAkB;IAQrB;;OAEG;IACH,UAAU,CACR,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,EAAE,CAAC,EAAE,MAAM,GACV,sBAAsB;CAO1B"}
@@ -0,0 +1,62 @@
1
+ import { EntityActionTypes } from './entity-action-types';
2
+ /**
3
+ * Generate a simple unique ID
4
+ */
5
+ function generateId() {
6
+ return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
7
+ }
8
+ /**
9
+ * Factory class for creating entity actions
10
+ */
11
+ export class EntityActionFactory {
12
+ /**
13
+ * Fetch entity by keys
14
+ */
15
+ fetch(entityId, keys, params, path, id) {
16
+ return {
17
+ type: EntityActionTypes.FETCH_ENTITY,
18
+ id: id || generateId(),
19
+ payload: { entityId, keys, params, path }
20
+ };
21
+ }
22
+ /**
23
+ * Update entity by path
24
+ */
25
+ update(entityId, path, data, params, id) {
26
+ return {
27
+ type: EntityActionTypes.UPDATE_ENTITY,
28
+ id: id || generateId(),
29
+ payload: { entityId, path, data, params }
30
+ };
31
+ }
32
+ /**
33
+ * Delete entity by path
34
+ */
35
+ delete(entityId, path, params, id) {
36
+ return {
37
+ type: EntityActionTypes.DELETE_ENTITY,
38
+ id: id || generateId(),
39
+ payload: { entityId, path, params }
40
+ };
41
+ }
42
+ /**
43
+ * Create new entity
44
+ */
45
+ create(entityId, data, keys, path, params, id) {
46
+ return {
47
+ type: EntityActionTypes.CREATE_ENTITY,
48
+ id: id || generateId(),
49
+ payload: { entityId, data, keys, path, params }
50
+ };
51
+ }
52
+ /**
53
+ * Invalidate entity cache
54
+ */
55
+ invalidate(entityId, path, id) {
56
+ return {
57
+ type: EntityActionTypes.INVALIDATE_ENTITY,
58
+ id: id || generateId(),
59
+ payload: { entityId, path }
60
+ };
61
+ }
62
+ }
@@ -0,0 +1,104 @@
1
+ import type { EntityKey } from '../types/resource-types';
2
+ /**
3
+ * Entity action type constants
4
+ */
5
+ export declare enum EntityActionTypes {
6
+ FETCH_ENTITY = "@@entity/FETCH",
7
+ UPDATE_ENTITY = "@@entity/UPDATE",
8
+ DELETE_ENTITY = "@@entity/DELETE",
9
+ CREATE_ENTITY = "@@entity/CREATE",
10
+ INVALIDATE_ENTITY = "@@entity/INVALIDATE"
11
+ }
12
+ /**
13
+ * Fetch entity action - uses keys to identify entity
14
+ */
15
+ export interface FetchEntityAction {
16
+ type: EntityActionTypes.FETCH_ENTITY;
17
+ id: string;
18
+ payload: {
19
+ /** Entity type identifier */
20
+ entityId: string;
21
+ /** Entity keys (simple or composite) */
22
+ keys: EntityKey;
23
+ /** Optional additional params (passed to resource endpoint) */
24
+ params?: any;
25
+ /** Optional path override */
26
+ path?: string | string[];
27
+ };
28
+ meta?: {
29
+ [key: string]: any;
30
+ };
31
+ }
32
+ /**
33
+ * Update entity action - uses file path (keys are in file attributes)
34
+ */
35
+ export interface UpdateEntityAction {
36
+ type: EntityActionTypes.UPDATE_ENTITY;
37
+ id: string;
38
+ payload: {
39
+ /** Entity type identifier */
40
+ entityId: string;
41
+ /** File path where entity is stored */
42
+ path: string | string[];
43
+ /** Update data */
44
+ data: any;
45
+ /** Optional additional params */
46
+ params?: any;
47
+ };
48
+ meta?: {
49
+ [key: string]: any;
50
+ };
51
+ }
52
+ /**
53
+ * Delete entity action - uses file path
54
+ */
55
+ export interface DeleteEntityAction {
56
+ type: EntityActionTypes.DELETE_ENTITY;
57
+ id: string;
58
+ payload: {
59
+ /** Entity type identifier */
60
+ entityId: string;
61
+ /** File path where entity is stored */
62
+ path: string | string[];
63
+ /** Optional additional params */
64
+ params?: any;
65
+ };
66
+ meta?: {
67
+ [key: string]: any;
68
+ };
69
+ }
70
+ /**
71
+ * Create entity action - uses keys to generate path for new entity
72
+ */
73
+ export interface CreateEntityAction {
74
+ type: EntityActionTypes.CREATE_ENTITY;
75
+ id: string;
76
+ payload: {
77
+ /** Entity type identifier */
78
+ entityId: string;
79
+ /** Entity keys for new entity (may be partial, e.g., just tenantId) */
80
+ keys?: EntityKey;
81
+ /** Entity data */
82
+ data: any;
83
+ /** Optional path override */
84
+ path?: string | string[];
85
+ /** Optional additional params */
86
+ params?: any;
87
+ };
88
+ meta?: {
89
+ [key: string]: any;
90
+ };
91
+ }
92
+ /**
93
+ * Invalidate entity cache
94
+ */
95
+ export interface InvalidateEntityAction {
96
+ type: EntityActionTypes.INVALIDATE_ENTITY;
97
+ id: string;
98
+ payload: {
99
+ entityId: string;
100
+ path: string | string[];
101
+ };
102
+ }
103
+ export type EntityAction = FetchEntityAction | UpdateEntityAction | DeleteEntityAction | CreateEntityAction | InvalidateEntityAction;
104
+ //# sourceMappingURL=entity-action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entity-action-types.d.ts","sourceRoot":"","sources":["../../../src/api/actions/entity-action-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;GAEG;AACH,oBAAY,iBAAiB;IAE3B,YAAY,mBAAmB;IAG/B,aAAa,oBAAoB;IAGjC,aAAa,oBAAoB;IAGjC,aAAa,oBAAoB;IAGjC,iBAAiB,wBAAwB;CAC1C;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,iBAAiB,CAAC,YAAY,CAAC;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,6BAA6B;QAC7B,QAAQ,EAAE,MAAM,CAAC;QAEjB,wCAAwC;QACxC,IAAI,EAAE,SAAS,CAAC;QAEhB,+DAA+D;QAC/D,MAAM,CAAC,EAAE,GAAG,CAAC;QAEb,6BAA6B;QAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC1B,CAAC;IACF,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE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C,EAAE,GAAG,CAAC;KACd,CAAC;IACF,IAAI,CAAC,EAAE;QACL,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;KACpB,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,iBAAiB,CAAC,iBAAiB,CAAC;IAC1C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KACzB,CAAC;CACH;AAED,MAAM,MAAM,YAAY,GACpB,iBAAiB,GACjB,kBAAkB,GAClB,kBAAkB,GAClB,kBAAkB,GAClB,sBAAsB,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Entity action type constants
3
+ */
4
+ export var EntityActionTypes;
5
+ (function (EntityActionTypes) {
6
+ // Fetch entity by keys
7
+ EntityActionTypes["FETCH_ENTITY"] = "@@entity/FETCH";
8
+ // Update entity by path
9
+ EntityActionTypes["UPDATE_ENTITY"] = "@@entity/UPDATE";
10
+ // Delete entity by path
11
+ EntityActionTypes["DELETE_ENTITY"] = "@@entity/DELETE";
12
+ // Create new entity
13
+ EntityActionTypes["CREATE_ENTITY"] = "@@entity/CREATE";
14
+ // Invalidate entity cache
15
+ EntityActionTypes["INVALIDATE_ENTITY"] = "@@entity/INVALIDATE";
16
+ })(EntityActionTypes || (EntityActionTypes = {}));
@@ -0,0 +1,40 @@
1
+ import type { ResourceCallRequestAction, ResourceCallSuccessAction, ResourceCallFailureAction, InvalidateResourceAction } from './resource-action-types';
2
+ import type { ResourceOperation, ErrorObject } from '../types/resource-types';
3
+ /**
4
+ * Factory class for creating resource actions
5
+ */
6
+ export declare class ResourceActionFactory {
7
+ /**
8
+ * Create a resource call request action
9
+ */
10
+ callRequest(endpointId: string, operation: ResourceOperation, params?: any, path?: string | string[], id?: string): ResourceCallRequestAction;
11
+ /**
12
+ * Convenience method for fetch operation
13
+ */
14
+ fetch(endpointId: string, params?: any, path?: string | string[], id?: string): ResourceCallRequestAction;
15
+ /**
16
+ * Convenience method for create operation
17
+ */
18
+ create(endpointId: string, params?: any, path?: string | string[], id?: string): ResourceCallRequestAction;
19
+ /**
20
+ * Convenience method for update operation
21
+ */
22
+ update(endpointId: string, params?: any, path?: string | string[], id?: string): ResourceCallRequestAction;
23
+ /**
24
+ * Convenience method for delete operation
25
+ */
26
+ delete(endpointId: string, params?: any, path?: string | string[], id?: string): ResourceCallRequestAction;
27
+ /**
28
+ * Create a success action
29
+ */
30
+ callSuccess(endpointId: string, path: string | string[], data: any, metadata: any | undefined, request: ResourceCallRequestAction): ResourceCallSuccessAction;
31
+ /**
32
+ * Create a failure action
33
+ */
34
+ callFailure(endpointId: string, path: string | string[], error: ErrorObject, request: ResourceCallRequestAction): ResourceCallFailureAction;
35
+ /**
36
+ * Create invalidate action
37
+ */
38
+ invalidate(path: string | string[]): InvalidateResourceAction;
39
+ }
40
+ //# sourceMappingURL=resource-action-factory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-action-factory.d.ts","sourceRoot":"","sources":["../../../src/api/actions/resource-action-factory.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,yBAAyB,EACzB,yBAAyB,EACzB,yBAAyB,EACzB,wBAAwB,EACzB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAU9E;;GAEG;AACH,qBAAa,qBAAqB;IAChC;;OAEG;IACH,WAAW,CACT,UAAU,EAAE,MAAM,EAClB,SAAS,EAAE,iBAAiB,EAC5B,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,yBAAyB;IAa5B;;OAEG;IACH,KAAK,CACH,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,yBAAyB;IAI5B;;OAEG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,yBAAyB;IAI5B;;OAEG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,yBAAyB;IAI5B;;OAEG;IACH,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,CAAC,EAAE,GAAG,EACZ,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,EACxB,EAAE,CAAC,EAAE,MAAM,GACV,yBAAyB;IAI5B;;OAEG;IACH,WAAW,CACT,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,IAAI,EAAE,GAAG,EACT,QAAQ,EAAE,GAAG,GAAG,SAAS,EACzB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB;IAc5B;;OAEG;IACH,WAAW,CACT,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,EACvB,KAAK,EAAE,WAAW,EAClB,OAAO,EAAE,yBAAyB,GACjC,yBAAyB;IAa5B;;OAEG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,wBAAwB;CAO9D"}
@@ -0,0 +1,93 @@
1
+ import { ResourceActionTypes as Types } from './resource-action-types';
2
+ /**
3
+ * Generate a simple unique ID
4
+ * In production, this could use uuid package, but for now use timestamp + random
5
+ */
6
+ function generateId() {
7
+ return `${Date.now()}-${Math.random().toString(36).substr(2, 9)}`;
8
+ }
9
+ /**
10
+ * Factory class for creating resource actions
11
+ */
12
+ export class ResourceActionFactory {
13
+ /**
14
+ * Create a resource call request action
15
+ */
16
+ callRequest(endpointId, operation, params, path, id) {
17
+ return {
18
+ type: Types.RESOURCE_CALL_REQUEST,
19
+ id: id || generateId(),
20
+ payload: {
21
+ endpointId,
22
+ operation,
23
+ path,
24
+ params
25
+ }
26
+ };
27
+ }
28
+ /**
29
+ * Convenience method for fetch operation
30
+ */
31
+ fetch(endpointId, params, path, id) {
32
+ return this.callRequest(endpointId, 'fetch', params, path, id);
33
+ }
34
+ /**
35
+ * Convenience method for create operation
36
+ */
37
+ create(endpointId, params, path, id) {
38
+ return this.callRequest(endpointId, 'create', params, path, id);
39
+ }
40
+ /**
41
+ * Convenience method for update operation
42
+ */
43
+ update(endpointId, params, path, id) {
44
+ return this.callRequest(endpointId, 'update', params, path, id);
45
+ }
46
+ /**
47
+ * Convenience method for delete operation
48
+ */
49
+ delete(endpointId, params, path, id) {
50
+ return this.callRequest(endpointId, 'delete', params, path, id);
51
+ }
52
+ /**
53
+ * Create a success action
54
+ */
55
+ callSuccess(endpointId, path, data, metadata, request) {
56
+ return {
57
+ type: Types.RESOURCE_CALL_SUCCESS,
58
+ id: generateId(),
59
+ payload: {
60
+ endpointId,
61
+ path,
62
+ data,
63
+ metadata
64
+ },
65
+ request
66
+ };
67
+ }
68
+ /**
69
+ * Create a failure action
70
+ */
71
+ callFailure(endpointId, path, error, request) {
72
+ return {
73
+ type: Types.RESOURCE_CALL_FAILURE,
74
+ id: generateId(),
75
+ payload: {
76
+ endpointId,
77
+ path,
78
+ error
79
+ },
80
+ request
81
+ };
82
+ }
83
+ /**
84
+ * Create invalidate action
85
+ */
86
+ invalidate(path) {
87
+ return {
88
+ type: Types.INVALIDATE_RESOURCE,
89
+ id: generateId(),
90
+ payload: { path }
91
+ };
92
+ }
93
+ }
@@ -0,0 +1,105 @@
1
+ import type { ResourceOperation, ErrorObject } from '../types/resource-types';
2
+ /**
3
+ * Resource action type constants
4
+ */
5
+ export declare enum ResourceActionTypes {
6
+ RESOURCE_CALL_REQUEST = "@@resource/CALL_REQUEST",
7
+ RESOURCE_CALL_SUCCESS = "@@resource/CALL_SUCCESS",
8
+ RESOURCE_CALL_FAILURE = "@@resource/CALL_FAILURE",
9
+ INVALIDATE_RESOURCE = "@@resource/INVALIDATE"
10
+ }
11
+ /**
12
+ * Generic resource call request action
13
+ */
14
+ export interface ResourceCallRequestAction {
15
+ /** Action type */
16
+ type: ResourceActionTypes.RESOURCE_CALL_REQUEST;
17
+ /** Unique action ID */
18
+ id: string;
19
+ /** Action payload */
20
+ payload: {
21
+ /** Endpoint ID from registry */
22
+ endpointId: string;
23
+ /** Operation type */
24
+ operation: ResourceOperation;
25
+ /**
26
+ * Target file path in store FS where result should be bound
27
+ * If not provided, uses endpoint's defaultFolder + auto-generated filename
28
+ */
29
+ path?: string | string[];
30
+ /** Operation-specific parameters (passed to payloadMapper) */
31
+ params?: any;
32
+ };
33
+ /** Optional metadata */
34
+ meta?: {
35
+ /** Additional context */
36
+ [key: string]: any;
37
+ };
38
+ }
39
+ /**
40
+ * Generic resource call success action
41
+ */
42
+ export interface ResourceCallSuccessAction {
43
+ /** Action type */
44
+ type: ResourceActionTypes.RESOURCE_CALL_SUCCESS;
45
+ /** Unique action ID */
46
+ id: string;
47
+ /** Action payload */
48
+ payload: {
49
+ /** Endpoint ID */
50
+ endpointId: string;
51
+ /** File path where data is stored */
52
+ path: string | string[];
53
+ /** Response data */
54
+ data: any;
55
+ /** Response metadata */
56
+ metadata?: any;
57
+ };
58
+ /** Reference to triggering request action */
59
+ request: ResourceCallRequestAction;
60
+ /** Optional metadata */
61
+ meta?: {
62
+ [key: string]: any;
63
+ };
64
+ /** Index signature for Redux compatibility */
65
+ [key: string]: any;
66
+ }
67
+ /**
68
+ * Generic resource call failure action
69
+ */
70
+ export interface ResourceCallFailureAction {
71
+ /** Action type */
72
+ type: ResourceActionTypes.RESOURCE_CALL_FAILURE;
73
+ /** Unique action ID */
74
+ id: string;
75
+ /** Action payload */
76
+ payload: {
77
+ /** Endpoint ID */
78
+ endpointId: string;
79
+ /** File path where error state is stored */
80
+ path: string | string[];
81
+ /** Error information */
82
+ error: ErrorObject;
83
+ };
84
+ /** Reference to triggering request action */
85
+ request: ResourceCallRequestAction;
86
+ /** Optional metadata */
87
+ meta?: {
88
+ [key: string]: any;
89
+ };
90
+ /** Index signature for Redux compatibility */
91
+ [key: string]: any;
92
+ }
93
+ /**
94
+ * Invalidate resource cache action
95
+ */
96
+ export interface InvalidateResourceAction {
97
+ type: ResourceActionTypes.INVALIDATE_RESOURCE;
98
+ id: string;
99
+ payload: {
100
+ /** Path to invalidate */
101
+ path: string | string[];
102
+ };
103
+ }
104
+ export type ResourceAction = ResourceCallRequestAction | ResourceCallSuccessAction | ResourceCallFailureAction | InvalidateResourceAction;
105
+ //# sourceMappingURL=resource-action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resource-action-types.d.ts","sourceRoot":"","sources":["../../../src/api/actions/resource-action-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AAE9E;;GAEG;AACH,oBAAY,mBAAmB;IAE7B,qBAAqB,4BAA4B;IAGjD,qBAAqB,4BAA4B;IACjD,qBAAqB,4BAA4B;IAGjD,mBAAmB,0BAA0B;CAC9C;AAED;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACxC,kBAAkB;IAClB,IAAI,EAAE,mBAAmB,CAAC,qBAAqB,CAAC;IAEhD,uBAAuB;IACvB,EAAE,EAAE,MAAM,CAAC;IAEX,qBAAqB;IACrB,OAAO,EAAE;QACP,gCAAgC;QAChC,UAAU,EAAE,MAAM,CAAC;QAEnB,qBAAqB;QACrB,SAAS,EAAE,iBAAiB,CAAC;QAE7B;;;WAGG;QACH,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAEzB,8DAA8D;QAC9D,MAAM,CAAC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KACpB,CAAC;IAEF,8CAA8C;IAC9C,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,mBAAmB,CAAC,mBAAmB,CAAC;IAC9C,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE;QACP,yBAAyB;QACzB,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KACzB,CAAC;CACH;AAED,MAAM,MAAM,cAAc,GACtB,yBAAyB,GACzB,yBAAyB,GACzB,yBAAyB,GACzB,wBAAwB,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Resource action type constants
3
+ */
4
+ export var ResourceActionTypes;
5
+ (function (ResourceActionTypes) {
6
+ // Request action (single type for all operations)
7
+ ResourceActionTypes["RESOURCE_CALL_REQUEST"] = "@@resource/CALL_REQUEST";
8
+ // Response actions (generic)
9
+ ResourceActionTypes["RESOURCE_CALL_SUCCESS"] = "@@resource/CALL_SUCCESS";
10
+ ResourceActionTypes["RESOURCE_CALL_FAILURE"] = "@@resource/CALL_FAILURE";
11
+ // Invalidate cache
12
+ ResourceActionTypes["INVALIDATE_RESOURCE"] = "@@resource/INVALIDATE";
13
+ })(ResourceActionTypes || (ResourceActionTypes = {}));
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Extension state key for remote resource plugin
3
+ * Used to store resource and entity attributes in FileSystemNode.state.extensionStates
4
+ */
5
+ export declare const REMOTE_RESOURCE_EXTENSION_KEY = "ui-remote-resource";
6
+ //# sourceMappingURL=constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/api/constants.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,eAAO,MAAM,6BAA6B,uBAAuB,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Extension state key for remote resource plugin
3
+ * Used to store resource and entity attributes in FileSystemNode.state.extensionStates
4
+ */
5
+ export const REMOTE_RESOURCE_EXTENSION_KEY = 'ui-remote-resource';
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Public read-only interface for entity registry
3
+ * Used by client code to query registered entities
4
+ */
5
+ export interface IEntityRegistry {
6
+ /**
7
+ * Check if entity exists
8
+ */
9
+ hasEntity(id: string): boolean;
10
+ /**
11
+ * Get entity definition by ID (read-only)
12
+ */
13
+ getEntity(id: string): any | undefined;
14
+ /**
15
+ * Get all registered entities (read-only)
16
+ */
17
+ getAllEntities(): any[];
18
+ }
19
+ //# sourceMappingURL=i-entity-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-entity-registry.d.ts","sourceRoot":"","sources":["../../../src/api/contracts/i-entity-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAE/B;;OAEG;IACH,SAAS,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IAEvC;;OAEG;IACH,cAAc,IAAI,GAAG,EAAE,CAAC;CACzB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Public read-only interface for resource registry
3
+ * Used by client code to query registered endpoints
4
+ */
5
+ export interface IResourceRegistry {
6
+ /**
7
+ * Check if endpoint exists
8
+ */
9
+ hasEndpoint(id: string): boolean;
10
+ /**
11
+ * Get endpoint definition by ID (read-only)
12
+ */
13
+ getEndpoint(id: string): any | undefined;
14
+ /**
15
+ * Get all registered endpoints (read-only)
16
+ */
17
+ getAllEndpoints(): any[];
18
+ }
19
+ //# sourceMappingURL=i-resource-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"i-resource-registry.d.ts","sourceRoot":"","sources":["../../../src/api/contracts/i-resource-registry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC;IAEjC;;OAEG;IACH,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,GAAG,GAAG,SAAS,CAAC;IAEzC;;OAEG;IACH,eAAe,IAAI,GAAG,EAAE,CAAC;CAC1B"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,12 @@
1
+ export * from './constants';
2
+ export * from './types/resource-types';
3
+ export * from './types/resource-attributes';
4
+ export type { BaseAction, ResourceCallAction } from './types/action-types';
5
+ export * from './actions/resource-action-types';
6
+ export * from './actions/resource-action-factory';
7
+ export * from './actions/entity-action-types';
8
+ export * from './actions/entity-action-factory';
9
+ export * from './utils/resource-attributes-util';
10
+ export * from './contracts/i-resource-registry';
11
+ export * from './contracts/i-entity-registry';
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AACA,cAAc,aAAa,CAAC;AAG5B,cAAc,wBAAwB,CAAC;AACvC,cAAc,6BAA6B,CAAC;AAC5C,YAAY,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAG3E,cAAc,iCAAiC,CAAC;AAChD,cAAc,mCAAmC,CAAC;AAClD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,iCAAiC,CAAC;AAGhD,cAAc,kCAAkC,CAAC;AAGjD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+BAA+B,CAAC"}
@@ -0,0 +1,15 @@
1
+ // Constants
2
+ export * from './constants';
3
+ // Types
4
+ export * from './types/resource-types';
5
+ export * from './types/resource-attributes';
6
+ // Actions (Clients use these to dispatch)
7
+ export * from './actions/resource-action-types';
8
+ export * from './actions/resource-action-factory';
9
+ export * from './actions/entity-action-types';
10
+ export * from './actions/entity-action-factory';
11
+ // Utils (Clients use this to access attributes)
12
+ export * from './utils/resource-attributes-util';
13
+ // Contracts (Read-only registry access for clients)
14
+ export * from './contracts/i-resource-registry';
15
+ export * from './contracts/i-entity-registry';
@@ -0,0 +1,34 @@
1
+ import type { ResourceOperation, EntityKey } from './resource-types';
2
+ /**
3
+ * Base action structure (for type checking in mappers/transformers)
4
+ */
5
+ export interface BaseAction {
6
+ type: string;
7
+ id: string;
8
+ payload: Record<string, any>;
9
+ meta?: Record<string, any>;
10
+ }
11
+ /**
12
+ * Resource call action (used by payload mappers and response transformers)
13
+ */
14
+ export interface ResourceCallAction extends BaseAction {
15
+ payload: {
16
+ endpointId: string;
17
+ operation: ResourceOperation;
18
+ path?: string | string[];
19
+ params?: any;
20
+ };
21
+ }
22
+ /**
23
+ * Entity action (used by entity middleware)
24
+ */
25
+ export interface EntityAction extends BaseAction {
26
+ payload: {
27
+ entityId: string;
28
+ keys?: EntityKey;
29
+ path?: string | string[];
30
+ data?: any;
31
+ params?: any;
32
+ };
33
+ }
34
+ //# sourceMappingURL=action-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-types.d.ts","sourceRoot":"","sources":["../../../src/api/types/action-types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAErE;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,UAAU;IACpD,OAAO,EAAE;QACP,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,iBAAiB,CAAC;QAC7B,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACzB,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,UAAU;IAC9C,OAAO,EAAE;QACP,QAAQ,EAAE,MAAM,CAAC;QACjB,IAAI,CAAC,EAAE,SAAS,CAAC;QACjB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QACzB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,MAAM,CAAC,EAAE,GAAG,CAAC;KACd,CAAC;CACH"}
@@ -0,0 +1 @@
1
+ export {};