@c9up/transit 0.1.5 → 0.1.6

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.
@@ -12,6 +12,12 @@ interface Codemods {
12
12
  writeFile(filePath: string, content: string, options?: {
13
13
  force?: boolean;
14
14
  }): Promise<void>;
15
+ makeUsingStub(stubsRoot: string, stubPath: string, state?: Record<string, string | number | boolean>, options?: {
16
+ force?: boolean;
17
+ }): Promise<{
18
+ path: string;
19
+ contents: string;
20
+ }>;
15
21
  }
16
22
  export declare function configure(codemods: Codemods): Promise<void>;
17
23
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,UAAU,QAAQ;IACjB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,SAAS,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;CACjB;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CA2BjE"}
1
+ {"version":3,"file":"configure.d.ts","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,UAAU,QAAQ;IACjB,WAAW,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC/C,UAAU,CAAC,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD,SAAS,CACR,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3B,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,aAAa,CACZ,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,MAAM,EAChB,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EACjD,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE,GAC3B,OAAO,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAC/C;AAED,wBAAsB,SAAS,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWjE"}
package/dist/configure.js CHANGED
@@ -6,6 +6,7 @@
6
6
  * application wants. Writing both together is what makes `ream add` mean
7
7
  * installed AND working.
8
8
  */
9
+ import { stubsRoot } from "./stubs.js";
9
10
  export async function configure(codemods) {
10
11
  // The config below reads these, so they are declared here. Writing the file
11
12
  // without them leaves an application whose config asks the environment for
@@ -15,19 +16,6 @@ export async function configure(codemods) {
15
16
  GOOGLE_CLIENT_SECRET: "",
16
17
  });
17
18
  await codemods.addProvider("@c9up/transit/provider");
18
- await codemods.writeFile("config/transit.ts", `import { defineConfig, socials } from '@c9up/transit'
19
- import env from '#start/env'
20
-
21
- export default defineConfig({
22
- // The key is yours: it is what \`transit.begin(name)\` asks for.
23
- google: socials.google({
24
- clientId: env.get('GOOGLE_CLIENT_ID', ''),
25
- clientSecret: env.get('GOOGLE_CLIENT_SECRET', ''),
26
- callbackUrl: 'http://localhost:3333/auth/google/callback',
27
- }),
28
-
29
- // An OpenID Connect provider needs only its issuer:
30
- // work: oidc({ issuer: env.get('OIDC_ISSUER'), clientId, clientSecret, callbackUrl }),
31
- })`);
19
+ await codemods.makeUsingStub(stubsRoot, "config/transit.stub");
32
20
  }
33
21
  //# sourceMappingURL=configure.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"configure.js","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAYH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAkB;IACjD,4EAA4E;IAC5E,2EAA2E;IAC3E,oCAAoC;IACpC,MAAM,QAAQ,CAAC,UAAU,CAAC;QACzB,gBAAgB,EAAE,EAAE;QACpB,oBAAoB,EAAE,EAAE;KACxB,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IACrD,MAAM,QAAQ,CAAC,SAAS,CACvB,mBAAmB,EACnB;;;;;;;;;;;;;GAaC,CACD,CAAC;AACH,CAAC"}
