@turbofy-ai/app-runtime 0.0.5 → 0.0.7
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/dist/src/dsl.d.ts +5 -1
- package/dist/src/dsl.js +19 -6
- package/dist/src/lib/auth.d.ts +18 -0
- package/package.json +1 -1
package/dist/src/dsl.d.ts
CHANGED
|
@@ -580,10 +580,14 @@ declare enum SubscribedProductEnum {
|
|
|
580
580
|
BATCH = "BATCH",
|
|
581
581
|
FILES = "FILES",
|
|
582
582
|
SUBSCRIPTIONS = "SUBSCRIPTIONS",
|
|
583
|
-
DEDICATED_IP = "DEDICATED_IP"
|
|
583
|
+
DEDICATED_IP = "DEDICATED_IP",
|
|
584
|
+
GRAPHQL_API = "GRAPHQL_API",
|
|
585
|
+
AUTH = "AUTH"
|
|
584
586
|
}
|
|
585
587
|
declare enum ProductNameEnum {
|
|
586
588
|
dedicated_ip_address = "dedicated_ip_address",
|
|
589
|
+
graphql_api = "graphql_api",
|
|
590
|
+
cognito_auth = "cognito_auth",
|
|
587
591
|
mvp_bundle = "mvp_bundle",
|
|
588
592
|
mvp_cognito = "mvp_cognito_auth",
|
|
589
593
|
mvp_data_storage = "mvp_data_storage",
|
package/dist/src/dsl.js
CHANGED
|
@@ -398,12 +398,21 @@ function entityLocalizationCode(ofType, fieldName, defaultLocale = "en") {
|
|
|
398
398
|
const defaultLocaleLower = defaultLocale.toLowerCase();
|
|
399
399
|
return `(() => {
|
|
400
400
|
const lang = ($$args.lang || '${defaultLocaleLower}').toLowerCase();
|
|
401
|
-
const
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
401
|
+
const record = $$std.getRecord(
|
|
402
|
+
'localization',
|
|
403
|
+
'${ofTypeLower}#' + $$self.id + '#' + lang,
|
|
404
|
+
{ dynamicArgs: { fields: ['dictionary'] } },
|
|
405
|
+
);
|
|
406
|
+
let dict = record && typeof record === 'object' ? record.dictionary : null;
|
|
407
|
+
if (!dict) {
|
|
408
|
+
// Fallback to legacy approach for records that predate the id-equals-key invariant.
|
|
409
|
+
const results = $$std.listRecords('localization', {
|
|
410
|
+
sortRange: { beginsWith: '${ofTypeLower}#' + $$self.id + '#' + lang },
|
|
411
|
+
limit: 1,
|
|
412
|
+
});
|
|
413
|
+
if (!Array.isArray(results) || results.length === 0) return '';
|
|
414
|
+
dict = results[0].dictionary;
|
|
415
|
+
}
|
|
407
416
|
if (!dict || typeof dict !== 'object') return '';
|
|
408
417
|
return dict['${fieldName}'] || '';
|
|
409
418
|
})()`;
|
|
@@ -15271,10 +15280,14 @@ var SubscribedProductEnum = /* @__PURE__ */ ((SubscribedProductEnum2) => {
|
|
|
15271
15280
|
SubscribedProductEnum2["FILES"] = "FILES";
|
|
15272
15281
|
SubscribedProductEnum2["SUBSCRIPTIONS"] = "SUBSCRIPTIONS";
|
|
15273
15282
|
SubscribedProductEnum2["DEDICATED_IP"] = "DEDICATED_IP";
|
|
15283
|
+
SubscribedProductEnum2["GRAPHQL_API"] = "GRAPHQL_API";
|
|
15284
|
+
SubscribedProductEnum2["AUTH"] = "AUTH";
|
|
15274
15285
|
return SubscribedProductEnum2;
|
|
15275
15286
|
})(SubscribedProductEnum || {});
|
|
15276
15287
|
var ProductNameEnum = /* @__PURE__ */ ((ProductNameEnum2) => {
|
|
15277
15288
|
ProductNameEnum2["dedicated_ip_address"] = "dedicated_ip_address";
|
|
15289
|
+
ProductNameEnum2["graphql_api"] = "graphql_api";
|
|
15290
|
+
ProductNameEnum2["cognito_auth"] = "cognito_auth";
|
|
15278
15291
|
ProductNameEnum2["mvp_bundle"] = "mvp_bundle";
|
|
15279
15292
|
ProductNameEnum2["mvp_cognito"] = "mvp_cognito_auth";
|
|
15280
15293
|
ProductNameEnum2["mvp_data_storage"] = "mvp_data_storage";
|
package/dist/src/lib/auth.d.ts
CHANGED
|
@@ -4,6 +4,15 @@ export interface IAuthResult {
|
|
|
4
4
|
/** Signup only: the account was created but needs email confirmation. */
|
|
5
5
|
needsConfirmation?: boolean;
|
|
6
6
|
}
|
|
7
|
+
export interface ICurrentUser {
|
|
8
|
+
sub: string;
|
|
9
|
+
email?: string;
|
|
10
|
+
groups?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface ICurrentUserResult {
|
|
13
|
+
user: ICurrentUser | null;
|
|
14
|
+
error?: string;
|
|
15
|
+
}
|
|
7
16
|
export declare const login: (email: string, password: string) => Promise<IAuthResult>;
|
|
8
17
|
export declare const signup: (params: {
|
|
9
18
|
email: string;
|
|
@@ -12,6 +21,15 @@ export declare const signup: (params: {
|
|
|
12
21
|
}) => Promise<IAuthResult>;
|
|
13
22
|
export declare const confirmSignup: (email: string, code: string) => Promise<IAuthResult>;
|
|
14
23
|
export declare const logout: () => Promise<IAuthResult>;
|
|
24
|
+
/** Read the signed-in Cognito user from the published app's session cookies. */
|
|
25
|
+
export declare const currentUser: () => Promise<ICurrentUserResult>;
|
|
26
|
+
/** React hook that loads the signed-in user once on mount. */
|
|
27
|
+
export declare const useCurrentUser: () => {
|
|
28
|
+
refetch: () => Promise<void>;
|
|
29
|
+
user: ICurrentUser | null;
|
|
30
|
+
isLoading: boolean;
|
|
31
|
+
error: string | null;
|
|
32
|
+
};
|
|
15
33
|
/**
|
|
16
34
|
* Restrict post-auth redirects to same-site relative paths, rejecting
|
|
17
35
|
* protocol-relative URLs (e.g. //attacker.com) which also start with "/".
|