wirejs-resources 0.1.11 → 0.1.12

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/README.md ADDED
@@ -0,0 +1,3 @@
1
+ Experimental.
2
+
3
+ If this package interests you, contact the author.
@@ -1 +1 @@
1
- export declare function prebuildApi(): Promise<void>;
1
+ export declare function prebuildApi(apiDir: string): Promise<void>;
@@ -1,12 +1,10 @@
1
- import process from 'process';
2
1
  import fs from 'fs';
3
2
  import path from 'path';
4
- export async function prebuildApi() {
5
- const CWD = process.cwd();
3
+ export async function prebuildApi(apiDir) {
6
4
  let API_URL = '/api';
7
- const indexModule = await import(path.join(CWD, 'index.js'));
5
+ const indexModule = await import(path.join(apiDir, 'dist', 'index.js'));
8
6
  try {
9
- const backendConfigModule = await import(path.join(CWD, 'config.js'));
7
+ const backendConfigModule = await import(path.join(apiDir, 'config.js'));
10
8
  const backendConfig = backendConfigModule.default;
11
9
  console.log("backend config found", backendConfig);
12
10
  if (backendConfig.apiUrl) {
@@ -23,5 +21,5 @@ export async function prebuildApi() {
23
21
  `import { apiTree } from "wirejs-resources/client";`,
24
22
  `const INTERNAL_API_URL = ${JSON.stringify(API_URL)};`,
25
23
  ].join('\n');
26
- await fs.promises.writeFile(path.join(CWD, 'index.client.js'), [baseClient, apiCode].join('\n\n'));
24
+ await fs.promises.writeFile(path.join(apiDir, 'dist', 'index.client.js'), [baseClient, apiCode].join('\n\n'));
27
25
  }
@@ -1,4 +1,5 @@
1
1
  import { Resource } from '../resource.js';
2
+ import { ContextWrapped } from '../adapters/context.js';
2
3
  import type { CookieJar } from '../adapters/cookie-jar.js';
3
4
  import type { User, AuthenticationError, AuthenticationMachineInput, AuthenticationMachineState, AuthenticationServiceOptions } from '../types.js';
4
5
  export declare class AuthenticationService extends Resource {
@@ -11,7 +12,7 @@ export declare class AuthenticationService extends Resource {
11
12
  setMachineState(cookies: CookieJar, form: AuthenticationMachineInput): Promise<AuthenticationMachineState | {
12
13
  errors: AuthenticationError[];
13
14
  }>;
14
- buildApi(): import("../adapters/context.js").ContextfulApiNamespace<{
15
+ buildApi(): ContextWrapped<{
15
16
  getState: () => Promise<AuthenticationMachineState>;
16
17
  setState: (options: AuthenticationMachineInput) => Promise<AuthenticationMachineState | {
17
18
  errors: AuthenticationError[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "wirejs-resources",
3
- "version": "0.1.11",
3
+ "version": "0.1.12",
4
4
  "description": "Basic services and server-side resources for wirejs apps",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "files": [
42
42
  "package.json",
43
+ "README.md",
43
44
  "dist/*"
44
45
  ]
45
- }
46
+ }