1
+ {"version":3,"file":"configure.js","sourceRoot":"","sources":["../src/configure.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AAkBvC,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,QAAkB;IACjD,4EAA4E;IAC5E,2EAA2E;IAC3E,oCAAoC;IACpC,MAAM,QAAQ,CAAC,UAAU,CAAC;QACzB,gBAAgB,EAAE,EAAE;QACpB,oBAAoB,EAAE,EAAE;KACxB,CAAC,CAAC;IAEH,MAAM,QAAQ,CAAC,WAAW,CAAC,wBAAwB,CAAC,CAAC;IACrD,MAAM,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;AAChE,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Where this package's stubs live.
3
+ *
4
+ * Its own module, as upstream keeps it: a stub root is a path a package
5
+ * publishes, and a caller importing it should not have to import the
6
+ * configure hook to get it.
7
+ *
8
+ * `import.meta.dirname` rather than a URL — upstream reads it straight off
9
+ * `import.meta`, and deriving it from `import.meta.url` breaks wherever that
10
+ * is not a `file://` URL, which is what a test runner serving modules over
11
+ * HTTP hands you.
12
+ */
13
+ export declare const stubsRoot: string;
14
+ //# sourceMappingURL=stubs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stubs.d.ts","sourceRoot":"","sources":["../src/stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAIH,eAAO,MAAM,SAAS,QAA2C,CAAC"}
package/dist/stubs.js ADDED
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Where this package's stubs live.
3
+ *
4
+ * Its own module, as upstream keeps it: a stub root is a path a package
5
+ * publishes, and a caller importing it should not have to import the
6
+ * configure hook to get it.
7
+ *
8
+ * `import.meta.dirname` rather than a URL — upstream reads it straight off
9
+ * `import.meta`, and deriving it from `import.meta.url` breaks wherever that
10
+ * is not a `file://` URL, which is what a test runner serving modules over
11
+ * HTTP hands you.
12
+ */
13
+ import { join } from "node:path";
14
+ export const stubsRoot = join(import.meta.dirname, "..", "stubs");
15
+ //# sourceMappingURL=stubs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stubs.js","sourceRoot":"","sources":["../src/stubs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,CAAC,MAAM,SAAS,GAAG,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c9up/transit",
3
- "version": "0.1.5",
3
+ "version": "0.1.6",
4
4
  "description": "Transit — federated sign-in for the Ream framework: SAML 2.0, LDAP, OpenID Connect, OAuth1, OAuth2",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -34,7 +34,7 @@
34
34
  },
35
35
  "devDependencies": {
36
36
  "@biomejs/biome": "^2.5.12",
37
- "@c9up/ream": "^0.2.0",
37
+ "@c9up/ream": "^0.2.25",
38
38
  "@types/node": "^22.20.1",
39
39
  "@vitest/coverage-v8": "4.1.11",
40
40
  "typescript": "^6.0.3",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "peerDependencies": {
44
44
  "@c9up/quasar": "^0.1.0 || ^0.2.0",
45
- "@c9up/ream": "^0.2.0"
45
+ "@c9up/ream": "^0.2.26"
46
46
  },
47
47
  "peerDependenciesMeta": {
48
48
  "@c9up/quasar": {
@@ -59,6 +59,7 @@
59
59
  "files": [
60
60
  "src",
61
61
  "dist",
62
+ "stubs",
62
63
  "README.md",
63
64
  "LICENSE"
64
65
  ],
package/src/configure.ts CHANGED
@@ -7,6 +7,8 @@
7
7
  * installed AND working.
8
8
  */
9
9
 
10
+ import { stubsRoot } from "./stubs.js";
11
+
10
12
  interface Codemods {
11
13
  addProvider(importPath: string): Promise<void>;
12
14
  addEnvVars(vars: Record<string, string>): Promise<void>;
@@ -15,6 +17,12 @@ interface Codemods {
15
17
  content: string,
16
18
  options?: { force?: boolean },
17
19
  ): Promise<void>;
20
+ makeUsingStub(
21
+ stubsRoot: string,
22
+ stubPath: string,
23
+ state?: Record<string, string | number | boolean>,
24
+ options?: { force?: boolean },
25
+ ): Promise<{ path: string; contents: string }>;
18
26
  }
19
27
 
20
28
  export async function configure(codemods: Codemods): Promise<void> {
@@ -27,21 +35,5 @@ export async function configure(codemods: Codemods): Promise<void> {
27
35
  });
28
36
 
29
37
  await codemods.addProvider("@c9up/transit/provider");
30
- await codemods.writeFile(
31
- "config/transit.ts",
32
- `import { defineConfig, socials } from '@c9up/transit'
33
- import env from '#start/env'
34
-
35
- export default defineConfig({
36
- // The key is yours: it is what \`transit.begin(name)\` asks for.
37
- google: socials.google({
38
- clientId: env.get('GOOGLE_CLIENT_ID', ''),
39
- clientSecret: env.get('GOOGLE_CLIENT_SECRET', ''),
40
- callbackUrl: 'http://localhost:3333/auth/google/callback',
41
- }),
42
-
43
- // An OpenID Connect provider needs only its issuer:
44
- // work: oidc({ issuer: env.get('OIDC_ISSUER'), clientId, clientSecret, callbackUrl }),
45
- })`,
46
- );
38
+ await codemods.makeUsingStub(stubsRoot, "config/transit.stub");
47
39
  }
package/src/stubs.ts ADDED
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Where this package's stubs live.
3
+ *
4
+ * Its own module, as upstream keeps it: a stub root is a path a package
5
+ * publishes, and a caller importing it should not have to import the
6
+ * configure hook to get it.
7
+ *
8
+ * `import.meta.dirname` rather than a URL — upstream reads it straight off
9
+ * `import.meta`, and deriving it from `import.meta.url` breaks wherever that
10
+ * is not a `file://` URL, which is what a test runner serving modules over
11
+ * HTTP hands you.
12
+ */
13
+
14
+ import { join } from "node:path";
15
+
16
+ export const stubsRoot = join(import.meta.dirname, "..", "stubs");
@@ -0,0 +1,17 @@
1
+ ---
2
+ to: config/transit.ts
3
+ ---
4
+ import { defineConfig, socials } from '@c9up/transit'
5
+ import env from '#start/env'
6
+
7
+ export default defineConfig({
8
+ // The key is yours: it is what `transit.begin(name)` asks for.
9
+ google: socials.google({
10
+ clientId: env.get('GOOGLE_CLIENT_ID', ''),
11
+ clientSecret: env.get('GOOGLE_CLIENT_SECRET', ''),
12
+ callbackUrl: 'http://localhost:3333/auth/google/callback',
13
+ }),
14
+
15
+ // An OpenID Connect provider needs only its issuer:
16
+ // work: oidc({ issuer: env.get('OIDC_ISSUER'), clientId, clientSecret, callbackUrl }),
17
+ })