@openhi/platform 0.0.0 → 0.0.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 (40) hide show
  1. package/lib/{openhi.d.ts → index.d.mts} +42 -6
  2. package/lib/index.d.ts +205 -2
  3. package/lib/index.js +847 -17
  4. package/lib/index.js.map +1 -0
  5. package/lib/index.mjs +840 -0
  6. package/lib/index.mjs.map +1 -0
  7. package/package.json +33 -24
  8. package/lib/openhi.js +0 -108
  9. package/lib/service.d.ts +0 -36
  10. package/lib/service.js +0 -203
  11. package/lib/templates/generate-templates.d.ts +0 -5
  12. package/lib/templates/generate-templates.js +0 -45
  13. package/lib/templates/service-template.d.ts +0 -33
  14. package/lib/templates/service-template.js +0 -42
  15. package/lib/templates/src/README.md.d.ts +0 -5
  16. package/lib/templates/src/README.md.js +0 -19
  17. package/lib/templates/src/app-test.d.ts +0 -5
  18. package/lib/templates/src/app-test.js +0 -61
  19. package/lib/templates/src/app.d.ts +0 -5
  20. package/lib/templates/src/app.js +0 -27
  21. package/lib/templates/src/config.d.ts +0 -5
  22. package/lib/templates/src/config.js +0 -23
  23. package/lib/templates/src/data/README.md.d.ts +0 -5
  24. package/lib/templates/src/data/README.md.js +0 -19
  25. package/lib/templates/src/data/models/README.md.d.ts +0 -5
  26. package/lib/templates/src/data/models/README.md.js +0 -19
  27. package/lib/templates/src/infrastructure/README.md.d.ts +0 -5
  28. package/lib/templates/src/infrastructure/README.md.js +0 -19
  29. package/lib/templates/src/integrations/README.md.d.ts +0 -5
  30. package/lib/templates/src/integrations/README.md.js +0 -19
  31. package/lib/templates/src/main.d.ts +0 -5
  32. package/lib/templates/src/main.js +0 -15
  33. package/lib/templates/src/workflows/README.md.d.ts +0 -5
  34. package/lib/templates/src/workflows/README.md.js +0 -19
  35. package/lib/workflows/aws-teardown-workflow.d.ts +0 -13
  36. package/lib/workflows/aws-teardown-workflow.js +0 -222
  37. package/lib/workflows/build-dev-workflow.d.ts +0 -12
  38. package/lib/workflows/build-dev-workflow.js +0 -48
  39. package/lib/workflows/build-stage-workflow.d.ts +0 -12
  40. package/lib/workflows/build-stage-workflow.js +0 -60
