processfocus 0.1.0-next.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.md +28 -0
- package/README.md +14 -0
- package/dist/auth-FmXptohB.mjs +275 -0
- package/dist/auth-config/src/lib/authentication-config.d.ts +146 -0
- package/dist/auth-config/src/lib/custom-entities-config.d.ts +47 -0
- package/dist/auth-config/src/lib/policies-config.d.ts +52 -0
- package/dist/auth-config/src/lib/provider-types.d.ts +194 -0
- package/dist/auth.d.ts +4 -0
- package/dist/auth.mjs +2 -0
- package/dist/business-calendar/src/index.d.ts +10 -0
- package/dist/business-calendar/src/lib/calendar-config.d.ts +163 -0
- package/dist/business-calendar/src/lib/calendar-period.d.ts +88 -0
- package/dist/business-calendar/src/lib/calendar-service-impl.d.ts +19 -0
- package/dist/business-calendar/src/lib/calendar-service.d.ts +215 -0
- package/dist/business-calendar/src/lib/datetime-utils.d.ts +30 -0
- package/dist/business-calendar/src/lib/duration-calculator.d.ts +49 -0
- package/dist/business-calendar/src/lib/errors.d.ts +69 -0
- package/dist/business-calendar/src/lib/holiday-calculator.d.ts +61 -0
- package/dist/business-calendar/src/lib/holidays.d.ts +141 -0
- package/dist/business-calendar/src/lib/types.d.ts +110 -0
- package/dist/calendar.d.ts +1 -0
- package/dist/calendar.mjs +1204 -0
- package/dist/form-client-representation/src/index.d.ts +6 -0
- package/dist/form-client-representation/src/lib/as-client-representation.d.ts +31 -0
- package/dist/form-client-representation/src/lib/client-form-definition.d.ts +17 -0
- package/dist/form-client-representation/src/lib/extract-annotations.d.ts +20 -0
- package/dist/form-client-representation/src/lib/plugin-registry.d.ts +6 -0
- package/dist/form-client-representation/src/lib/types.d.ts +239 -0
- package/dist/form-client-representation/src/lib/walker.d.ts +68 -0
- package/dist/form-rule/src/index.d.ts +3 -0
- package/dist/form-rule/src/lib/evaluator.d.ts +2 -0
- package/dist/form-rule/src/lib/paths.d.ts +9 -0
- package/dist/form-rule/src/lib/types.d.ts +89 -0
- package/dist/form-schema/src/index.d.ts +8 -0
- package/dist/form-schema/src/lib/annotation-helpers.d.ts +8 -0
- package/dist/form-schema/src/lib/deferred-value.d.ts +10 -0
- package/dist/form-schema/src/lib/email.d.ts +23 -0
- package/dist/form-schema/src/lib/field-count.d.ts +32 -0
- package/dist/form-schema/src/lib/form-annotations.d.ts +25 -0
- package/dist/form-schema/src/lib/form-schema.d.ts +459 -0
- package/dist/form-schema/src/lib/phone.d.ts +4 -0
- package/dist/form-schema/src/lib/property-signature.d.ts +3 -0
- package/dist/form-submission-schema/src/index.d.ts +2 -0
- package/dist/form-submission-schema/src/lib/form-submission-schema.d.ts +49 -0
- package/dist/form-submission-schema/src/lib/schema-defaults.d.ts +16 -0
- package/dist/forms.d.ts +1 -0
- package/dist/forms.mjs +2 -0
- package/dist/frontend-manifest/src/index.d.ts +2 -0
- package/dist/frontend-manifest/src/lib/browser-plugin-artifact.d.ts +25 -0
- package/dist/frontend-manifest/src/lib/frontend-manifest.d.ts +83 -0
- package/dist/frontend-plugin-host/src/index.d.ts +2 -0
- package/dist/frontend-plugin-host/src/lib/frontend-plugin-host.d.ts +124 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.mjs +3780 -0
- package/dist/manifest.d.ts +2 -0
- package/dist/manifest.mjs +5 -0
- package/dist/paths-BkzLn-rG.mjs +282 -0
- package/dist/plugin.d.ts +3 -0
- package/dist/plugin.mjs +84 -0
- package/dist/process/src/lib/app-icons.d.ts +52 -0
- package/dist/process/src/lib/brands.d.ts +20 -0
- package/dist/process/src/lib/document-store.d.ts +30 -0
- package/dist/process/src/lib/execution-failure-notifications.d.ts +14 -0
- package/dist/process/src/lib/flow-context.d.ts +181 -0
- package/dist/process/src/lib/flow-path.d.ts +123 -0
- package/dist/process/src/lib/form-authoring.d.ts +19 -0
- package/dist/process/src/lib/form-decoration.d.ts +13 -0
- package/dist/process/src/lib/form-defaults.d.ts +5 -0
- package/dist/process/src/lib/form.d.ts +557 -0
- package/dist/process/src/lib/invitation.d.ts +35 -0
- package/dist/process/src/lib/list.d.ts +447 -0
- package/dist/process/src/lib/lookup-accessor.d.ts +68 -0
- package/dist/process/src/lib/node_step.d.ts +68 -0
- package/dist/process/src/lib/org-unit.d.ts +53 -0
- package/dist/process/src/lib/org-utils.d.ts +56 -0
- package/dist/process/src/lib/organisation-frontend-plugin-manifest.d.ts +33 -0
- package/dist/process/src/lib/organisation.d.ts +166 -0
- package/dist/process/src/lib/phase.d.ts +16 -0
- package/dist/process/src/lib/process.d.ts +196 -0
- package/dist/process/src/lib/public-form-branding.d.ts +27 -0
- package/dist/process/src/lib/role.d.ts +29 -0
- package/dist/process/src/lib/schedule.d.ts +239 -0
- package/dist/process/src/lib/sla.d.ts +84 -0
- package/dist/process/src/lib/stats-view.d.ts +68 -0
- package/dist/process/src/lib/step.d.ts +130 -0
- package/dist/process/src/lib/system-step-executor.d.ts +130 -0
- package/dist/process/src/lib/system-step.d.ts +248 -0
- package/dist/sdk/src/auth.d.ts +4 -0
- package/dist/sdk/src/calendar.d.ts +1 -0
- package/dist/sdk/src/forms.d.ts +1 -0
- package/dist/sdk/src/index.d.ts +26 -0
- package/dist/sdk/src/manifest.d.ts +2 -0
- package/dist/sdk/src/plugin.d.ts +3 -0
- package/dist/sdk/src/testing.d.ts +9 -0
- package/dist/src-C-909PVQ.mjs +498 -0
- package/dist/testing.d.ts +9 -0
- package/dist/testing.mjs +5 -0
- package/package.json +67 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
# O'Saasy License Agreement
|
|
2
|
+
|
|
3
|
+
Copyright © 2026, Xplain Technology Ltd.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
6
|
+
a copy of this software and associated documentation files (the
|
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
11
|
+
the following conditions:
|
|
12
|
+
|
|
13
|
+
1. The above copyright notice and this permission notice shall be
|
|
14
|
+
included in all copies or substantial portions of the Software.
|
|
15
|
+
2. No licensee or downstream recipient may use the Software (including
|
|
16
|
+
any modified or derivative versions) to directly compete with the
|
|
17
|
+
original Licensor by offering it to third parties as a hosted,
|
|
18
|
+
managed, or Software-as-a-Service (SaaS) product or cloud service
|
|
19
|
+
where the primary value of the service is the functionality of the
|
|
20
|
+
Software itself.
|
|
21
|
+
|
|
22
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
23
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
24
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
25
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
26
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
27
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
28
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
# processfocus
|
|
2
|
+
|
|
3
|
+
The source-available Process Focus authoring package for organisations,
|
|
4
|
+
processes, forms, authentication configuration, business calendars, frontend
|
|
5
|
+
manifests, and plugin declarations.
|
|
6
|
+
|
|
7
|
+
```ts
|
|
8
|
+
import { Organisation, Process } from "processfocus"
|
|
9
|
+
import { TextField } from "processfocus/forms"
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
Use `processfocus/testing` for deterministic model and Form Rule validation.
|
|
13
|
+
Runtime, persistence, deployment, and cloud policy are intentionally not part
|
|
14
|
+
of this package.
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
import { Schema } from "effect";
|
|
3
|
+
//#region ../auth-config/src/lib/authentication-config.ts
|
|
4
|
+
/**
|
|
5
|
+
* Configuration for OAuth authentication providers.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* const authConfig = new AuthenticationConfig(org, "auth", {
|
|
10
|
+
* identityProviders: {
|
|
11
|
+
* google: {
|
|
12
|
+
* clientID: process.env.GOOGLE_CLIENT_ID ?? "",
|
|
13
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
|
14
|
+
* scopes: ["openid", "email", "profile"],
|
|
15
|
+
* }
|
|
16
|
+
* }
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
var AuthenticationConfig = class extends Construct {
|
|
21
|
+
isAuthenticationConfig = true;
|
|
22
|
+
_inviteOnly;
|
|
23
|
+
delegatedAccess;
|
|
24
|
+
_identityProviders = [];
|
|
25
|
+
_passkey;
|
|
26
|
+
_secretClients = [];
|
|
27
|
+
constructor(scope, id, props) {
|
|
28
|
+
super(scope, id);
|
|
29
|
+
this._inviteOnly = props?.inviteOnly ?? true;
|
|
30
|
+
this.delegatedAccess = props?.delegatedAccess ?? false;
|
|
31
|
+
if (props?.identityProviders) {
|
|
32
|
+
for (const [name, config] of Object.entries(props.identityProviders)) if (config) this._identityProviders.push({
|
|
33
|
+
name,
|
|
34
|
+
config
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
this._passkey = props?.passkey;
|
|
38
|
+
if (props?.secretClients) {
|
|
39
|
+
for (const [clientId, config] of Object.entries(props.secretClients)) if (config) this._secretClients.push({
|
|
40
|
+
clientId,
|
|
41
|
+
secret: config.secret,
|
|
42
|
+
audience: config.audience
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Get all configured identity providers as a readonly array.
|
|
48
|
+
*/
|
|
49
|
+
get identityProviders() {
|
|
50
|
+
return this._identityProviders;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Whether authentication defaults to invite-only.
|
|
54
|
+
*/
|
|
55
|
+
get inviteOnly() {
|
|
56
|
+
return this._inviteOnly;
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Get the passkey configuration, if enabled.
|
|
60
|
+
*/
|
|
61
|
+
get passkey() {
|
|
62
|
+
return this._passkey;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get all configured M2M secret clients as a readonly array.
|
|
66
|
+
*/
|
|
67
|
+
get secretClients() {
|
|
68
|
+
return this._secretClients;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const isAuthenticationConfig = (value) => typeof value === "object" && value !== null && "isAuthenticationConfig" in value && value.isAuthenticationConfig === true;
|
|
72
|
+
//#endregion
|
|
73
|
+
//#region ../auth-config/src/lib/custom-entities-config.ts
|
|
74
|
+
/**
|
|
75
|
+
* Configuration for custom Cedar entity schemas.
|
|
76
|
+
*
|
|
77
|
+
* Attach this to an Organisation to specify custom Cedar schema files
|
|
78
|
+
* that define additional entity types and actions beyond the built-in ones.
|
|
79
|
+
*
|
|
80
|
+
* ## Build-time vs Runtime
|
|
81
|
+
*
|
|
82
|
+
* At **build time** (`pfcli build`), `CustomEntitiesConfig` is used to identify
|
|
83
|
+
* which schema files should be copied to the deployment artifact (dist/cedar/).
|
|
84
|
+
*
|
|
85
|
+
* At **runtime**, the GraphQL server reads schema files from the
|
|
86
|
+
* `CEDAR_PATH` environment variable directory.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```typescript
|
|
90
|
+
* const org = new Organisation({ name: "Acme Corp" })
|
|
91
|
+
*
|
|
92
|
+
* new CustomEntitiesConfig(org, "custom-entities", {
|
|
93
|
+
* schemaFiles: ["cedar/custom.cedarschema"]
|
|
94
|
+
* })
|
|
95
|
+
* ```
|
|
96
|
+
*/
|
|
97
|
+
var CustomEntitiesConfig = class extends Construct {
|
|
98
|
+
isCustomEntitiesConfig = true;
|
|
99
|
+
schemaFiles;
|
|
100
|
+
constructor(scope, id, props) {
|
|
101
|
+
super(scope, id);
|
|
102
|
+
this.schemaFiles = props.schemaFiles;
|
|
103
|
+
}
|
|
104
|
+
};
|
|
105
|
+
const isCustomEntitiesConfig = (value) => typeof value === "object" && value !== null && "isCustomEntitiesConfig" in value && value.isCustomEntitiesConfig === true;
|
|
106
|
+
//#endregion
|
|
107
|
+
//#region ../auth-config/src/lib/policies-config.ts
|
|
108
|
+
/**
|
|
109
|
+
* Configuration for custom Cedar authorization policies.
|
|
110
|
+
*
|
|
111
|
+
* Attach this to an Organisation to specify custom Cedar policy files
|
|
112
|
+
* that will be loaded and merged with the default policies at runtime.
|
|
113
|
+
*
|
|
114
|
+
* ## Build-time vs Runtime
|
|
115
|
+
*
|
|
116
|
+
* At **build time** (`pfcli build`), `PoliciesConfig` is used to identify which
|
|
117
|
+
* policy files should be copied to the deployment artifact (dist/cedar/).
|
|
118
|
+
*
|
|
119
|
+
* At **runtime**, the GraphQL server and other services read policies from the
|
|
120
|
+
* `CEDAR_PATH` environment variable, which points to the directory
|
|
121
|
+
* where policies were deployed.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```typescript
|
|
125
|
+
* const org = new Organisation({ name: "Acme Corp" })
|
|
126
|
+
*
|
|
127
|
+
* new PoliciesConfig(org, "policies", {
|
|
128
|
+
* policyFiles: ["cedar/custom.cedar"]
|
|
129
|
+
* })
|
|
130
|
+
* ```
|
|
131
|
+
*
|
|
132
|
+
* Note: `PoliciesConfig` must be attached directly to the org module
|
|
133
|
+
* that is loaded at build time (src/index.ts), otherwise the policy
|
|
134
|
+
* files will not be discovered and copied to the deployment artifact.
|
|
135
|
+
*/
|
|
136
|
+
var PoliciesConfig = class extends Construct {
|
|
137
|
+
isPoliciesConfig = true;
|
|
138
|
+
policyFiles;
|
|
139
|
+
constructor(scope, id, props) {
|
|
140
|
+
super(scope, id);
|
|
141
|
+
this.policyFiles = props.policyFiles;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
const isPoliciesConfig = (value) => typeof value === "object" && value !== null && "isPoliciesConfig" in value && value.isPoliciesConfig === true;
|
|
145
|
+
//#endregion
|
|
146
|
+
//#region ../auth-config/src/lib/provider-types.ts
|
|
147
|
+
/**
|
|
148
|
+
* Effect Schema for PasskeyProviderConfig validation.
|
|
149
|
+
*/
|
|
150
|
+
const PasskeyProviderConfigSchema = Schema.Struct({
|
|
151
|
+
rpName: Schema.String,
|
|
152
|
+
rpID: Schema.String,
|
|
153
|
+
origin: Schema.Union(Schema.String, Schema.Array(Schema.String))
|
|
154
|
+
});
|
|
155
|
+
/**
|
|
156
|
+
* Supported OAuth provider names.
|
|
157
|
+
*/
|
|
158
|
+
const OAUTH_PROVIDER_NAMES = [
|
|
159
|
+
"google",
|
|
160
|
+
"github",
|
|
161
|
+
"microsoft",
|
|
162
|
+
"apple",
|
|
163
|
+
"discord",
|
|
164
|
+
"spotify",
|
|
165
|
+
"slack",
|
|
166
|
+
"linkedin",
|
|
167
|
+
"twitch",
|
|
168
|
+
"yahoo",
|
|
169
|
+
"x",
|
|
170
|
+
"keycloak",
|
|
171
|
+
"cognito",
|
|
172
|
+
"jumpcloud",
|
|
173
|
+
"facebook"
|
|
174
|
+
];
|
|
175
|
+
const DEFAULT_OAUTH_PROVIDER_SCOPES = {
|
|
176
|
+
google: [
|
|
177
|
+
"openid",
|
|
178
|
+
"email",
|
|
179
|
+
"profile"
|
|
180
|
+
],
|
|
181
|
+
github: ["read:user", "user:email"],
|
|
182
|
+
microsoft: [
|
|
183
|
+
"openid",
|
|
184
|
+
"email",
|
|
185
|
+
"profile"
|
|
186
|
+
],
|
|
187
|
+
apple: ["name", "email"],
|
|
188
|
+
discord: ["identify", "email"],
|
|
189
|
+
spotify: ["user-read-email"],
|
|
190
|
+
slack: [
|
|
191
|
+
"openid",
|
|
192
|
+
"email",
|
|
193
|
+
"profile"
|
|
194
|
+
],
|
|
195
|
+
linkedin: [
|
|
196
|
+
"openid",
|
|
197
|
+
"email",
|
|
198
|
+
"profile"
|
|
199
|
+
],
|
|
200
|
+
twitch: ["openid", "user:read:email"],
|
|
201
|
+
yahoo: [
|
|
202
|
+
"openid",
|
|
203
|
+
"email",
|
|
204
|
+
"profile"
|
|
205
|
+
],
|
|
206
|
+
x: [
|
|
207
|
+
"users.read",
|
|
208
|
+
"tweet.read",
|
|
209
|
+
"offline.access"
|
|
210
|
+
],
|
|
211
|
+
keycloak: [
|
|
212
|
+
"openid",
|
|
213
|
+
"email",
|
|
214
|
+
"profile"
|
|
215
|
+
],
|
|
216
|
+
cognito: [
|
|
217
|
+
"openid",
|
|
218
|
+
"email",
|
|
219
|
+
"profile"
|
|
220
|
+
],
|
|
221
|
+
jumpcloud: [
|
|
222
|
+
"openid",
|
|
223
|
+
"email",
|
|
224
|
+
"profile"
|
|
225
|
+
],
|
|
226
|
+
facebook: ["email", "public_profile"]
|
|
227
|
+
};
|
|
228
|
+
/**
|
|
229
|
+
* Effect Schema for OAuthProviderConfig validation.
|
|
230
|
+
*/
|
|
231
|
+
const OAuthProviderConfigSchema = Schema.Struct({
|
|
232
|
+
clientID: Schema.String,
|
|
233
|
+
clientSecret: Schema.String,
|
|
234
|
+
scopes: Schema.Array(Schema.String),
|
|
235
|
+
pkce: Schema.optional(Schema.Boolean),
|
|
236
|
+
query: Schema.optional(Schema.Record({
|
|
237
|
+
key: Schema.String,
|
|
238
|
+
value: Schema.String
|
|
239
|
+
}))
|
|
240
|
+
});
|
|
241
|
+
const AppleOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({ responseMode: Schema.optional(Schema.Literal("query", "form_post")) })));
|
|
242
|
+
const MicrosoftOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({ tenant: Schema.String })));
|
|
243
|
+
const SlackOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({ team: Schema.String })));
|
|
244
|
+
const KeycloakOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({
|
|
245
|
+
baseUrl: Schema.String,
|
|
246
|
+
realm: Schema.String
|
|
247
|
+
})));
|
|
248
|
+
const CognitoOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({
|
|
249
|
+
domain: Schema.String,
|
|
250
|
+
region: Schema.String,
|
|
251
|
+
userPoolId: Schema.String
|
|
252
|
+
})));
|
|
253
|
+
/**
|
|
254
|
+
* Effect Schema for OAuthProviderName validation.
|
|
255
|
+
*/
|
|
256
|
+
const OAuthProviderNameSchema = Schema.Literal(...OAUTH_PROVIDER_NAMES);
|
|
257
|
+
/**
|
|
258
|
+
* Effect Schema for GoogleOAuthProviderConfig validation.
|
|
259
|
+
* Extends the base OAuthProviderConfigSchema with Google-specific fields.
|
|
260
|
+
*/
|
|
261
|
+
const GoogleOAuthProviderConfigSchema = OAuthProviderConfigSchema.pipe(Schema.extend(Schema.Struct({
|
|
262
|
+
invitedOrgUnits: Schema.optional(Schema.Array(Schema.String)),
|
|
263
|
+
orgUnitAsRole: Schema.optional(Schema.Boolean),
|
|
264
|
+
serviceAccountKey: Schema.optional(Schema.String),
|
|
265
|
+
adminEmail: Schema.optional(Schema.String)
|
|
266
|
+
})));
|
|
267
|
+
/**
|
|
268
|
+
* Effect Schema for SecretClientConfig validation.
|
|
269
|
+
*/
|
|
270
|
+
const SecretClientConfigSchema = Schema.Struct({
|
|
271
|
+
secret: Schema.String,
|
|
272
|
+
audience: Schema.String
|
|
273
|
+
});
|
|
274
|
+
//#endregion
|
|
275
|
+
export { AuthenticationConfig as _, KeycloakOAuthProviderConfigSchema as a, OAuthProviderConfigSchema as c, SecretClientConfigSchema as d, SlackOAuthProviderConfigSchema as f, isCustomEntitiesConfig as g, CustomEntitiesConfig as h, GoogleOAuthProviderConfigSchema as i, OAuthProviderNameSchema as l, isPoliciesConfig as m, CognitoOAuthProviderConfigSchema as n, MicrosoftOAuthProviderConfigSchema as o, PoliciesConfig as p, DEFAULT_OAUTH_PROVIDER_SCOPES as r, OAUTH_PROVIDER_NAMES as s, AppleOAuthProviderConfigSchema as t, PasskeyProviderConfigSchema as u, isAuthenticationConfig as v };
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
import { Construct, type IConstruct } from "constructs";
|
|
2
|
+
import type { AppleOAuthProviderConfig, CognitoOAuthProviderConfig, GoogleOAuthProviderConfig, KeycloakOAuthProviderConfig, MicrosoftOAuthProviderConfig, OAuthProviderConfig, OAuthProviderName, PasskeyProviderConfig, SecretClientConfig, SlackOAuthProviderConfig } from "./provider-types.js";
|
|
3
|
+
interface ProviderEntry {
|
|
4
|
+
readonly name: OAuthProviderName;
|
|
5
|
+
readonly config: OAuthProviderConfig;
|
|
6
|
+
}
|
|
7
|
+
interface SecretClientEntry {
|
|
8
|
+
readonly clientId: string;
|
|
9
|
+
readonly secret: string;
|
|
10
|
+
readonly audience: string;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Identity-provider-specific configuration types.
|
|
14
|
+
* Google accepts extended config with OU invitation fields.
|
|
15
|
+
*/
|
|
16
|
+
export type IdentityProvidersConfig = {
|
|
17
|
+
[K in Exclude<OAuthProviderName, "apple" | "cognito" | "google" | "keycloak" | "microsoft" | "slack">]?: OAuthProviderConfig;
|
|
18
|
+
} & {
|
|
19
|
+
apple?: AppleOAuthProviderConfig;
|
|
20
|
+
cognito?: CognitoOAuthProviderConfig;
|
|
21
|
+
google?: GoogleOAuthProviderConfig;
|
|
22
|
+
keycloak?: KeycloakOAuthProviderConfig;
|
|
23
|
+
microsoft?: MicrosoftOAuthProviderConfig;
|
|
24
|
+
slack?: SlackOAuthProviderConfig;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* Configuration map for M2M (machine-to-machine) secret clients.
|
|
28
|
+
* Keys are client IDs, values are their configurations.
|
|
29
|
+
*/
|
|
30
|
+
export type SecretClientsConfig = Record<string, SecretClientConfig>;
|
|
31
|
+
export interface AuthenticationConfigProps {
|
|
32
|
+
/**
|
|
33
|
+
* Show **Log in with a secret** on the anonymous login page.
|
|
34
|
+
*
|
|
35
|
+
* The login page has no identified principal whose Cedar token-management
|
|
36
|
+
* permissions it can evaluate, so this is a presentation choice only. Cedar
|
|
37
|
+
* independently authorizes token listing, issuance, management, redemption,
|
|
38
|
+
* and delegated work. Hiding the control does not disable authentication or
|
|
39
|
+
* revoke an existing credential.
|
|
40
|
+
*
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
delegatedAccess?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Whether new human users must be invited before they can register.
|
|
46
|
+
* When true, login is invite-only unless provider-specific config treats the
|
|
47
|
+
* user as implicitly invited.
|
|
48
|
+
*
|
|
49
|
+
* @default true
|
|
50
|
+
*/
|
|
51
|
+
inviteOnly?: boolean;
|
|
52
|
+
/**
|
|
53
|
+
* Identity provider configurations.
|
|
54
|
+
* Keys are provider names, values are their OAuth configs.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```typescript
|
|
58
|
+
* {
|
|
59
|
+
* google: {
|
|
60
|
+
* clientID: process.env.GOOGLE_CLIENT_ID ?? "",
|
|
61
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
|
62
|
+
* scopes: ["openid", "email", "profile"],
|
|
63
|
+
* },
|
|
64
|
+
* github: {
|
|
65
|
+
* clientID: process.env.GITHUB_CLIENT_ID ?? "",
|
|
66
|
+
* clientSecret: process.env.GITHUB_CLIENT_SECRET ?? "",
|
|
67
|
+
* scopes: ["user:email"],
|
|
68
|
+
* }
|
|
69
|
+
* }
|
|
70
|
+
* ```
|
|
71
|
+
*/
|
|
72
|
+
identityProviders?: IdentityProvidersConfig;
|
|
73
|
+
/**
|
|
74
|
+
* Passkey (WebAuthn) provider configuration.
|
|
75
|
+
* If provided, enables passkey authentication.
|
|
76
|
+
*
|
|
77
|
+
* @example
|
|
78
|
+
* ```typescript
|
|
79
|
+
* {
|
|
80
|
+
* rpName: "My App",
|
|
81
|
+
* rpID: "example.com",
|
|
82
|
+
* origin: "https://example.com"
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*/
|
|
86
|
+
passkey?: PasskeyProviderConfig;
|
|
87
|
+
/**
|
|
88
|
+
* M2M (machine-to-machine) secret client configurations.
|
|
89
|
+
* Keys are client IDs, values contain the client secret.
|
|
90
|
+
*
|
|
91
|
+
* These clients can authenticate via OAuth2 client_credentials grant.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* {
|
|
96
|
+
* "ci-pipeline": {
|
|
97
|
+
* secret: process.env.CI_CLIENT_SECRET ?? "",
|
|
98
|
+
* },
|
|
99
|
+
* }
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
secretClients?: SecretClientsConfig;
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Configuration for OAuth authentication providers.
|
|
106
|
+
*
|
|
107
|
+
* @example
|
|
108
|
+
* ```typescript
|
|
109
|
+
* const authConfig = new AuthenticationConfig(org, "auth", {
|
|
110
|
+
* identityProviders: {
|
|
111
|
+
* google: {
|
|
112
|
+
* clientID: process.env.GOOGLE_CLIENT_ID ?? "",
|
|
113
|
+
* clientSecret: process.env.GOOGLE_CLIENT_SECRET ?? "",
|
|
114
|
+
* scopes: ["openid", "email", "profile"],
|
|
115
|
+
* }
|
|
116
|
+
* }
|
|
117
|
+
* })
|
|
118
|
+
* ```
|
|
119
|
+
*/
|
|
120
|
+
export declare class AuthenticationConfig extends Construct {
|
|
121
|
+
readonly isAuthenticationConfig: true;
|
|
122
|
+
private readonly _inviteOnly;
|
|
123
|
+
readonly delegatedAccess: boolean;
|
|
124
|
+
private readonly _identityProviders;
|
|
125
|
+
private readonly _passkey;
|
|
126
|
+
private readonly _secretClients;
|
|
127
|
+
constructor(scope: IConstruct, id: string, props?: AuthenticationConfigProps);
|
|
128
|
+
/**
|
|
129
|
+
* Get all configured identity providers as a readonly array.
|
|
130
|
+
*/
|
|
131
|
+
get identityProviders(): readonly ProviderEntry[];
|
|
132
|
+
/**
|
|
133
|
+
* Whether authentication defaults to invite-only.
|
|
134
|
+
*/
|
|
135
|
+
get inviteOnly(): boolean;
|
|
136
|
+
/**
|
|
137
|
+
* Get the passkey configuration, if enabled.
|
|
138
|
+
*/
|
|
139
|
+
get passkey(): PasskeyProviderConfig | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Get all configured M2M secret clients as a readonly array.
|
|
142
|
+
*/
|
|
143
|
+
get secretClients(): readonly SecretClientEntry[];
|
|
144
|
+
}
|
|
145
|
+
export declare const isAuthenticationConfig: (value: unknown) => value is AuthenticationConfig;
|
|
146
|
+
export {};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for custom Cedar entity schemas.
|
|
4
|
+
*/
|
|
5
|
+
export interface CustomEntitiesConfigProps {
|
|
6
|
+
/**
|
|
7
|
+
* Paths to custom Cedar schema files, relative to the org package root.
|
|
8
|
+
* These schemas are merged with the default schema at runtime.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* new CustomEntitiesConfig(org, "custom-entities", {
|
|
13
|
+
* schemaFiles: ["cedar/custom.cedarschema"]
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
readonly schemaFiles: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for custom Cedar entity schemas.
|
|
21
|
+
*
|
|
22
|
+
* Attach this to an Organisation to specify custom Cedar schema files
|
|
23
|
+
* that define additional entity types and actions beyond the built-in ones.
|
|
24
|
+
*
|
|
25
|
+
* ## Build-time vs Runtime
|
|
26
|
+
*
|
|
27
|
+
* At **build time** (`pfcli build`), `CustomEntitiesConfig` is used to identify
|
|
28
|
+
* which schema files should be copied to the deployment artifact (dist/cedar/).
|
|
29
|
+
*
|
|
30
|
+
* At **runtime**, the GraphQL server reads schema files from the
|
|
31
|
+
* `CEDAR_PATH` environment variable directory.
|
|
32
|
+
*
|
|
33
|
+
* @example
|
|
34
|
+
* ```typescript
|
|
35
|
+
* const org = new Organisation({ name: "Acme Corp" })
|
|
36
|
+
*
|
|
37
|
+
* new CustomEntitiesConfig(org, "custom-entities", {
|
|
38
|
+
* schemaFiles: ["cedar/custom.cedarschema"]
|
|
39
|
+
* })
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export declare class CustomEntitiesConfig extends Construct {
|
|
43
|
+
readonly isCustomEntitiesConfig: true;
|
|
44
|
+
readonly schemaFiles: readonly string[];
|
|
45
|
+
constructor(scope: Construct, id: string, props: CustomEntitiesConfigProps);
|
|
46
|
+
}
|
|
47
|
+
export declare const isCustomEntitiesConfig: (value: unknown) => value is CustomEntitiesConfig;
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Construct } from "constructs";
|
|
2
|
+
/**
|
|
3
|
+
* Configuration for custom Cedar authorization policies.
|
|
4
|
+
*/
|
|
5
|
+
export interface PoliciesConfigProps {
|
|
6
|
+
/**
|
|
7
|
+
* Paths to custom Cedar policy files, relative to the org package root.
|
|
8
|
+
* These policies are merged with the default policies at runtime.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* new PoliciesConfig(org, "policies", {
|
|
13
|
+
* policyFiles: ["cedar/custom.cedar", "cedar/admin.cedar"]
|
|
14
|
+
* })
|
|
15
|
+
* ```
|
|
16
|
+
*/
|
|
17
|
+
readonly policyFiles: readonly string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Configuration for custom Cedar authorization policies.
|
|
21
|
+
*
|
|
22
|
+
* Attach this to an Organisation to specify custom Cedar policy files
|
|
23
|
+
* that will be loaded and merged with the default policies at runtime.
|
|
24
|
+
*
|
|
25
|
+
* ## Build-time vs Runtime
|
|
26
|
+
*
|
|
27
|
+
* At **build time** (`pfcli build`), `PoliciesConfig` is used to identify which
|
|
28
|
+
* policy files should be copied to the deployment artifact (dist/cedar/).
|
|
29
|
+
*
|
|
30
|
+
* At **runtime**, the GraphQL server and other services read policies from the
|
|
31
|
+
* `CEDAR_PATH` environment variable, which points to the directory
|
|
32
|
+
* where policies were deployed.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```typescript
|
|
36
|
+
* const org = new Organisation({ name: "Acme Corp" })
|
|
37
|
+
*
|
|
38
|
+
* new PoliciesConfig(org, "policies", {
|
|
39
|
+
* policyFiles: ["cedar/custom.cedar"]
|
|
40
|
+
* })
|
|
41
|
+
* ```
|
|
42
|
+
*
|
|
43
|
+
* Note: `PoliciesConfig` must be attached directly to the org module
|
|
44
|
+
* that is loaded at build time (src/index.ts), otherwise the policy
|
|
45
|
+
* files will not be discovered and copied to the deployment artifact.
|
|
46
|
+
*/
|
|
47
|
+
export declare class PoliciesConfig extends Construct {
|
|
48
|
+
readonly isPoliciesConfig: true;
|
|
49
|
+
readonly policyFiles: readonly string[];
|
|
50
|
+
constructor(scope: Construct, id: string, props: PoliciesConfigProps);
|
|
51
|
+
}
|
|
52
|
+
export declare const isPoliciesConfig: (value: unknown) => value is PoliciesConfig;
|