@gasboost/fake-core 0.1.2 → 0.1.3

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.
Files changed (3) hide show
  1. package/LICENSE +1 -1
  2. package/package.json +19 -5
  3. package/README.md +0 -169
package/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2026 gasboost
3
+ Copyright (c) 2026 Gasboost
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
package/package.json CHANGED
@@ -1,15 +1,28 @@
1
1
  {
2
2
  "name": "@gasboost/fake-core",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "This package provides a fake implementation of Google Apps Script built-in services for testing purposes.",
5
5
  "license": "MIT",
6
6
  "author": "tiger-oshima",
7
7
  "repository": {
8
8
  "type": "git",
9
- "url": "git+https://github.com/gasboost/fake.git",
9
+ "url": "https://github.com/gasboost/dev.git",
10
10
  "directory": "packages/fake-core"
11
11
  },
12
12
  "type": "commonjs",
13
+ "devDependencies": {
14
+ "@eslint/js": "^10.0.1",
15
+ "@types/google-apps-script": "^2.0.12",
16
+ "@typescript-eslint/eslint-plugin": "^8.68.0",
17
+ "@typescript-eslint/parser": "^8.68.0",
18
+ "eslint": "^10.9.1",
19
+ "globals": "^17.11.0",
20
+ "jiti": "^2.7.0",
21
+ "prettier": "^3.9.6",
22
+ "typescript": "^6.0.3",
23
+ "typescript-eslint": "^8.68.0",
24
+ "vitest": "^4.1.11"
25
+ },
13
26
  "main": "./dist/index.js",
14
27
  "types": "./dist/index.d.ts",
15
28
  "exports": {
@@ -22,12 +35,13 @@
22
35
  "access": "public"
23
36
  },
24
37
  "scripts": {
25
- "format": "prettier --ignore-path ../../.prettierignore --write .",
26
- "formatcheck": "prettier --ignore-path ../../.prettierignore --check .",
38
+ "format": "prettier --ignore-path .prettierignore --write .",
39
+ "formatcheck": "prettier --ignore-path .prettierignore --check .",
27
40
  "typecheck": "tsc -p tsconfig.json --noEmit",
28
41
  "lint": "eslint . --ext .ts",
29
42
  "test": "vitest run",
30
43
  "check": "pnpm formatcheck && pnpm lint && pnpm typecheck && pnpm test",
31
- "build": "rm -rf dist && tsc -p tsconfig.json"
44
+ "build": "rm -rf dist && tsc -p tsconfig.json",
45
+ "pack:check": "pnpm pack"
32
46
  }
33
47
  }