@@ -1,8 +1,42 @@
1
- import { MonorepoProject, MonorepoProjectOptions } from "@codedrifters/configulator";
2
- import { OpenHiConfig } from "@openhi/config";
3
- import { SetOptional } from "type-fest";
4
- import { OpenHiService } from "./service";
5
- export interface OpenHiOptions {
1
+ import { MonorepoProjectOptions, MonorepoProject } from '@codedrifters/configulator';
2
+ import { OpenHiConfig } from '@openhi/config';
3
+ import { ValueOf, SetOptional } from 'type-fest';
4
+ import { awscdk } from 'projen';
5
+
6
+ declare const OPEN_HI_SERVICE_TYPE: {
7
+ readonly AUTH: "auth";
8
+ readonly CORE: "core";
9
+ readonly DATA_SERVICE: "data";
10
+ readonly GLOBAL: "global";
11
+ readonly INTEGRATION: "integration";
12
+ readonly REST_API: "rest-api";
13
+ };
14
+ interface OpenHiServiceOptions {
15
+ /**
16
+ * Configuration for this service.
17
+ *
18
+ * @default uses the global default config.
19
+ */
20
+ readonly config: OpenHiConfig;
21
+ /**
22
+ * What type of service is this?
23
+ */
24
+ readonly type: ValueOf<typeof OPEN_HI_SERVICE_TYPE>;
25
+ }
26
+ declare class OpenHiService {
27
+ openHi: OpenHi;
28
+ id: string;
29
+ options: OpenHiServiceOptions;
30
+ readonly project: awscdk.AwsCdkTypeScriptApp;
31
+ constructor(openHi: OpenHi, id: string, options: OpenHiServiceOptions);
32
+ private addDeploymentTarget;
33
+ get constructName(): string;
34
+ get outDir(): string;
35
+ get serviceName(): string;
36
+ get typeDir(): Array<string>;
37
+ }
38
+
39
+ interface OpenHiOptions {
6
40
  /*****************************************************************************
7
41
  *
8
42
  * Root Project Configuration Options
@@ -50,7 +84,7 @@ export interface OpenHiOptions {
50
84
  */
51
85
  readonly dataServiceConfig?: OpenHiConfig;
52
86
  }
53
- export declare class OpenHi {
87
+ declare class OpenHi {
54
88
  /**
55
89
  * Final options used to build this instance.
56
90
  */
@@ -86,3 +120,5 @@ export declare class OpenHi {
86
120
  readonly data: OpenHiService;
87
121
  constructor(options?: OpenHiOptions);
88
122
  }
123
+
124
+ export { OPEN_HI_SERVICE_TYPE, OpenHi, type OpenHiOptions, OpenHiService, type OpenHiServiceOptions };
package/lib/index.d.ts CHANGED
@@ -1,2 +1,205 @@
1
- export * from "./openhi";
2
- export * from "./service";
1
+ import { MonorepoProjectOptions, MonorepoProject } from '@codedrifters/configulator';
2
+ import { SetOptional, ValueOf } from 'type-fest';
3
+ import { awscdk } from 'projen';
4
+
5
+ /*******************************************************************************
6
+ *
7
+ * OpenHi Config
8
+ *
9
+ * These types are kept in their own package to prevent dependency conflicts and
10
+ * conditions between @openhi/constructs and @openhi/platform.
11
+ *
12
+ ******************************************************************************/
13
+ /**
14
+ * Stage Types
15
+ *
16
+ * What stage of deployment is this? Dev, staging, or prod?
17
+ */
18
+ declare const OPEN_HI_STAGE: {
19
+ /**
20
+ * Development environment, typically used for testing and development.
21
+ */
22
+ readonly DEV: "dev";
23
+ /**
24
+ * Staging environment, used for pre-production testing.
25
+ */
26
+ readonly STAGE: "stage";
27
+ /**
28
+ * Production environment, used for live deployments.
29
+ */
30
+ readonly PROD: "prod";
31
+ };
32
+ /**
33
+ * Deployment Target Role
34
+ *
35
+ * Is this (account, region) the primary or a secondary deployment target for the stage?
36
+ * Works for both multi-region (different regions) and cellular (same region, different accounts).
37
+ */
38
+ declare const OPEN_HI_DEPLOYMENT_TARGET_ROLE: {
39
+ /**
40
+ * The primary deployment target for this stage (main account/region).
41
+ * For example, the base DynamoDB region for global tables.
42
+ */
43
+ readonly PRIMARY: "primary";
44
+ /**
45
+ * A secondary deployment target for this stage (additional account/region).
46
+ * For example, a replica region for a global DynamoDB table, or another cell in the same region.
47
+ */
48
+ readonly SECONDARY: "secondary";
49
+ };
50
+ interface OpenHiEnvironmentConfig {
51
+ account: string;
52
+ region: string;
53
+ /**
54
+ * Route53 zone containing DNS for this service.
55
+ */
56
+ hostedZoneId?: string;
57
+ zoneName?: string;
58
+ }
59
+ /**
60
+ * Represents the configuration for OpenHi services across different stages and
61
+ * deployment targets.
62
+ */
63
+ interface OpenHiConfig {
64
+ versions?: {
65
+ cdk?: {
66
+ cdkLibVersion?: string;
67
+ cdkCliVersion?: string;
68
+ };
69
+ };
70
+ deploymentTargets?: {
71
+ [OPEN_HI_STAGE.DEV]?: {
72
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
73
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
74
+ };
75
+ [OPEN_HI_STAGE.STAGE]?: {
76
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
77
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
78
+ };
79
+ [OPEN_HI_STAGE.PROD]?: {
80
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.PRIMARY]?: OpenHiEnvironmentConfig;
81
+ [OPEN_HI_DEPLOYMENT_TARGET_ROLE.SECONDARY]?: Array<OpenHiEnvironmentConfig>;
82
+ };
83
+ };
84
+ }
85
+
86
+ declare const OPEN_HI_SERVICE_TYPE: {
87
+ readonly AUTH: "auth";
88
+ readonly CORE: "core";
89
+ readonly DATA_SERVICE: "data";
90
+ readonly GLOBAL: "global";
91
+ readonly INTEGRATION: "integration";
92
+ readonly REST_API: "rest-api";
93
+ };
94
+ interface OpenHiServiceOptions {
95
+ /**
96
+ * Configuration for this service.
97
+ *
98
+ * @default uses the global default config.
99
+ */
100
+ readonly config: OpenHiConfig;
101
+ /**
102
+ * What type of service is this?
103
+ */
104
+ readonly type: ValueOf<typeof OPEN_HI_SERVICE_TYPE>;
105
+ }
106
+ declare class OpenHiService {
107
+ openHi: OpenHi;
108
+ id: string;
109
+ options: OpenHiServiceOptions;
110
+ readonly project: awscdk.AwsCdkTypeScriptApp;
111
+ constructor(openHi: OpenHi, id: string, options: OpenHiServiceOptions);
112
+ private addDeploymentTarget;
113
+ get constructName(): string;
114
+ get outDir(): string;
115
+ get serviceName(): string;
116
+ get typeDir(): Array<string>;
117
+ }
118
+
119
+ interface OpenHiOptions {
120
+ /*****************************************************************************
121
+ *
122
+ * Root Project Configuration Options
123
+ *
124
+ * Configuration options for the root monorepo project that contains all
125
+ * OpenHi services and coordinate releases and builds.
126
+ *
127
+ ****************************************************************************/
128
+ readonly rootProjectOptions?: SetOptional<MonorepoProjectOptions, "name">;
129
+ /**
130
+ * Monorepo root project, if using an existing project.
131
+ */
132
+ readonly rootProject?: MonorepoProject;
133
+ /*****************************************************************************
134
+ *
135
+ * Service Configuration Options
136
+ *
137
+ * These options are used to configure the various services within the OpenHi
138
+ * framework. Each service can have its own configuration settings, which will
139
+ * be merged with the default configuration.
140
+ *
141
+ ****************************************************************************/
142
+ /**
143
+ * Default configuration used in all services with undefined configs.
144
+ */
145
+ readonly defaultConfig?: OpenHiConfig;
146
+ /**
147
+ * Global Service Config
148
+ */
149
+ readonly globalServiceConfig?: OpenHiConfig;
150
+ /**
151
+ * Auth Service Config
152
+ */
153
+ readonly authServiceConfig?: OpenHiConfig;
154
+ /**
155
+ * Rest API Service Config
156
+ */
157
+ readonly restApiServiceConfig?: OpenHiConfig;
158
+ /**
159
+ * Core Service Config
160
+ */
161
+ readonly coreServiceConfig?: OpenHiConfig;
162
+ /**
163
+ * Data Service Config (DynamoDB FHIR store, S3, etc.)
164
+ */
165
+ readonly dataServiceConfig?: OpenHiConfig;
166
+ }
167
+ declare class OpenHi {
168
+ /**
169
+ * Final options used to build this instance.
170
+ */
171
+ options: OpenHiOptions;
172
+ /**
173
+ * Monorepo root project, either passed in as an argument or generated in
174
+ * this component
175
+ */
176
+ readonly rootProject?: MonorepoProject;
177
+ /**
178
+ * Test identifier for this instance.
179
+ */
180
+ readonly id: string;
181
+ /**
182
+ * Global service (deployed first; Core and data services depend on it).
183
+ */
184
+ readonly global: OpenHiService;
185
+ /**
186
+ * Auth service (deployed before Core; Core and data services depend on it).
187
+ */
188
+ readonly auth: OpenHiService;
189
+ /**
190
+ * Rest API service
191
+ */
192
+ readonly restApi: OpenHiService;
193
+ /**
194
+ * Core service
195
+ */
196
+ readonly core: OpenHiService;
197
+ /**
198
+ * Data service (DynamoDB FHIR store, S3, and other persistence).
199
+ */
200
+ readonly data: OpenHiService;
201
+ constructor(options?: OpenHiOptions);
202
+ }
203
+
204
+ export { OPEN_HI_SERVICE_TYPE, OpenHi, OpenHiService };
205
+ export type { OpenHiOptions, OpenHiServiceOptions };