-
Notifications
You must be signed in to change notification settings - Fork 112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App warmup caching #4133
base: main
Are you sure you want to change the base?
App warmup caching #4133
Conversation
We detected some changes at either packages/*/src or packages/cli-kit/assets/cli-ruby/** and there are no updates in the .changeset. |
Coverage report
Show files with reduced coverage 🔻
Test suite run success1722 tests passing in 794 suites. Report generated by 🧪jest coverage report action from e1df260 |
Differences in type declarationsWe detected differences in the type declarations generated by Typescript for this branch compared to the baseline ('main' branch). Please, review them to ensure they are backward-compatible. Here are some important things to keep in mind:
New type declarationsWe found no new type declarations in this PR Existing type declarationspackages/cli-kit/dist/private/node/conf-store.d.ts@@ -40,4 +40,6 @@ type CacheValueForKey<TKey extends keyof Cache> = NonNullable<Cache[TKey]>['valu
* @returns The value from the cache or the result of the function.
*/
export declare function cacheRetrieveOrRepopulate(key: keyof Cache, fn: () => Promise<CacheValueForKey<typeof key>>, timeout?: number, config?: LocalStorage<ConfSchema>): Promise<CacheValueForKey<typeof key>>;
+export declare function getCachedPartnerAccountStatus(partnersToken: string): true | null;
+export declare function setCachedPartnerAccountStatus(partnersToken: string): void;
export {};
\ No newline at end of file
packages/cli-kit/dist/private/node/session.d.ts@@ -60,7 +60,9 @@ export interface OAuthSession {
storefront?: string;
businessPlatform?: string;
appManagement?: string;
+ userId: string;
}
+export declare function getLastSeenUserIdAfterAuth(): string | undefined;
/**
* This method ensures that we have a valid session to authenticate against the given applications using the provided scopes.
*
packages/cli-kit/dist/public/node/environment.d.ts@@ -42,4 +42,5 @@ export declare function getBackendPort(): number | undefined;
export declare function getIdentityTokenInformation(): {
accessToken: string;
refreshToken: string;
+ userId: string;
} | undefined;
\ No newline at end of file
packages/cli-kit/dist/public/node/session.d.ts@@ -17,9 +17,18 @@ interface EnsureAuthenticatedAdditionalOptions {
* @param scopes - Optional array of extra scopes to authenticate with.
* @param env - Optional environment variables to use.
* @param options - Optional extra options to use.
- * @returns The access token for the Partners API.
+ * @returns The access token for the Partners API, and the user's ID.
*/
export declare function ensureAuthenticatedPartners(scopes?: string[], env?: NodeJS.ProcessEnv, options?: EnsureAuthenticatedAdditionalOptions): Promise<string>;
+/**
+ * Ensures the user is authenticated, returns their user ID.
+ *
+ * If the CLI already ran earlier -- under any context -- it won't repeat any work.
+ *
+ * @param env - Optional environment variables to use.
+ * @returns User ID, this should be the same for the same human beings.
+ */
+export declare function ensureAuthenticatedUserId(env?: NodeJS.ProcessEnv): Promise<string>;
/**
* Ensure that we have a valid session to access the App Management API.
*
packages/cli-kit/dist/private/node/session/schema.d.ts@@ -7,15 +7,18 @@ declare const IdentityTokenSchema: zod.ZodObject<{
refreshToken: zod.ZodString;
expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
scopes: zod.ZodArray<zod.ZodString, "many">;
+ userId: zod.ZodString;
}, "strip", zod.ZodTypeAny, {
accessToken: string;
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
}, {
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
}>;
/**
@@ -53,15 +56,18 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
refreshToken: zod.ZodString;
expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
scopes: zod.ZodArray<zod.ZodString, "many">;
+ userId: zod.ZodString;
}, "strip", zod.ZodTypeAny, {
accessToken: string;
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
}, {
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
}>;
/**
@@ -111,6 +117,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
};
applications: {} & {
[k: string]: {
@@ -124,6 +131,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
};
applications: {} & {
@@ -144,15 +152,18 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
refreshToken: zod.ZodString;
expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
scopes: zod.ZodArray<zod.ZodString, "many">;
+ userId: zod.ZodString;
}, "strip", zod.ZodTypeAny, {
accessToken: string;
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
}, {
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
}>;
/**
@@ -202,6 +213,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
};
applications: {} & {
[k: string]: {
@@ -215,6 +227,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
};
applications: {} & {
@@ -235,15 +248,18 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
refreshToken: zod.ZodString;
expiresAt: zod.ZodEffects<zod.ZodDate, Date, unknown>;
scopes: zod.ZodArray<zod.ZodString, "many">;
+ userId: zod.ZodString;
}, "strip", zod.ZodTypeAny, {
accessToken: string;
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
}, {
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
}>;
/**
@@ -293,6 +309,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
scopes: string[];
refreshToken: string;
expiresAt: Date;
+ userId: string;
};
applications: {} & {
[k: string]: {
@@ -306,6 +323,7 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
accessToken: string;
scopes: string[];
refreshToken: string;
+ userId: string;
expiresAt?: unknown;
};
applications: {} & {
@@ -319,4 +337,10 @@ export declare const SessionSchema: zod.ZodObject<{}, "strip", zod.ZodObject<{
export type Session = zod.infer<typeof SessionSchema>;
export type IdentityToken = zod.infer<typeof IdentityTokenSchema>;
export type ApplicationToken = zod.infer<typeof ApplicationTokenSchema>;
+/**
+ * Confirms that a given identity token structure matches what the schema currently defines.
+ *
+ * A full re-auth is the expectation if this validation fails.
+ */
+export declare function validateCachedIdentityTokenStructure(identityToken: unknown): boolean;
export {};
\ No newline at end of file
|
Do we now need to add |
WHY are these changes introduced?
Improves command speed by caching some supporting data about the developer
WHAT is this pull request doing?
Caches:
How to test your changes?
Run something like
app info --verbose
. Note 2 GraphQL queries to pull in that cached information. Run the command again, note the queries are gone.Measuring impact
How do we know this change was effective? Please choose one:
Checklist