package/README.md DELETED
@@ -1,169 +0,0 @@
1
- # @gasboost/fake-core
2
-
3
- Google Apps Script の組み込み API に対応する in-memory fake implementation を提供します。
4
-
5
- Node.js 固有 API には依存せず、GAS API に依存するコードをテスト可能にするための基礎実装を担当します。
6
-
7
- ## インストール
8
-
9
- ```bash
10
- pnpm add -D @gasboost/fake-core
11
- ```
12
-
13
- npm:
14
-
15
- ```bash
16
- npm install -D @gasboost/fake-core
17
- ```
18
-
19
- TypeScript で GAS の型を利用する場合は、必要に応じて型定義も追加してください。
20
-
21
- ```bash
22
- pnpm add -D @types/google-apps-script
23
- ```
24
-
25
- ## Public API
26
-
27
- 現在の package entry point からは以下を公開しています。
28
-
29
- ### Blob
30
-
31
- - `InMemoryBlob`
32
-
33
- `GoogleAppsScript.Base.Blob` を実装する in-memory Blob です。
34
-
35
- ```ts
36
- import { InMemoryBlob } from "@gasboost/fake-core";
37
-
38
- const blob = new InMemoryBlob("hello", "text/plain", "hello.txt");
39
-
40
- blob.getDataAsString();
41
- blob.getBytes();
42
- blob.getName();
43
- ```
44
-
45
- ### Cache
46
-
47
- - `InMemoryCache`
48
- - `InMemoryCacheService`
49
-
50
- `GoogleAppsScript.Cache.Cache` と `CacheService` に対応する in-memory 実装です。
51
-
52
- ```ts
53
- import { InMemoryCacheService } from "@gasboost/fake-core";
54
-
55
- const CacheService = new InMemoryCacheService();
56
- const cache = CacheService.getScriptCache();
57
-
58
- cache.put("key", "value");
59
-
60
- console.log(cache.get("key"));
61
- ```
62
-
63
- `InMemoryCache` は expiration、key length、value size、保存件数など、現在実装されている GAS Cache の制約も再現します。
64
-
65
- ### Properties Service
66
-
67
- - `InMemoryProperties`
68
- - `InMemoryPropertiesService`
69
-
70
- `PropertiesService` の Document / User / Script Properties に対応する in-memory 実装です。
71
-
72
- ```ts
73
- import { InMemoryPropertiesService } from "@gasboost/fake-core";
74
-
75
- const PropertiesService = new InMemoryPropertiesService();
76
- const properties = PropertiesService.getScriptProperties();
77
-
78
- properties.setProperty("key", "value");
79
-
80
- console.log(properties.getProperty("key"));
81
- ```
82
-
83
- ### Session
84
-
85
- - `InMemoryContext`
86
- - `InMemorySession`
87
- - `SecurityPolicy`
88
- - `OAuthScope`
89
-
90
- GAS の Session を、実行コンテキストと OAuth Scope を明示して再現するための実装です。
91
-
92
- ```ts
93
- import {
94
- InMemoryContext,
95
- InMemorySession,
96
- OAuthScope,
97
- SecurityPolicy,
98
- } from "@gasboost/fake-core";
99
-
100
- const context = new InMemoryContext(
101
- "owner@example.com",
102
- "user@example.com",
103
- {
104
- type: "WEB_APP",
105
- executeAs: "USER",
106
- },
107
- new SecurityPolicy([OAuthScope.USERINFO_EMAIL]),
108
- "ja",
109
- "Asia/Tokyo",
110
- );
111
-
112
- const Session = new InMemorySession(context);
113
-
114
- Session.getActiveUser();
115
- Session.getEffectiveUser();
116
- Session.getActiveUserLocale();
117
- Session.getScriptTimeZone();
118
- ```
119
-
120
- 現在の `InMemoryContext` は以下の実行形態を扱います。
121
-
122
- - Web App
123
- - Trigger
124
- - Custom Function
125
-
126
- 実行形態、実行ユーザー、owner、domain、OAuth Scope に基づいて Session の user 情報を判定します。
127
-
128
- ### Utilities support
129
-
130
- package entry point から Utilities 実装を支える補助クラスも公開しています。
131
-
132
- - `AppsScriptByte`
133
- - `BinaryData`
134
- - `DateFormatPattern`
135
- - `Md2`
136
- - `PartedDate`
137
- - `StringCode`
138
-
139
- これらは主に `@gasboost/fake-node` の `NodeUtilities` から利用されます。
140
-
141
- 通常の利用では、Node.js 上の Utilities fake として `@gasboost/fake-node` を利用してください。
142
-
143
- ## 責務
144
-
145
- `@gasboost/fake-core` が担当するもの:
146
-
147
- - GAS API の in-memory implementation
148
- - Node.js 固有 API に依存しない fake
149
- - Blob
150
- - Cache / CacheService
151
- - Properties / PropertiesService
152
- - Session と実行コンテキスト
153
- - Utilities 実装を支える共通処理
154
-
155
- Node.js の crypto / zlib などに依存する `Utilities` の実装は `@gasboost/fake-node` が担当します。
156
-
157
- ## 制約
158
-
159
- Google Apps Script ランタイム全体を再現する package ではありません。
160
-
161
- 現在実装されている class / method のみをサポート対象とします。
162
-
163
- ## 関連パッケージ
164
-
165
- - `@gasboost/fake-node` — Node.js 上で動作する Utilities implementation
166
-
167
- ## License
168
-
169
- MIT