diff --git a/AGENTS.md b/AGENTS.md index fbf9895..34f671e 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -61,7 +61,7 @@ core/event/ the change event of patch-it's contract: types, fingerpri core/diff/ core/normalize/ core/hint/ the OpenAPI diff engine and its helpers plugins// one package per kind, with its providers: openapi (+ adapter/, one spec adapter per provider), notices (+ retire/, feed/, eol/), migrationguide (+ sdkguide/, - members/), changelog (Markdown, RST or JSON), catalog, apisurface (+ pysurface/); + members/), changelog (Markdown, RST or JSON), catalog, apisurface (+ pysurface/, dtsurface/); plugins/all imports every one cmd/list-plugins/ prints the list from the registry (make plugins); internal/pluginlist/ is its logic cmd/new-plugin/ scaffolds a provider's source on a kind (make new-plugin ARGS=...; go run ./cmd/new-plugin --help) diff --git a/cmd/new-plugin/formats.go b/cmd/new-plugin/formats.go index 7b08632..f47a7d9 100644 --- a/cmd/new-plugin/formats.go +++ b/cmd/new-plugin/formats.go @@ -27,6 +27,7 @@ var defaultReaders = map[string]string{ "notices": "deprecations", "migrationguide": "sdk", "changelog": "markdown", + "apisurface": "pypi", // npm when a --package is npm: } var formats = map[string]formatSpec{ @@ -541,7 +542,7 @@ func {{.Lower}}Ingest(t *testing.T, file string) []event.Event { imports: []string{"context", "fmt", "os", "github.com/patch-it-dev/patch-it-plugins/plugins/openapi/adapter", "github.com/patch-it-dev/patch-it-plugins/core/event", "github.com/patch-it-dev/patch-it-plugins/core/plugin"}, next: "Write LatestTag, Fetch and Versions in plugins/openapi/adapter/{{.File}}.go (fetch.Get only); add Diff/Keep to the Register line if the spec needs them (see vercel.go).", }, - "apisurface": { + "apisurface/pypi": { kind: "apisurface", layer: "sdk", defDir: "plugins/apisurface", @@ -611,6 +612,82 @@ func {{.Lower}}Ingest(t *testing.T, file string) []event.Event { imports: []string{"archive/zip", "bytes", "context", "fmt", "github.com/patch-it-dev/patch-it-plugins/core/event"}, next: "Save two real wheels of the package and serve them in {{.Lower}}Ingest; the kind reads their .py files, never runs them.", }, + "apisurface/npm": { + kind: "apisurface", + layer: "sdk", + defDir: "plugins/apisurface", + def: `package apisurface + +// {{.Ident}} is {{.Provider}}'s package on npm, its public API read from each +// release's TypeScript declarations. +// +// ` + todo + `: check the name on npm, and that its tarball has .d.ts +// files (package.json's "types" or "exports"). Say what you checked, with +// the date. +var {{.Ident}} = npmPackage("{{.ID}}", "{{.NPM}}") +`, + register: `plugin.Register(Plugin{Package: {{.Ident}}})`, + pluginOf: `Plugin{Package: {{.Ident}}}`, + fixtures: map[string]string{ + "{{.File}}-old.d.ts": "// ` + todo + `: a placeholder for the older release's declarations. Save the real release's tarball instead (see npm_test.go).\nexport declare function placeholder(a: string, b?: number): void;\n", + "{{.File}}-new.d.ts": "// ` + todo + `: a placeholder for the newer release's declarations: b is no longer optional, one event.\nexport declare function placeholder(a: string, b: number): void;\n", + }, + // The drop test's newer release: the older one again, a name added. + dropFile: "// ` + todo + `: a placeholder: a release that only adds.\nexport declare function placeholder(a: string, b?: number): void;\nexport declare function added(): void;\n", + source: "{{.File}}-new.d.ts", + ingest: `// {{.Lower}}Ingest compares two releases: 1.0.0, a tarball holding +// testdata/{{.File}}-old.d.ts as index.d.ts, and 1.1.0, one holding file. +// The tarballs are built here so the placeholders are text. +// ` + todo + `: save the two real tarballs (trimmed if they're large, as +// npm_test.go's are) and serve them instead. +func {{.Lower}}Ingest(t *testing.T, file string) []event.Event { + t.Helper() + tarball := func(src string) []byte { + var buf bytes.Buffer + gz := gzip.NewWriter(&buf) + tw := tar.NewWriter(gz) + for name, body := range map[string][]byte{ + "package/package.json": []byte(` + "`" + `{"name": "{{.NPM}}", "types": "index.d.ts"}` + "`" + `), + "package/index.d.ts": kittest.Read(t, src), + } { + if err := tw.WriteHeader(&tar.Header{Name: name, Mode: 0o644, Size: int64(len(body)), Typeflag: tar.TypeReg}); err != nil { + t.Fatal(err) + } + tw.Write(body) + } + if err := tw.Close(); err != nil { + t.Fatal(err) + } + gz.Close() + return buf.Bytes() + } + reg := "https://registry.npmjs.org/" + strings.ReplaceAll("{{.NPM}}", "/", "%2F") + files := map[string][]byte{ + reg: []byte(` + "`" + `{"versions": {"1.0.0": {}, "1.1.0": {}}, "time": {"1.0.0": "2026-01-01T00:00:00Z", "1.1.0": "2026-02-01T00:00:00Z"}}` + "`" + `), + reg + "/1.0.0": []byte(` + "`" + `{"dist": {"tarball": "https://example.com/{{.File}}-1.0.0.tgz"}}` + "`" + `), + reg + "/1.1.0": []byte(` + "`" + `{"dist": {"tarball": "https://example.com/{{.File}}-1.1.0.tgz"}}` + "`" + `), + "https://example.com/{{.File}}-1.0.0.tgz": tarball("testdata/{{.File}}-old.d.ts"), + "https://example.com/{{.File}}-1.1.0.tgz": tarball(file), + } + env := kittest.Env(t, nil) + env.Get = func(_ context.Context, url string) ([]byte, error) { + if b, ok := files[url]; ok { + return b, nil + } + t.Errorf("fetched %s, which the test didn't save", url) + return nil, fmt.Errorf("no saved copy of %s", url) + } + ctx, p := context.Background(), Plugin{Package: {{.Ident}}} + vs, err := p.ListVersions(ctx, env) + if err != nil || len(vs) != 2 { + t.Fatalf("versions %v: %v", vs, err) + } + return kittest.Versions(t, env, p, vs[0], vs[1]) +} +`, + imports: []string{"archive/tar", "bytes", "compress/gzip", "context", "fmt", "strings", "github.com/patch-it-dev/patch-it-plugins/core/event"}, + next: "Save two real tarballs of the package and serve them in {{.Lower}}Ingest; the kind reads their .d.ts files, never runs them.", + }, } // testFile is the generated test, the same for every format. diff --git a/cmd/new-plugin/main.go b/cmd/new-plugin/main.go index f508721..1f7fba2 100644 --- a/cmd/new-plugin/main.go +++ b/cmd/new-plugin/main.go @@ -176,6 +176,9 @@ func (o Options) template() (string, error) { return o.Kind, nil } r := cmp(o.Reader, defaultReaders[o.Kind]) + if o.Kind == "apisurface" && o.Reader == "" && slices.ContainsFunc(o.Packages, func(p string) bool { return strings.HasPrefix(p, "npm:") }) { + r = "npm" // the package's ecosystem picks the reader + } if _, ok := formats[o.Kind+"/"+r]; !ok { return "", fmt.Errorf("--reader %q: kind %s's readers are %s", o.Reader, o.Kind, readerHelp()) } @@ -192,10 +195,10 @@ var ( // data is what the templates fill in. type data struct { - ID, Name, Ident, Lower, ProviderID, Provider, Source, File, Format, Kind, Module, PyPI string - Slug string // the provider, lowercase: a model subject's provider - SourceFile, DropFile, PluginOf, Ingest, Drop string - Imports []string + ID, Name, Ident, Lower, ProviderID, Provider, Source, File, Format, Kind, Module, PyPI, NPM string + Slug string // the provider, lowercase: a model subject's provider + SourceFile, DropFile, PluginOf, Ingest, Drop string + Imports []string } // Run scaffolds the source, or changes nothing and says why. @@ -233,7 +236,7 @@ func Run(o Options, out io.Writer) error { } } if len(o.Packages) == 0 && f.kind == "apisurface" { - o.Packages = []string{"pypi:" + o.ProviderID} + o.Packages = []string{strings.TrimPrefix(o.tmpl, "apisurface/") + ":" + o.ProviderID} } for _, p := range o.Packages { eco, name, ok := strings.Cut(p, ":") @@ -268,6 +271,13 @@ func Run(o Options, out io.Writer) error { break } } + d.NPM = o.ProviderID + for _, p := range o.Packages { + if name, ok := strings.CutPrefix(p, "npm:"); ok { + d.NPM = name + break + } + } d.Module = strings.ReplaceAll(strings.ToLower(d.PyPI), "-", "_") d.Ident = ident(o.name) d.Lower = string(unicode.ToLower(rune(d.Ident[0]))) + d.Ident[1:] diff --git a/cmd/new-plugin/main_test.go b/cmd/new-plugin/main_test.go index 1ee9952..72f3ad7 100644 --- a/cmd/new-plugin/main_test.go +++ b/cmd/new-plugin/main_test.go @@ -206,7 +206,7 @@ func hash(b []byte) string { // name, category and homepage not asked again. func TestAsksWhatIsMissing(t *testing.T) { o := Options{ProviderID: "stripe"} - in := bufio.NewReader(strings.NewReader("python-sdk\napisurface\nsdk\nhttps://pypi.org/project/stripe/\npypi:stripe\nRemoved names\n")) + in := bufio.NewReader(strings.NewReader("python-sdk\napisurface\npypi\nsdk\nhttps://pypi.org/project/stripe/\npypi:stripe\nRemoved names\n")) var out bytes.Buffer if err := ask(&o, in, &out); err != nil { t.Fatal(err) diff --git a/docs/which-kind.md b/docs/which-kind.md index f2f67c9..41318fd 100644 --- a/docs/which-kind.md +++ b/docs/which-kind.md @@ -13,7 +13,7 @@ Every kind is one of two shapes ([writing-a-plugin.md, step 4](writing-a-plugin. | Is there a **changelog**: a file per release (`CHANGELOG.md`, `CHANGES.rst`, `HISTORY.rst`), or a machine-readable JSON changelog? | `changelog` | The release's section at its tag (reader `markdown`), or the life-cycle entries a JSON changelog adds commit by commit (reader `json`) | Keep a Changelog files; reStructuredText release notes; an API changelog JSON in a repo; a Terraform provider's changelog | | Is there a **live page of dated notices**: a deprecations or shutdown table, an end-of-life table, or an **RSS/Atom feed** of announcements? | `notices` | The page as it is now, cited through a Web Archive snapshot, against the snapshot kept from the read before: a living page, with no versions of its own (reader `deprecations`, `feed`, or an end-of-life table) | A model deprecations page; an API end-of-life policy table; a changelog feed with a "deprecation" label; a Kubernetes API removals page | | Is there a **flat catalog**, one JSON entry per name (a command, an endpoint), with no release tags? | `catalog` | Two snapshots, compared for names that disappeared entirely | A list of commands a server accepts, kept in a repo | -| Is it a **published package** with no changelog worth reading? | `apisurface` | Each release's files from the registry (PyPI first), compared: removed or renamed classes, functions, methods, and parameters removed or newly required | An SDK generated from a spec, released often, whose changelog says "chore: update types" | +| Is it a **published package** with no changelog worth reading? | `apisurface` | Each release's files from the registry (PyPI wheels, npm TypeScript declarations), compared: removed or renamed classes, functions, methods, and parameters removed or newly required | An SDK generated from a spec, released often, whose changelog says "chore: update types" | Still no "yes"? Open a [discussion](https://github.com/patch-it-dev/patch-it-plugins/discussions) with the source's link: a new kind is a new package under `plugins/`, and the questions above get one more row. diff --git a/docs/writing-a-plugin.md b/docs/writing-a-plugin.md index d45df56..173560c 100644 --- a/docs/writing-a-plugin.md +++ b/docs/writing-a-plugin.md @@ -87,7 +87,7 @@ Write the numbers on the provider page, as `providers/vercel.md` does for its sp | `plugins/migrationguide` | A guide that lists what a release removed, at the release's tag: an SDK's migration guide per new major (removed request parameters), or a package's table of removed members (an RST simple table or a Markdown pipe table) | A `sdkguide.Guide` in `plugins/migrationguide/sdkguide/`, or a `members.Guide` in `plugins/migrationguide/members/` | | `plugins/changelog` | A changelog: a `CHANGELOG.md` / `CHANGES.rst` / `HISTORY.rst`, each release's section at its tag (releases from PyPI or npm), or a vendor's machine-readable API changelog in JSON (per day, endpoint and API version, oasdiff change codes), commit by commit | A `changelog.File` with its `TagPrefix`, or a `changelog.Log` | | `plugins/catalog` | A flat JSON catalog, one entry per name, with no release tags to pin — a commit SHA stands in | A `catalog.Catalog`, diffed between two snapshots for names that disappeared entirely | -| `plugins/apisurface` | A published package's public API, compared between two releases: the classes, functions, methods and parameters in each release's files (Python first: the wheel or sdist from PyPI) | A `apisurface.Package` (registry name, ecosystem, top-level module) and its `plugin.RegisterProvider` block | +| `plugins/apisurface` | A published package's public API, compared between two releases: the classes, functions, methods and parameters in each release's files (the wheel or sdist from PyPI, the TypeScript declarations in an npm tarball) | An `apisurface.Package` (registry name, ecosystem, top-level module; `npmPackage` for npm) and its `plugin.RegisterProvider` block | ## 4. The interface @@ -151,6 +151,8 @@ A living page (a deprecations page, a feed: a `notices` source) only shows its l `plugins/apisurface` downloads a release's wheel (or sdist) through `env.Get`, opens it in memory (`archive/zip`, `archive/tar`: nothing is written to disk) and hands the `.py` and `.pyi` files to `plugins/apisurface/pysurface`, which reads them as text: logical lines, indentation, and the headers of `def`, `class`, `__all__` and `from … import`. Nothing in the package is imported, compiled or run. That's the safest way to read code someone else publishes, and it needs no dependency: a Python interpreter (the `ast` module) would mean running a second runtime next to the plugins, and the pure-Go Python parsers available follow old grammars and pull in a large module for what is a few hundred lines here. The cost is that only signatures are read, never what a body does, and anything the reader can't be sure of is left out (see `providers/openai-python-surface.md`). Archive and file sizes are capped (`MaxFileBytes`, `MaxSourceBytes`), so a crafted release can't exhaust the runner. +An npm release is read the same way: its tarball (the version document's `dist.tarball`) is opened in memory and only `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files are kept, for `plugins/apisurface/dtsurface`. Declaration files hold declarations only, never statements, so a tokenizer and a parser of declarations, which skips each type expression by its brackets, read every name, member and parameter a caller can see, in about a thousand lines of standard-library Go. The alternatives would each be worse here: the TypeScript compiler is JavaScript, so it would mean running Node and code from npm next to the plugins; the Go ports of TypeScript's parser are internal to their projects or need cgo (tree-sitter); and a full type checker is far more than a public-API diff needs. No package code runs, no install script runs, no dependency is added (the `make imports` allowlist is unchanged). What it doesn't do, on purpose: resolve types (a property's type isn't followed), or read interface members (see `providers/openai-node-surface.md`). + An event cites the newer release's file, and its excerpt quotes the definition's path and line in both releases. npm packages (`.d.ts` files) are next. ### Register the provider and its source diff --git a/plugins/apisurface/apisurface.go b/plugins/apisurface/apisurface.go index 05e0256..d916c15 100644 --- a/plugins/apisurface/apisurface.go +++ b/plugins/apisurface/apisurface.go @@ -4,11 +4,14 @@ // or renamed, a parameter that is gone, or one that lost its default (callers // must now pass it), is an event. // -// Python first: every release on PyPI (ListVersions), the release's wheel -// (or sdist) read without running any of it (ReadAt: pysurface/ reads the -// .py and .pyi files as text), and the two surfaces compared (Extract). Each -// event cites the release file and quotes the definition's file and line in -// both releases. npm (.d.ts) is a follow-up. +// Every release on PyPI or npm (ListVersions), the release's files read +// without running any of them (ReadAt: pysurface/ reads a wheel's or sdist's +// .py and .pyi files as text; dtsurface/ reads an npm tarball's TypeScript +// declarations, .d.ts, .d.mts and .d.cts, as text), and the two surfaces +// compared (Extract): Python's parameters by name, TypeScript's by +// position. Each event cites the release file and quotes the definition's +// file and line in both releases; one declaration reachable at several +// import paths is one event. // // What isn't read, on purpose (precision over recall): private names (a // leading underscore, a module under a private one or one named internal @@ -40,8 +43,8 @@ import ( type Package struct { ID string // the source id the events carry: "openai/python-surface" Name string // on the registry: "openai" - Ecosystem string // "pypi" - Module string // the top-level import name: "openai" + Ecosystem string // "pypi" or "npm" + Module string // the top-level import name: "openai"; an npm package's own name } // Plugin reads one package's releases. @@ -56,6 +59,8 @@ func (p Plugin) ListVersions(ctx context.Context, env plugin.Env) ([]plugin.Vers switch p.Package.Ecosystem { case "pypi": return versions.PyPIReleases(ctx, env.Get, p.Package.Name) + case "npm": + return versions.NPMReleases(ctx, env.Get, p.Package.Name) default: return nil, fmt.Errorf("%s: reading a %q package's API isn't supported yet", p.Package.Name, p.Package.Ecosystem) } @@ -69,13 +74,20 @@ type Release struct { Classes pysurface.Classes `json:"classes,omitempty"` Bindings pysurface.Bindings `json:"bindings,omitempty"` // what each public module binds Skipped []string `json:"skipped,omitempty"` // files over the size limit + // Positional is a release whose calls pass arguments by position + // (npm, read from TypeScript declarations): parameters compare by + // place, not by name. + Positional bool `json:"positional,omitempty"` } -// ReadAt downloads the release's wheel (or sdist) and reads its public -// surface. The snapshot's content is the surface as JSON, its SourceURL the +// ReadAt downloads the release's wheel (or sdist), or an npm release's +// tarball (readNPM), and reads its public surface. The snapshot's content is the surface as JSON, its SourceURL the // file read. func (p Plugin) ReadAt(ctx context.Context, env plugin.Env, v plugin.Version) (plugin.Snapshot, error) { pkg := p.Package + if pkg.Ecosystem == "npm" { + return p.readNPM(ctx, env, v) + } a, err := pickArtifact(ctx, env, pkg.Name, v.ID) if err != nil { return plugin.Snapshot{}, err @@ -142,6 +154,9 @@ func (p Plugin) event(c Change, from, to plugin.Snapshot, fromFile, toFile strin pkg := p.Package sym := p.local(c.Symbol) subject := event.Subject{Type: event.SubjectPackageRelease, Ecosystem: pkg.Ecosystem, Package: pkg.Name, Change: c.Change, Symbols: []string{sym}} + for _, a := range c.Also { + subject.Symbols = append(subject.Symbols, p.local(a)) + } var desc, hint string switch c.Change { case event.PackageRenamedSymbol: @@ -154,11 +169,18 @@ func (p Plugin) event(c Change, from, to plugin.Snapshot, fromFile, toFile strin case event.PackageRemovedParameter: subject.Parameter = c.Parameter desc = fmt.Sprintf("`%s` no longer takes the parameter `%s` in %s %s: passing it raises a TypeError.", sym, c.Parameter, pkg.Name, to.Version.ID) + if pkg.Ecosystem == "npm" { + desc = fmt.Sprintf("`%s` no longer takes the parameter `%s` in %s %s: TypeScript rejects a call that passes it.", sym, c.Parameter, pkg.Name, to.Version.ID) + } hint = fmt.Sprintf("Stop passing `%s` to `%s`; its signature in %s is quoted in the source excerpt.", c.Parameter, sym, to.Version.ID) case event.PackageChangedDefault: subject.Parameter = c.Parameter desc = fmt.Sprintf("`%s`'s parameter `%s` has no default in %s %s (it was `%s`): a call that leaves it out raises a TypeError.", sym, c.Parameter, pkg.Name, to.Version.ID, c.OldDefault) hint = fmt.Sprintf("Pass `%s=%s` to `%s` to keep the old behavior.", c.Parameter, c.OldDefault, sym) + if pkg.Ecosystem == "npm" { + desc = fmt.Sprintf("`%s`'s parameter `%s` is no longer optional in %s %s: TypeScript rejects a call that leaves it out.", sym, c.Parameter, pkg.Name, to.Version.ID) + hint = fmt.Sprintf("Pass `%s` to `%s`; its signature in %s is quoted in the source excerpt.", c.Parameter, sym, to.Version.ID) + } } return event.Event{ API: pkg.ID, @@ -208,6 +230,9 @@ type Change struct { Before *pysurface.Symbol // its definition in the older release After *pysurface.Symbol // in the newer one; nil when gone Note string + // Also are the other import paths of the same declaration with the + // same change: one declaration is one change. + Also []string } // Compare lists what changed from a to b, sorted by symbol: removed and @@ -277,6 +302,10 @@ func Compare(ra, rb Release) []Change { continue } before, after := old, now + if rb.Positional { + out = append(out, comparePositional(k, old, now, &before, &after)...) + continue + } kwargs := slices.ContainsFunc(now.Params, func(p pysurface.Param) bool { return p.Kind == "kwargs" }) for i, op := range old.Params { if op.Kind == "args" || op.Kind == "kwargs" || (i == 0 && (op.Name == "self" || op.Name == "cls")) { @@ -301,12 +330,86 @@ func Compare(ra, rb Release) []Change { } } } + out = merge(out) slices.SortFunc(out, func(x, y Change) int { return strings.Compare(x.Symbol+" "+x.Parameter+" "+x.Note, y.Symbol+" "+y.Parameter+" "+y.Note) }) return out } +// merge makes the changes one declaration has at several import paths +// (a class defined in one module and re-exported by its package) one +// change: the shortest path is its Symbol, the others its Also. +func merge(cs []Change) []Change { + type key struct { + change event.PackageChange + file, name, sig, parameter string + line int + } + groups := map[key][]int{} + var out []Change + for i, c := range cs { + if c.Before == nil || (c.Change != event.PackageRemovedSymbol && c.Change != event.PackageRemovedParameter && c.Change != event.PackageChangedDefault) { + out = append(out, c) + continue + } + k := key{c.Change, c.Before.File, c.Symbol[strings.LastIndexByte(c.Symbol, '.')+1:], c.Before.Signature, c.Parameter, c.Before.Line} + groups[k] = append(groups[k], i) + } + for _, idx := range groups { + slices.SortFunc(idx, func(x, y int) int { + a, b := cs[x].Symbol, cs[y].Symbol + if len(a) != len(b) { + return len(a) - len(b) + } + return strings.Compare(a, b) + }) + c := cs[idx[0]] + for _, i := range idx[1:] { + c.Also = append(c.Also, cs[i].Symbol) + } + slices.Sort(c.Also) + out = append(out, c) + } + return out +} + +// comparePositional compares two signatures whose arguments are passed by +// position (TypeScript): a parameter gone off the end, when the newer one +// takes no rest parameter, is removed; one optional before and required now, +// under the same name, lost its default (under another name, a parameter +// may have been inserted before it: a note); a rename alone is no change. A required parameter added at the +// end is a note (no subject for it in the contract yet). +func comparePositional(k string, old, now pysurface.Symbol, before, after *pysurface.Symbol) []Change { + var out []Change + rest := slices.ContainsFunc(now.Params, func(p pysurface.Param) bool { return p.Kind == "args" }) + for i, op := range old.Params { + if op.Kind == "args" { + break + } + switch { + case i >= len(now.Params) && rest: + out = append(out, Change{Symbol: k, Note: fmt.Sprintf("%s: parameter %s gone, but a rest parameter still takes it", k, op.Name)}) + case i >= len(now.Params): + out = append(out, Change{Change: event.PackageRemovedParameter, Kind: old.Kind, Symbol: k, Parameter: op.Name, Before: before, After: after}) + case now.Params[i].Kind == "args": + return out + case op.HasDef && !now.Params[i].HasDef && now.Params[i].Name == op.Name: + out = append(out, Change{Change: event.PackageChangedDefault, Kind: old.Kind, Symbol: k, Parameter: op.Name, Before: before, After: after}) + case op.HasDef && !now.Params[i].HasDef: + // Another name at the place: a parameter inserted before it, + // or a rename. Which one can't be told for sure. + out = append(out, Change{Symbol: k, Note: fmt.Sprintf("%s: parameter %d is now %s, required (was %s, optional)", k, i+1, now.Params[i].Name, op.Name)}) + } + } + for i := len(old.Params); i < len(now.Params); i++ { + if np := now.Params[i]; !np.HasDef && np.Kind != "args" && !slices.ContainsFunc(old.Params, func(p pysurface.Param) bool { return p.Kind == "args" }) { + out = append(out, Change{Symbol: k, Note: fmt.Sprintf("%s: new required parameter %s (no subject for it in the contract yet)", k, np.Name)}) + } + } + return out +} + // callerParams are the parameters a caller passes: a leading self or cls // left out. func callerParams(ps []pysurface.Param) []pysurface.Param { @@ -331,7 +434,15 @@ func notGone(k string, before pysurface.Symbol, a, b Release) string { return fmt.Sprintf("%s star-imports names that can't be listed", parentOf(k)) } } - if before.Kind != "method" { + if parent, ok := b.Surface[parentOf(k)]; ok { + switch parent.Kind { + case "export": + return fmt.Sprintf("%s is now re-exported from another package, whose members aren't read", parentOf(k)) + case "variable", "interface", "type": + return fmt.Sprintf("%s is now a %s, whose members aren't read", parentOf(k), parent.Kind) + } + } + if before.Kind != "method" && before.Kind != "property" { return "" } cls, ok := b.Surface[parentOf(k)] @@ -346,6 +457,15 @@ func notGone(k string, before pysurface.Symbol, a, b Release) string { if own, ok := b.Classes[className(cls.Signature)]; ok && slices.Contains(own.Members, name) { return "its class still defines the name (now an attribute)" } + if b.Positional { + // TypeScript: a base class from another package isn't read, and + // may define it. + for _, base := range b.Classes[className(cls.Signature)].Bases { + if _, ours := b.Classes[base]; !ours { + return fmt.Sprintf("its class extends %s, from another package, which may define it", base) + } + } + } seen := map[string]bool{} for len(bases) > 0 { base := bases[0] diff --git a/plugins/apisurface/apisurface_test.go b/plugins/apisurface/apisurface_test.go index d141620..44f2627 100644 --- a/plugins/apisurface/apisurface_test.go +++ b/plugins/apisurface/apisurface_test.go @@ -299,3 +299,79 @@ func TestSelfGoneIsNoRemovedParameter(t *testing.T) { t.Errorf("got %v, want nothing", got) } } + +// TypeScript passes arguments by position: a parameter renamed in place is +// no change; one gone off the end (with no rest parameter now) is removed; +// one optional before and required now, under the same name, lost its +// "default"; a new required one at the end is a note. +func TestPositionalParameters(t *testing.T) { + pos := func(name string, optional bool) pysurface.Param { + return pysurface.Param{Name: name, Kind: "positional", HasDef: optional} + } + rest := pysurface.Param{Name: "args", Kind: "args", HasDef: true} + a := Release{Positional: true, Surface: pysurface.Surface{ + "acme.renamed": sym("function", pos("a", false), pos("b", true)), + "acme.shorter": sym("function", pos("a", false), pos("b", true), pos("c", true)), + "acme.rest": sym("function", pos("a", false), pos("b", true)), + "acme.req": sym("function", pos("a", false), pos("opts", true)), + "acme.grew": sym("function", pos("a", false)), + "acme.inserted": sym("function", pos("a", false), pos("b", true)), + }} + b := Release{Positional: true, Surface: pysurface.Surface{ + "acme.renamed": sym("function", pos("x", false), pos("y", true)), + "acme.shorter": sym("function", pos("a", false)), + "acme.rest": sym("function", pos("a", false), rest), + "acme.req": sym("function", pos("a", false), pos("opts", false)), + "acme.grew": sym("function", pos("a", false), pos("b", false)), + "acme.inserted": sym("function", pos("a", false), pos("x", false), pos("b", true)), + }} + // A required parameter inserted before an optional one (inserted) is a + // note: the optional one wasn't made required, it moved. + want := "note acme.grew\nnote acme.inserted\nchanged_default acme.req opts\nremoved_parameter acme.shorter b\nremoved_parameter acme.shorter c" + if got := strings.Join(changes(a, b), "\n"); got != want { + t.Errorf("got\n%s\nwant\n%s", got, want) + } +} + +// One declaration reachable at several import paths is one change, its +// paths in Also, the shortest first: openai's AgentSessionBudgetReachedEvent +// is exported by openai/resources/beta, .../beta/agents and +// .../beta/agents/agents. +func TestOneDeclarationIsOneChange(t *testing.T) { + d := sym("class") + d.File, d.Line = "acme/agents.d.ts", 7 + other := sym("class") + other.File, other.Line = "acme/other.d.ts", 3 + a := Release{Surface: pysurface.Surface{"acme.beta.Event": d, "acme.beta.agents.Event": d, "acme/x.Event": d, "acme.Other": other}} + got := Compare(a, Release{Surface: pysurface.Surface{}}) + if len(got) != 2 || got[0].Symbol != "acme.Other" || got[1].Symbol != "acme/x.Event" || strings.Join(got[1].Also, ",") != "acme.beta.Event,acme.beta.agents.Event" { + for _, c := range got { + t.Logf("%s %v", c.Symbol, c.Also) + } + t.Errorf("got %d changes", len(got)) + } +} + +// npm: a member of a name now re-exported from another package, or now a +// value or a type (whose members aren't read) may still be there +// (@sentry/node 11.13.0's logger, a namespace made a const object); a method gone from a class that extends a class of +// another package may be that class's (@neondatabase/serverless 1.0.0's +// Pool.connect, pg's). Notes. +func TestNPMNotesForWhatAnotherPackageMayHold(t *testing.T) { + a := Release{Positional: true, Surface: pysurface.Surface{ + "acme.logger": sym("namespace"), "acme.logger.info": sym("function"), + "acme.log2": sym("namespace"), "acme.log2.info": sym("function"), + "acme.Pool": cls("class Pool extends Pool_2"), "acme.Pool.connect": sym("method"), + "acme.Own": cls("class Own extends Base"), "acme.Own.gone": sym("method"), + }, Classes: pysurface.Classes{"Pool": {Bases: []string{"Pool_2"}}, "Own": {Bases: []string{"Base"}}, "Base": {}}} + b := Release{Positional: true, Surface: pysurface.Surface{ + "acme.logger": {Kind: "export", File: "x.d.ts", Line: 1, Signature: "export { logger } from \"@acme/core\""}, + "acme.log2": sym("variable"), + "acme.Pool": cls("class Pool extends Pool_2"), + "acme.Own": cls("class Own extends Base"), + }, Classes: pysurface.Classes{"Pool": {Bases: []string{"Pool_2"}}, "Own": {Bases: []string{"Base"}}, "Base": {}}} + want := "removed_symbol acme.Own.gone \nnote acme.Pool.connect\nnote acme.log2.info\nnote acme.logger.info" + if got := strings.Join(changes(a, b), "\n"); got != want { + t.Errorf("got\n%s\nwant\n%s", got, want) + } +} diff --git a/plugins/apisurface/dtsurface/dtsurface_test.go b/plugins/apisurface/dtsurface/dtsurface_test.go new file mode 100644 index 0000000..94aca92 --- /dev/null +++ b/plugins/apisurface/dtsurface/dtsurface_test.go @@ -0,0 +1,197 @@ +package dtsurface + +import ( + "slices" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/plugins/apisurface/pysurface" +) + +const pkgJSON = `{"name": "acme", "types": "./index.d.ts", + "exports": { + ".": {"import": {"types": "./index.d.mts", "default": "./index.mjs"}, "require": {"types": "./index.d.ts", "default": "./index.js"}}, + "./resources/*": {"import": "./resources/*.mjs", "require": "./resources/*.js"}, + "./resources/*.js": {"default": "./resources/*.js"}, + "./_shims/*": {"default": "./_shims/*.js"}, + "./index": {"default": "./index.js"}, + "./package.json": "./package.json" + }}` + +// index.d.mts is what the "." entry reads (the import condition first). +const indexDTS = `/** The client. */ +export { Acme as default } from "./client.mjs"; +export { Acme, type ClientOptions } from "./client.mjs"; +export * from "./errors.mjs"; +export * from "@acme/core"; +export { helper } from "@acme/helpers"; +` + +const clientDTS = `import * as API from "./resources/index.mjs"; +import { Chat } from "./resources/chat.mjs"; +export interface ClientOptions { apiKey?: string; timeout?: number } +export declare class Acme { + #private; + constructor({ apiKey, ...opts }?: ClientOptions); + chat: API.Chat; + private secret; + protected base(): void; + /** @internal */ + debug(x: string): void; + get baseURL(): string; + set baseURL(v: string); + static readonly VERSION: string; + withOptions(options: Partial): this; + request(this: Acme, path: string, init?: { method?: "GET" | "POST"; body?: Record>> }): Promise; + stream(path: string): AsyncIterable; + stream(path: string, signal: AbortSignal): AsyncIterable; +} +export declare namespace Acme { + export { Chat as Chat }; + export type RequestOptions = { retries?: number }; +} +` + +const chatDTS = `import { APIResource } from "../core/resource.mjs"; +export declare class Chat extends APIResource { + create(body: ChatCreateParams, options?: RequestOptions): Promise; + list(query?: ListParams | null, ...rest: unknown[]): Promise; +} +export declare namespace Chat { + export { type ChatCompletion as ChatCompletion }; +} +export interface ChatCompletion { id: string } +export type ChatCreateParams = { model: string; messages: Array<{ role: string }> } +export declare function toFile(value: Blob | string, name?: string | null): Promise +` + +const errorsDTS = `export declare class AcmeError extends Error {} +export declare class APIError extends AcmeError { + readonly status: TStatus; + constructor(status: TStatus, error: object | undefined, message: string | undefined); +} +export declare const NotFoundError: typeof APIError; +export declare enum Role { User = "user", Assistant = "assistant" } +declare function internalOnly(): void; +` + +func readAcme(t *testing.T) pysurface.Surface { + t.Helper() + s, _, _ := Read("acme", []File{ + {"package.json", pkgJSON}, + {"index.d.mts", indexDTS}, + {"index.d.ts", "export {};\n"}, + {"client.d.mts", clientDTS}, + {"resources/chat.d.mts", chatDTS}, + {"resources/index.d.mts", `export { Chat, type ChatCompletion } from "./chat.mjs";` + "\n"}, + {"errors.d.mts", errorsDTS}, + {"core/resource.d.mts", "export declare class APIResource { protected _client: unknown }\n"}, + {"_shims/node.d.mts", "export declare function shim(): void;\n"}, + }) + return s +} + +func keys(s pysurface.Surface) []string { + var out []string + for k := range s { + out = append(out, k) + } + slices.Sort(out) + return out +} + +// Every entry point's exports and what its classes and namespaces hold; +// private and protected members, @internal ones, the setter, private +// entry points (_shims), types inside a namespace, and what another +// package exports wholesale are left out. +func TestRead(t *testing.T) { + s := readAcme(t) + want := []string{ + "acme.APIError", "acme.APIError.status", "acme.Acme", "acme.Acme.Chat", "acme.Acme.Chat.create", "acme.Acme.Chat.list", + "acme.Acme.VERSION", "acme.Acme.baseURL", "acme.Acme.chat", "acme.Acme.request", "acme.Acme.stream", "acme.Acme.withOptions", + "acme.AcmeError", "acme.ClientOptions", "acme.NotFoundError", "acme.Role", "acme.default", "acme.helper", + "acme/resources/chat.Chat", "acme/resources/chat.Chat.create", "acme/resources/chat.Chat.list", + "acme/resources/chat.ChatCompletion", "acme/resources/chat.ChatCreateParams", "acme/resources/chat.toFile", + } + if got := keys(s); !slices.Equal(got, want) { + t.Errorf("got\n %s\nwant\n %s", strings.Join(got, "\n "), strings.Join(want, "\n ")) + } + c := s["acme.Acme"] + if c.Kind != "class" || c.File != "client.d.mts" || c.Line != 4 || len(c.Params) != 1 || !c.Params[0].HasDef { + t.Errorf("Acme: %+v", c) + } + if r := s["acme.Acme.request"]; len(r.Params) != 2 || r.Params[0].Name != "path" || r.Params[0].HasDef || !r.Params[1].HasDef { + t.Errorf("request (this left out, init optional): %+v", r) + } + if st := s["acme.Acme.stream"]; !st.Overloaded || st.Params != nil { + t.Errorf("stream: %+v", st) + } + if l := s["acme.Acme.Chat.list"]; len(l.Params) != 2 || l.Params[1].Kind != "args" { + t.Errorf("list: %+v", l) + } + if f := s["acme/resources/chat.toFile"]; f.Kind != "function" || len(f.Params) != 2 || !f.Params[1].HasDef || f.Line != 11 { + t.Errorf("toFile (no ; at the end): %+v", f) + } + if h := s["acme.helper"]; h.Kind != "export" || !strings.Contains(h.Signature, `from "@acme/helpers"`) { + t.Errorf("helper: %+v", h) + } + if e := s["acme.APIError"]; len(e.Params) != 3 || e.Signature != "class APIError extends AcmeError / constructor(status: TStatus, error: object | undefined, message: string | undefined)" { + t.Errorf("APIError: %+v", e) + } +} + +// What each entry point exports, Star when it re-exports another package +// wholesale; the classes with their bases. +func TestBindingsAndClasses(t *testing.T) { + _, c, b := Read("acme", []File{ + {"package.json", pkgJSON}, + {"index.d.mts", indexDTS}, + {"client.d.mts", clientDTS}, + {"errors.d.mts", errorsDTS}, + {"resources/chat.d.mts", chatDTS}, + {"core/resource.d.mts", "export declare class APIResource { protected _client: unknown }\n"}, + }) + if m := b["acme"]; !m.Star || !slices.Contains(m.Names, "AcmeError") || !slices.Contains(m.Names, "default") { + t.Errorf("acme binds %+v", m) + } + if ch := c["Chat"]; !slices.Equal(ch.Bases, []string{"APIResource"}) || !slices.Equal(ch.Members, []string{"create", "list"}) { + t.Errorf("Chat: %+v", ch) + } +} + +// A declaration file of an older style: `export =` a namespace merged with +// a function, no package.json exports, members of an ambient namespace +// exported without the keyword. +func TestExportAssignment(t *testing.T) { + s, _, _ := Read("old", []File{ + {"package.json", `{"name": "old", "typings": "types/index.d.ts"}`}, + {"types/index.d.ts", "declare function old(a: string): old.Result;\ndeclare namespace old {\n interface Result { ok: boolean }\n function parse(s: string, strict?: boolean): Result\n class Parser { parse(s: string): Result }\n}\nexport = old;\n"}, + }) + want := []string{"old.Parser", "old.Parser.parse", "old.Result", "old.parse"} + if got := keys(s); !slices.Equal(got, want) { + t.Errorf("got %v, want %v", got, want) + } +} + +// The tokenizer: comments, strings with escapes, template literal types, +// and ">>" closing two generics. +func TestLex(t *testing.T) { + var got []string + for _, tk := range lex("/** doc */ type A = `x${\"}\"}y` | 'q\\'' // c\nArray>;") { + got = append(got, tk.text) + } + want := []string{"type", "A", "<", "T", ">", "=", "`x${\"}\"}y`", "|", "q'", "Array", "<", "Array", "<", "T", ">", ">", ";", ""} + if !slices.Equal(got, want) { + t.Errorf("got %q\nwant %q", got, want) + } +} + +// A release is data: a cut-off or malformed file is read as far as it goes, +// never in a loop and never a panic. +func TestATruncatedFileEnds(t *testing.T) { + src := clientDTS + chatDTS + errorsDTS + for i := 0; i < len(src); i += 7 { + Read("acme", []File{{"package.json", `{"name": "acme", "types": "index.d.ts"}`}, {"index.d.ts", src[:i]}}) + } + Read("acme", []File{{"index.d.ts", "export { a as } from; class { constructor( ; namespace . { export * as from"}}) +} diff --git a/plugins/apisurface/dtsurface/lex.go b/plugins/apisurface/dtsurface/lex.go new file mode 100644 index 0000000..134076c --- /dev/null +++ b/plugins/apisurface/dtsurface/lex.go @@ -0,0 +1,132 @@ +// Package dtsurface reads an npm package's public API from its TypeScript +// declaration files (.d.ts, .d.mts, .d.cts) as text: the names each entry +// point of the package exports, and for classes, functions and namespaces +// what they hold, with every parameter and whether it's optional. Nothing in +// the package is run: declaration files hold declarations only, so a +// tokenizer and a parser of declarations, which skips over type expressions +// by their brackets, read all a caller can see. +package dtsurface + +import ( + "strings" +) + +// token is one lexical token of a declaration file. +type token struct { + kind string // "id", "str" (its value unquoted), "num", "punct", "eof" + text string + line int + // doc is the JSDoc comment (/** ... */) right before the token, if any: + // where @internal is said. + doc string +} + +// lex splits src into tokens. Comments are dropped (a JSDoc comment is kept +// on the token after it); strings and template literals are one token each; +// "=>", "...", "?." and "?:" are one token; every other punctuation mark is +// its own token, so "Array>" closes with two ">". +func lex(src string) []token { + var out []token + line, doc := 1, "" + i := 0 + for i < len(src) { + c := src[i] + switch { + case c == '\n': + line++ + i++ + case c == ' ' || c == '\t' || c == '\r' || c == '\f' || c == '\v' || c == 0xEF || c == 0xBB || c == 0xBF: + i++ // whitespace, and a UTF-8 byte order mark + case c == '/' && i+1 < len(src) && src[i+1] == '/': + for i < len(src) && src[i] != '\n' { + i++ + } + case c == '/' && i+1 < len(src) && src[i+1] == '*': + end := strings.Index(src[i+2:], "*/") + if end < 0 { + end = len(src) - i - 2 + } + body := src[i : i+2+end] + if strings.HasPrefix(body, "/**") { + doc = body + } + line += strings.Count(body, "\n") + i += 2 + end + 2 + case c == '"' || c == '\'': + j := i + 1 + var b strings.Builder + for j < len(src) && src[j] != c && src[j] != '\n' { + if src[j] == '\\' && j+1 < len(src) { + j++ + } + b.WriteByte(src[j]) + j++ + } + out = append(out, token{kind: "str", text: b.String(), line: line, doc: doc}) + doc = "" + i = j + 1 + case c == '`': + // A template literal type: skipped whole, ${...} nesting + // included. + j, depth := i+1, 0 + for j < len(src) { + if src[j] == '\\' { + j += 2 + continue + } + if src[j] == '\n' { + line++ + } + if depth == 0 && src[j] == '`' { + break + } + if src[j] == '$' && j+1 < len(src) && src[j+1] == '{' { + depth++ + j += 2 + continue + } + if depth > 0 && src[j] == '}' { + depth-- + } + j++ + } + out = append(out, token{kind: "str", text: src[i:min(j+1, len(src))], line: line, doc: doc}) + doc = "" + i = j + 1 + case isIdentStart(c): + j := i + 1 + for j < len(src) && isIdentPart(src[j]) { + j++ + } + out = append(out, token{kind: "id", text: src[i:j], line: line, doc: doc}) + doc = "" + i = j + case c >= '0' && c <= '9': + j := i + 1 + for j < len(src) && (isIdentPart(src[j]) || src[j] == '.') { + j++ + } + out = append(out, token{kind: "num", text: src[i:j], line: line, doc: doc}) + doc = "" + i = j + default: + p := string(c) + for _, two := range []string{"=>", "...", "?.", "?:"} { + if strings.HasPrefix(src[i:], two) { + p = two + break + } + } + out = append(out, token{kind: "punct", text: p, line: line, doc: doc}) + doc = "" + i += len(p) + } + } + return append(out, token{kind: "eof", line: line}) +} + +func isIdentStart(c byte) bool { + return c == '_' || c == '$' || c >= 'a' && c <= 'z' || c >= 'A' && c <= 'Z' || c >= 0x80 +} + +func isIdentPart(c byte) bool { return isIdentStart(c) || c >= '0' && c <= '9' } diff --git a/plugins/apisurface/dtsurface/parse.go b/plugins/apisurface/dtsurface/parse.go new file mode 100644 index 0000000..fb744c7 --- /dev/null +++ b/plugins/apisurface/dtsurface/parse.go @@ -0,0 +1,848 @@ +package dtsurface + +import ( + "strings" +) + +// Param is one parameter of a function, method or constructor, in order. A +// TypeScript call passes arguments by position, so a parameter's name is +// for reading only: Optional is what a caller relies on. +type Param struct { + Name string + Optional bool // marked ?, or the rest parameter + Rest bool // ...args +} + +// decl is one declaration of a name in a scope. Declarations of the same +// name merge (a class and a namespace, a function's overloads). +type decl struct { + kind string // "class", "function", "interface", "type", "enum", "variable", "namespace" + name string + file string + line int + sig string + exported bool + params []Param + hasParam bool // params were read (a function, a class's constructor) + ctors int // a class's constructor declarations + bases []string + members []*member + ns *scope // a namespace's (or a module declaration's) body +} + +// member is one public member of a class: a method or a property. +type member struct { + kind string // "method", "property" + name string + line int + sig string + params []Param + static bool +} + +// scope is a module (a declaration file), a namespace's body or an ambient +// module declaration's body. +type scope struct { + file string + parent *scope + decls map[string][]*decl + order []string + exports map[string]exportRef + stars []starRef + imports map[string]importRef + aliases map[string]string // import X = A.B.C + // assign is `export = X`: the module is X. + assign string + // explicit is true once the scope says export anywhere: in an ambient + // namespace, only then are its unexported declarations hidden. + explicit bool + ambient bool // a namespace or module declaration's body +} + +type exportRef struct { + local string // `export { local as name }`, or a declaration's own name + spec string // `export { name } from "spec"`: the module it's from + name string // its name there; "*" for `export * as name from` + line int + sig string +} + +type starRef struct { + spec string + line int +} + +type importRef struct { + spec string + name string // "*" for `import * as X`, "default", "=" for `import X = require()` +} + +func newScope(file string, parent *scope, ambient bool) *scope { + return &scope{file: file, parent: parent, decls: map[string][]*decl{}, exports: map[string]exportRef{}, imports: map[string]importRef{}, aliases: map[string]string{}, ambient: ambient} +} + +func (s *scope) add(d *decl) { + if _, ok := s.decls[d.name]; !ok { + s.order = append(s.order, d.name) + } + s.decls[d.name] = append(s.decls[d.name], d) +} + +// parser reads one file's tokens. +type parser struct { + toks []token + pos int + file string + modules map[string]*scope // `declare module "spec" { }` bodies, by spec +} + +func (p *parser) peek() token { return p.toks[p.pos] } +func (p *parser) at(n int) token { return p.toks[min(p.pos+n, len(p.toks)-1)] } +func (p *parser) next() token { t := p.toks[p.pos]; p.pos = min(p.pos+1, len(p.toks)-1); return t } +func (p *parser) is(s string) bool { + t := p.peek() + return (t.kind == "punct" || t.kind == "id") && t.text == s +} +func (p *parser) eat(s string) bool { + if p.is(s) { + p.next() + return true + } + return false +} + +// parseFile reads a declaration file into its module scope; ambient module +// declarations ("declare module 'x'") go to modules, merged by spec. +func parseFile(file, src string, modules map[string]*scope) *scope { + p := &parser{toks: lex(src), file: file, modules: modules} + sc := newScope(file, nil, false) + p.block(sc, false) + return sc +} + +// block reads statements until "}" (when inBraces) or the end. +func (p *parser) block(sc *scope, inBraces bool) { + for { + t := p.peek() + if t.kind == "eof" { + return + } + if inBraces && t.kind == "punct" && t.text == "}" { + p.next() + return + } + start := p.pos + p.statement(sc) + if p.pos == start { + p.next() // never stall + } + } +} + +var modifiers = map[string]bool{"declare": true, "abstract": true, "async": true} + +// statement reads one statement of a scope. +func (p *parser) statement(sc *scope) { + t := p.peek() + if t.kind == "punct" && t.text == ";" { + p.next() + return + } + internal := strings.Contains(t.doc, "@internal") + line := t.line + exported, isDefault := false, false + if p.is("export") { + sc.explicit = true + p.next() + exported = true + switch { + case p.is("{") || (p.is("type") && p.at(1).text == "{"): + p.eat("type") + p.exportList(sc, line) + return + case p.is("*"): + p.next() + if p.eat("as") { + name := p.next().text + p.eat("from") + spec := p.next().text + sc.exports[name] = exportRef{spec: spec, name: "*", line: line, sig: "export * as " + name + " from " + quote(spec)} + } else { + p.eat("from") + sc.stars = append(sc.stars, starRef{spec: p.next().text, line: line}) + } + p.eat(";") + return + case p.is("="): + p.next() + sc.assign = p.dotted() + p.eat(";") + return + case p.is("as") && p.at(1).text == "namespace": + p.skipStatement() + return + case p.is("import"): + p.next() + name := p.next().text + if p.eat("=") { + sc.aliases[name] = p.dotted() + sc.exports[name] = exportRef{local: name, line: line, sig: "export import " + name + " = " + sc.aliases[name]} + } + p.eat(";") + return + case p.is("default"): + p.next() + isDefault = true + if !p.isDeclStart() { + local := p.dotted() + if local != "" { + sc.exports["default"] = exportRef{local: local, line: line, sig: "export default " + local} + } + p.skipStatement() + return + } + } + } + if p.is("import") { + p.importStatement(sc) + return + } + for p.peek().kind == "id" && modifiers[p.peek().text] && p.at(1).kind == "id" { + p.next() + } + kw := p.peek() + if kw.kind != "id" { + p.skipStatement() + return + } + var ds []*decl + switch kw.text { + case "class": + ds = []*decl{p.class()} + case "function": + ds = []*decl{p.function()} + case "interface": + ds = []*decl{p.interfaceDecl()} + case "type": + ds = []*decl{p.typeAlias()} + case "enum": + ds = []*decl{p.enum()} + case "const": + if p.at(1).text == "enum" { + p.next() + ds = []*decl{p.enum()} + } else { + ds = p.variables() + } + case "let", "var": + ds = p.variables() + case "namespace", "module": + if p.at(1).kind == "str" { + p.next() + spec := p.next().text + if p.is("{") { + p.next() + m := p.modules[spec] + if m == nil { + m = newScope(p.file, nil, true) + p.modules[spec] = m + } + m.file = p.file + p.block(m, true) + } else { + p.eat(";") + } + return + } + ds = []*decl{p.namespace(sc)} + case "global": + p.next() + p.skipBalanced() + return + default: + p.skipStatement() + return + } + for _, d := range ds { + if d == nil || d.name == "" || internal { + continue + } + d.line = line + // `export default class X` exports X as default, not by its name. + d.exported = exported && !isDefault + if isDefault { + sc.exports["default"] = exportRef{local: d.name, line: line, sig: d.sig} + } + sc.add(d) + } +} + +// isDeclStart is a declaration after `export default`. +func (p *parser) isDeclStart() bool { + i := 0 + for p.at(i).kind == "id" && modifiers[p.at(i).text] { + i++ + } + switch p.at(i).text { + case "class", "function", "interface", "enum": + return p.at(i).kind == "id" + } + return false +} + +// exportList reads `{ a, b as c, type d } [from "spec"];`. +func (p *parser) exportList(sc *scope, line int) { + p.next() // { + type item struct{ name, as string } + var items []item + for !p.is("}") && p.peek().kind != "eof" { + p.eat("type") + n := p.next().text + as := n + if p.eat("as") { + as = p.next().text + } + items = append(items, item{n, as}) + p.eat(",") + } + p.eat("}") + spec := "" + if p.eat("from") { + spec = p.next().text + } + p.eat(";") + for _, it := range items { + if it.as == "" { + continue + } + sig := "export { " + it.name + if it.as != it.name { + sig += " as " + it.as + } + sig += " }" + if spec != "" { + sc.exports[it.as] = exportRef{spec: spec, name: it.name, line: line, sig: sig + " from " + quote(spec)} + } else { + sc.exports[it.as] = exportRef{local: it.name, line: line, sig: sig} + } + } +} + +// importStatement reads every form of import into sc's imports. +func (p *parser) importStatement(sc *scope) { + p.next() // import + if p.peek().kind == "str" { + p.skipStatement() + return + } + p.eat("type") + if p.peek().kind == "id" && p.at(1).text == "=" { + name := p.next().text + p.next() // = + if p.eat("require") { + p.eat("(") + spec := p.next().text + p.eat(")") + sc.imports[name] = importRef{spec: spec, name: "="} + } else { + sc.aliases[name] = p.dotted() + } + p.eat(";") + return + } + var pending []func(spec string) + for !p.is("from") && p.peek().kind != "eof" && !p.is(";") { + switch { + case p.is("*"): + p.next() + p.eat("as") + n := p.next().text + pending = append(pending, func(spec string) { sc.imports[n] = importRef{spec: spec, name: "*"} }) + case p.is("{"): + p.next() + for !p.is("}") && p.peek().kind != "eof" { + p.eat("type") + n := p.next().text + as := n + if p.eat("as") { + as = p.next().text + } + pending = append(pending, func(spec string) { sc.imports[as] = importRef{spec: spec, name: n} }) + p.eat(",") + } + p.eat("}") + case p.peek().kind == "id": + n := p.next().text + pending = append(pending, func(spec string) { sc.imports[n] = importRef{spec: spec, name: "default"} }) + default: + p.next() + } + p.eat(",") + } + if p.eat("from") { + spec := p.next().text + for _, f := range pending { + f(spec) + } + } + p.skipStatement() +} + +// dotted reads a name like A.B.C. +func (p *parser) dotted() string { + var parts []string + for p.peek().kind == "id" { + parts = append(parts, p.next().text) + if !p.eat(".") { + break + } + } + return strings.Join(parts, ".") +} + +// class reads a class declaration and its public members. +func (p *parser) class() *decl { + start := p.pos + p.next() // class + d := &decl{kind: "class", file: p.file} + if p.peek().kind == "id" && p.peek().text != "extends" && p.peek().text != "implements" { + d.name = p.next().text + } + if p.is("<") { + p.skipBalanced() + } + if p.eat("extends") { + base := "" + for p.peek().kind == "id" { + base = p.next().text + if !p.eat(".") { + break + } + } + if p.is("(") { + base = "" // a mixin call: its members aren't known + } + for !p.is("{") && !p.is("implements") && p.peek().kind != "eof" { + p.skipOne() + } + if base != "" { + d.bases = append(d.bases, base) + } + } + for !p.is("{") && p.peek().kind != "eof" { + p.skipOne() + } + d.sig = p.text(start, p.pos) + p.next() // { + p.classBody(d) + return d +} + +var memberModifiers = map[string]bool{"public": true, "static": true, "readonly": true, "abstract": true, "declare": true, "override": true, "accessor": true, "async": true} + +// classBody reads members until "}". +func (p *parser) classBody(d *decl) { + for !p.is("}") && p.peek().kind != "eof" { + t := p.peek() + if t.kind == "punct" && t.text == ";" { + p.next() + continue + } + start := p.pos + internal := strings.Contains(t.doc, "@internal") + hidden, static := false, false + for p.peek().kind == "id" && (memberModifiers[p.peek().text] || p.peek().text == "private" || p.peek().text == "protected") { + n := p.at(1) + if n.kind == "punct" && (n.text == "(" || n.text == ":" || n.text == "?" || n.text == ";" || n.text == "<" || n.text == "?:") { + break // a member named like a modifier + } + switch p.peek().text { + case "private", "protected": + hidden = true + case "static": + static = true + } + p.next() + } + accessor := "" + if (p.is("get") || p.is("set")) && (p.at(1).kind == "id" || p.at(1).kind == "str") { + accessor = p.next().text + } + name := p.peek() + switch { + case name.kind == "punct" && name.text == "[": + p.skipMember() + continue + case name.kind == "punct" && name.text == "#": + p.skipMember() + continue + case name.kind != "id" && name.kind != "str" && name.kind != "num": + p.skipMember() + continue + } + p.next() + p.eat("?") + p.eat("!") + m := &member{name: name.text, line: t.line, static: static} + switch { + case p.is("(") || p.is("<"): + if p.is("<") { + p.skipBalanced() + } + params := p.params() + p.skipMember() + m.sig = p.text(start, p.pos) + if name.text == "constructor" && !static { + if !hidden && !internal { + d.ctors++ + d.params, d.hasParam = params, true + d.sig = strings.TrimSuffix(d.sig, " {") + " / " + m.sig + } + continue + } + m.kind, m.params = "method", params + if accessor != "" { + m.kind, m.params = "property", nil + } + default: + p.skipMember() + m.kind = "property" + m.sig = p.text(start, p.pos) + } + if hidden || internal || accessor == "set" && hasMember(d, m.name) { + continue + } + d.members = append(d.members, m) + } + p.eat("}") +} + +func hasMember(d *decl, name string) bool { + for _, m := range d.members { + if m.name == name { + return true + } + } + return false +} + +// skipMember skips to the end of a class member: its ";" (or the "}" that +// closes the class, left unread), types in brackets skipped whole. +func (p *parser) skipMember() { + for { + t := p.peek() + switch { + case t.kind == "eof": + return + case t.kind == "punct" && t.text == ";": + p.next() + return + case t.kind == "punct" && t.text == "}": + return + case t.kind == "punct" && isOpen(t.text): + p.skipBalanced() + default: + line := t.line + p.next() + // A member ends at its line's end when the file leaves out ";". + if n := p.peek(); n.line > line && n.kind == "id" && !continues(t) && memberStart(p) { + return + } + } + } +} + +// memberStart is a token that starts a new member: a name followed by +// "(", ":", "?" or ";", or a modifier. +func memberStart(p *parser) bool { + t, n := p.peek(), p.at(1) + if memberModifiers[t.text] || t.text == "private" || t.text == "protected" || t.text == "constructor" { + return true + } + return n.kind == "punct" && (n.text == "(" || n.text == ":" || n.text == "?" || n.text == "?:" || n.text == ";" || n.text == "<") +} + +// continues is a token after which a type goes on: an operator, a comma, a +// colon. +func continues(t token) bool { + if t.kind == "punct" { + switch t.text { + case "|", "&", ":", ",", "=", "=>", ".", "?", "?:", "<", "(", "[", "{": + return true + } + } + switch t.text { + case "keyof", "typeof", "extends", "infer", "is", "new", "readonly", "unique", "asserts": + return true + } + return false +} + +// params reads "( ... )": each parameter's name, whether it's optional or +// the rest; a `this` parameter (not an argument) is left out. +func (p *parser) params() []Param { + out := []Param{} + if !p.eat("(") { + return out + } + for !p.is(")") && p.peek().kind != "eof" { + for p.peek().kind == "id" && (memberModifiers[p.peek().text] || p.peek().text == "private" || p.peek().text == "protected") && p.at(1).kind == "id" { + p.next() + } + var prm Param + if p.eat("...") { + prm.Rest, prm.Optional = true, true + } + switch t := p.peek(); { + case t.kind == "punct" && (t.text == "{" || t.text == "["): + p.skipBalanced() + prm.Name = "(destructured)" + default: + prm.Name = p.next().text + } + if p.eat("?") || p.is("?:") { + prm.Optional = true + if p.is("?:") { + p.next() + p.skipType(",", ")") + } + } + if p.eat(":") { + p.skipType(",", ")") + } + if p.eat("=") { + prm.Optional = true + p.skipType(",", ")") + } + if prm.Name != "this" { + out = append(out, prm) + } + p.eat(",") + } + p.eat(")") + return out +} + +// skipType skips a type up to one of stops at depth 0, left unread. +func (p *parser) skipType(stops ...string) { + for { + t := p.peek() + if t.kind == "eof" { + return + } + if t.kind == "punct" { + for _, s := range stops { + if t.text == s { + return + } + } + if isOpen(t.text) { + p.skipBalanced() + continue + } + if isClose(t.text) { + return + } + } + p.next() + } +} + +// function reads `function name<...>(params): T;`. +func (p *parser) function() *decl { + start := p.pos + p.next() // function + p.eat("*") + d := &decl{kind: "function", file: p.file} + if p.peek().kind == "id" { + d.name = p.next().text + } + if p.is("<") { + p.skipBalanced() + } + d.params, d.hasParam = p.params(), true + p.skipStatement() + d.sig = p.text(start, p.pos) + return d +} + +func (p *parser) interfaceDecl() *decl { + start := p.pos + p.next() + d := &decl{kind: "interface", file: p.file, name: p.next().text} + for !p.is("{") && p.peek().kind != "eof" { + p.skipOne() + } + d.sig = p.text(start, p.pos) + p.skipBalanced() + return d +} + +func (p *parser) typeAlias() *decl { + start := p.pos + p.next() + d := &decl{kind: "type", file: p.file, name: p.next().text} + if p.is("<") { + p.skipBalanced() + } + d.sig = p.text(start, p.pos) + p.skipStatement() + return d +} + +func (p *parser) enum() *decl { + start := p.pos + p.next() + d := &decl{kind: "enum", file: p.file, name: p.next().text} + d.sig = p.text(start, p.pos) + if p.is("{") { + p.skipBalanced() + } + return d +} + +// variables reads `const a: A, b: B;`. +func (p *parser) variables() []*decl { + start := p.pos + p.next() + var out []*decl + for p.peek().kind == "id" { + d := &decl{kind: "variable", file: p.file, name: p.next().text} + out = append(out, d) + p.skipType(",", ";", "}") + if !p.eat(",") { + break + } + } + p.eat(";") + sig := p.text(start, p.pos) + for _, d := range out { + d.sig = sig + } + return out +} + +// namespace reads `namespace A.B { ... }` as A, with B a namespace inside. +func (p *parser) namespace(parent *scope) *decl { + start := p.pos + p.next() + names := strings.Split(p.dotted(), ".") + d := &decl{kind: "namespace", file: p.file, name: names[0]} + d.sig = p.text(start, p.pos) + if !p.is("{") { + p.skipStatement() + return d + } + p.next() + outer := newScope(p.file, parent, true) + d.ns = outer + in := outer + for _, n := range names[1:] { + inner := &decl{kind: "namespace", file: p.file, name: n, sig: d.sig, exported: true} + inner.ns = newScope(p.file, in, true) + in.add(inner) + in = inner.ns + } + p.block(in, true) + return d +} + +func isOpen(s string) bool { return s == "(" || s == "[" || s == "{" || s == "<" } +func isClose(s string) bool { return s == ")" || s == "]" || s == "}" || s == ">" } + +// skipBalanced skips from an opening bracket to its match. +func (p *parser) skipBalanced() { + depth := 0 + for { + t := p.next() + if t.kind == "eof" { + return + } + if t.kind != "punct" { + continue + } + if isOpen(t.text) { + depth++ + } else if isClose(t.text) { + depth-- + if depth <= 0 { + return + } + } + } +} + +// skipOne skips a token, or a bracketed group whole. +func (p *parser) skipOne() { + if t := p.peek(); t.kind == "punct" && isOpen(t.text) { + p.skipBalanced() + return + } + p.next() +} + +// skipStatement skips to the end of a statement: its ";", or the line's +// end where the file leaves ";" out, or a "}" closing the scope (unread). +func (p *parser) skipStatement() { + for { + t := p.peek() + switch { + case t.kind == "eof": + return + case t.kind == "punct" && t.text == ";": + p.next() + return + case t.kind == "punct" && t.text == "}": + return + case t.kind == "punct" && isOpen(t.text): + p.skipBalanced() + if n := p.peek(); n.line > t.line && n.kind == "id" && statementStart[n.text] { + return + } + default: + p.next() + if n := p.peek(); n.line > t.line && n.kind == "id" && statementStart[n.text] && !continues(t) { + return + } + } + } +} + +var statementStart = map[string]bool{"export": true, "declare": true, "interface": true, "class": true, "function": true, "type": true, "const": true, "let": true, "var": true, "namespace": true, "module": true, "enum": true, "import": true, "abstract": true} + +// text is the tokens from a to b as written, spaced simply, cut at 400 +// characters: a signature to quote. +func (p *parser) text(a, b int) string { + var sb strings.Builder + prev := "" + for i := a; i < b && i < len(p.toks); i++ { + t := p.toks[i] + s := t.text + if t.kind == "str" && !strings.HasPrefix(s, "`") { + s = quote(s) + } + if sb.Len() > 0 && needsSpace(prev, s) { + sb.WriteByte(' ') + } + sb.WriteString(s) + prev = s + if sb.Len() > 400 { + return sb.String()[:400] + "…" + } + } + return strings.TrimSuffix(sb.String(), ";") +} + +func needsSpace(prev, s string) bool { + switch s { + case ",", ")", "]", ">", ".", ";", "?", ":", "?:", "(", "<", "!", "[": + return (s == "(" || s == "[") && (prev == "=>" || prev == ":" || prev == "|" || prev == "," || prev == "=") + } + switch prev { + case "(", "[", "<", ".", "...", "!": + return false + } + return true +} + +func quote(s string) string { return `"` + s + `"` } diff --git a/plugins/apisurface/dtsurface/surface.go b/plugins/apisurface/dtsurface/surface.go new file mode 100644 index 0000000..d8c962b --- /dev/null +++ b/plugins/apisurface/dtsurface/surface.go @@ -0,0 +1,641 @@ +package dtsurface + +import ( + "encoding/json" + "path" + "regexp" + "slices" + "sort" + "strings" + + "github.com/patch-it-dev/patch-it-plugins/plugins/apisurface/pysurface" +) + +// File is one file of the package, its path from the package's root +// ("index.d.ts", "package.json"), and its text. +type File struct { + Path string + Text string +} + +// MaxDepth is how deep namespaces and classes are followed from an entry +// point: "openai.OpenAI.Chat.Completions.create" is four below the entry. +const MaxDepth = 5 + +// Read is the public surface of the package whose files these are: for +// each entry point package.json declares (its "exports", or its "types"), +// every name it exports, and below a class or namespace what it holds (a +// class's public methods and properties, a namespace's exports), keyed by +// the import path code writes ("openai.OpenAI.chat", "openai/resources.Chat") +// and in the same shape as the Python reader's, so one comparison serves +// both. Parameters are positional (Kind "positional", or "args" for the +// rest); HasDef is "optional". +// +// What isn't read, on purpose: names marked @internal, private and +// protected members, interface and object-type members (an interface is +// one name), interfaces and type aliases inside a namespace (a generated +// SDK re-exports each of its thousands of types through namespaces at +// several paths; an entry point's own exports are read, and a type is only +// a type: the code that runs is the classes and functions), names an entry point re-exports from another package (one +// name each, nothing below), and entry points under a private path ("_" or +// "internal"). Bindings are what each entry point exports, Star when it +// re-exports everything of another package (whose names aren't read). +func Read(pkgName string, files []File) (pysurface.Surface, pysurface.Classes, pysurface.Bindings) { + r := newReader(pkgName, files) + out := pysurface.Surface{} + binds := pysurface.Bindings{} + for _, e := range r.entries() { + sc := e.scope + names, star := r.exportedNames(sc, 0, map[*scope]bool{}) + slices.Sort(names) + binds[e.spec] = pysurface.Binding{Names: names, Star: star} + for _, n := range names { + t := r.lookupExport(sc, n, 0) + if n == "default" { + // The default export is the same declaration as a + // named one, almost always: its name, not again all + // it holds. + if t.ok { + out[e.spec+".default"] = r.head(t) + } + continue + } + r.expand(out, e.spec+"."+n, t, 0, map[any]bool{}) + } + } + return out, r.classes(), binds +} + +type reader struct { + name string + files map[string]string // declaration files and package.json, by path + mods map[string]*scope // parsed declaration files, by path + ambient map[string]*scope // `declare module "x"` bodies, by spec +} + +func newReader(pkgName string, files []File) *reader { + r := &reader{name: pkgName, files: map[string]string{}, mods: map[string]*scope{}, ambient: map[string]*scope{}} + for _, f := range files { + r.files[f.Path] = f.Text + } + var paths []string + for p := range r.files { + if isDTS(p) { + paths = append(paths, p) + } + } + slices.Sort(paths) + for _, p := range paths { + r.mods[p] = parseFile(p, r.files[p], r.ambient) + } + return r +} + +func isDTS(p string) bool { + return strings.HasSuffix(p, ".d.ts") || strings.HasSuffix(p, ".d.mts") || strings.HasSuffix(p, ".d.cts") +} + +// entry is one entry point: the import path code writes, and its module. +type entry struct { + spec string + scope *scope +} + +// entries are the package's entry points: package.json's "exports" (each +// subpath, wildcards matched against the files), else its "types" or +// "typings", else index.d.ts. A subpath under a private path, or one that +// names a .js file (a duplicate of the extensionless one), isn't an entry. +func (r *reader) entries() []entry { + var pj struct { + Types string `json:"types"` + Typings string `json:"typings"` + Main string `json:"main"` + Exports json.RawMessage `json:"exports"` + } + _ = json.Unmarshal([]byte(r.files["package.json"]), &pj) // no package.json: index.d.ts + subpaths := map[string]string{} // subpath -> declaration file + var exp any + if len(pj.Exports) > 0 && json.Unmarshal(pj.Exports, &exp) == nil { + m, isMap := exp.(map[string]any) + if !isMap || !hasSubpaths(m) { + exp = map[string]any{".": exp} + m = exp.(map[string]any) + } + for sub, target := range m { + if !strings.HasPrefix(sub, ".") || privatePath(sub) || strings.HasSuffix(sub, ".json") || jsExt.MatchString(sub) || sub == "./index" || strings.HasSuffix(sub, "/index") { + continue + } + file := typesOf(target) + if file == "" { + continue + } + if strings.Contains(sub, "*") { + for k, v := range r.wildcard(sub, file) { + subpaths[k] = v + } + continue + } + if f := r.dtsFor(file); f != "" { + subpaths[sub] = f + } + } + } else { + for _, f := range []string{pj.Types, pj.Typings, pj.Main, "index.d.ts"} { + if f = r.dtsFor(f); f != "" { + subpaths["."] = f + break + } + } + } + var out []entry + for sub, file := range subpaths { + spec := r.name + strings.TrimPrefix(sub, ".") + sc := r.mods[file] + if a, ok := r.ambient[spec]; ok && len(sc.exports) == 0 && len(sc.stars) == 0 && !hasExported(sc) { + sc = a // the file only declares the module + } + out = append(out, entry{spec: spec, scope: sc}) + } + // The ambient module of the package itself, when no file is its entry. + if len(out) == 0 { + if a, ok := r.ambient[r.name]; ok { + out = append(out, entry{spec: r.name, scope: a}) + } + } + sort.Slice(out, func(i, j int) bool { return out[i].spec < out[j].spec }) + return out +} + +func hasExported(sc *scope) bool { + for _, ds := range sc.decls { + for _, d := range ds { + if d.exported { + return true + } + } + } + return false +} + +var jsExt = regexp.MustCompile(`\.(m|c)?js$`) + +func hasSubpaths(m map[string]any) bool { + for k := range m { + if strings.HasPrefix(k, ".") { + return true + } + } + return false +} + +// privatePath is a subpath or file path with a part starting with "_" or +// named internal or src. +func privatePath(p string) bool { + for _, part := range strings.Split(strings.TrimPrefix(p, "./"), "/") { + if strings.HasPrefix(part, "_") || part == "internal" || part == "src" { + return true + } + } + return false +} + +// typesOf is the file an "exports" target resolves to for TypeScript: its +// "types" condition, else (in order) import, require, node, default, else +// any condition, a .js target read as its declaration file. +func typesOf(v any) string { + switch t := v.(type) { + case string: + return t + case []any: + if len(t) > 0 { + return typesOf(t[0]) + } + case map[string]any: + for _, k := range []string{"types", "import", "require", "node", "default"} { + if x, ok := t[k]; ok { + if s := typesOf(x); s != "" { + return s + } + } + } + keys := make([]string, 0, len(t)) + for k := range t { + keys = append(keys, k) + } + slices.Sort(keys) + for _, k := range keys { + if s := typesOf(t[k]); s != "" { + return s + } + } + } + return "" +} + +// dtsFor is the declaration file for a path in the package: itself, or a +// .js file's .d.ts beside it (.mjs .d.mts, .cjs .d.cts), or a directory's +// index; "" when there's none. +func (r *reader) dtsFor(p string) string { + if p == "" { + return "" + } + p = path.Clean(strings.TrimPrefix(p, "./")) + base := jsExt.ReplaceAllString(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(p, ".d.ts"), ".d.mts"), ".d.cts"), "") + var cands []string + if isDTS(p) { + cands = append(cands, p) + } + switch { + case strings.HasSuffix(p, ".mjs"): + cands = append(cands, base+".d.mts") + case strings.HasSuffix(p, ".cjs"): + cands = append(cands, base+".d.cts") + } + cands = append(cands, base+".d.ts", base+".d.mts", base+".d.cts", base+"/index.d.ts", base+"/index.d.mts", base+"/index.d.cts") + for _, c := range cands { + if _, ok := r.mods[c]; ok { + return c + } + } + return "" +} + +// wildcard matches a subpath pattern ("./resources/*") against the files +// its target pattern ("./resources/*.mjs") names. +func (r *reader) wildcard(sub, target string) map[string]string { + out := map[string]string{} + t := path.Clean(strings.TrimPrefix(target, "./")) + pre, post, _ := strings.Cut(t, "*") + post = jsExt.ReplaceAllString(strings.TrimSuffix(strings.TrimSuffix(strings.TrimSuffix(post, ".d.ts"), ".d.mts"), ".d.cts"), "") + for f := range r.mods { + if !strings.HasPrefix(f, pre) { + continue + } + rest := strings.TrimPrefix(f, pre) + for _, ext := range []string{".d.ts", ".d.mts", ".d.cts"} { + if stem, ok := strings.CutSuffix(rest, post+ext); ok && stem != "" { + s := strings.Replace(sub, "*", stem, 1) + if privatePath(s) || s == "./index" || strings.HasSuffix(s, "/index") { + continue + } + if have, ok := out[s]; !ok || f < have { + out[s] = r.dtsFor(f) + } + } + } + } + return out +} + +// target is what a name resolves to. +type target struct { + decls []*decl + module *scope // a namespace import, `export * as` + external exportRef // a name from another package + from string // the file that names it + ok bool +} + +// module resolves a module specifier from a file: a relative path to the +// package's declaration file, the package's own name to its entry, an +// ambient module; nil for another package. +func (r *reader) module(from, spec string) *scope { + if a, ok := r.ambient[spec]; ok { + return a + } + if strings.HasPrefix(spec, ".") { + if f := r.dtsFor(path.Join(path.Dir(from), spec)); f != "" { + return r.mods[f] + } + } + return nil +} + +// exportedNames are the names a scope exports, and whether it re-exports +// all of another package (names it can't list). +func (r *reader) exportedNames(sc *scope, hops int, seen map[*scope]bool) ([]string, bool) { + if sc == nil || seen[sc] || hops > 8 { + return nil, false + } + seen[sc] = true + set := map[string]bool{} + star := false + for n := range sc.exports { + set[n] = true + } + for _, n := range sc.order { + for _, d := range sc.decls[n] { + if d.exported || (sc.ambient && !sc.explicit) { + set[n] = true + } + } + } + if sc.assign != "" { + // `export = X`: the module is X's namespace members. + t := r.lookupLocal(sc, sc.assign, 0) + for _, d := range t.decls { + if d.ns != nil { + ns, s := r.exportedNames(d.ns, hops+1, seen) + for _, n := range ns { + set[n] = true + } + star = star || s + } + } + } + for _, st := range sc.stars { + m := r.module(sc.file, st.spec) + if m == nil { + star = true + continue + } + ns, s := r.exportedNames(m, hops+1, seen) + for _, n := range ns { + if n != "default" { + set[n] = true + } + } + star = star || s + } + out := make([]string, 0, len(set)) + for n := range set { + out = append(out, n) + } + return out, star +} + +// lookupExport resolves a name a scope exports. +func (r *reader) lookupExport(sc *scope, name string, hops int) target { + if sc == nil || hops > 12 { + return target{} + } + if e, ok := sc.exports[name]; ok { + if e.spec != "" { + m := r.module(sc.file, e.spec) + if m == nil { + return target{external: e, from: sc.file, ok: true} + } + if e.name == "*" { + return target{module: m, from: sc.file, ok: true} + } + return r.lookupExport(m, e.name, hops+1) + } + return r.lookupLocal(sc, e.local, hops+1) + } + var ds []*decl + for _, d := range sc.decls[name] { + if d.exported || (sc.ambient && !sc.explicit) { + ds = append(ds, d) + } + } + if len(ds) > 0 { + return target{decls: ds, from: sc.file, ok: true} + } + if sc.assign != "" { + for _, d := range r.lookupLocal(sc, sc.assign, hops+1).decls { + if d.ns != nil { + if t := r.lookupExport(d.ns, name, hops+1); t.ok { + return t + } + } + } + } + if name != "default" { + for _, st := range sc.stars { + if m := r.module(sc.file, st.spec); m != nil { + if t := r.lookupExport(m, name, hops+1); t.ok { + return t + } + } + } + } + return target{} +} + +// lookupLocal resolves a name as written in a scope: its declarations, an +// import, an alias (import X = A.B), else the enclosing scope's. +func (r *reader) lookupLocal(sc *scope, dotted string, hops int) target { + if sc == nil || hops > 12 { + return target{} + } + first, rest, more := strings.Cut(dotted, ".") + var t target + switch { + case len(sc.decls[first]) > 0: + t = target{decls: sc.decls[first], from: sc.file, ok: true} + case sc.imports[first].spec != "": + imp := sc.imports[first] + m := r.module(sc.file, imp.spec) + switch { + case m == nil: + t = target{external: exportRef{spec: imp.spec, name: imp.name, sig: "import " + first + " from " + quote(imp.spec)}, from: sc.file, ok: true} + case imp.name == "*": + t = target{module: m, from: sc.file, ok: true} + case imp.name == "=": + if m.assign != "" { + t = r.lookupLocal(m, m.assign, hops+1) + } else { + t = target{module: m, from: sc.file, ok: true} + } + default: + t = r.lookupExport(m, imp.name, hops+1) + } + case sc.aliases[first] != "": + t = r.lookupLocal(sc, sc.aliases[first], hops+1) + default: + return r.lookupLocal(sc.parent, dotted, hops+1) + } + if !more { + return t + } + for _, part := range strings.Split(rest, ".") { + switch { + case t.module != nil: + t = r.lookupExport(t.module, part, hops+1) + case len(t.decls) > 0: + var next target + for _, d := range t.decls { + if d.ns != nil { + if next = r.lookupExport(d.ns, part, hops+1); next.ok { + break + } + } + } + t = next + default: + return target{} + } + if !t.ok { + return t + } + } + return t +} + +// kindOrder is which declaration of a merged name is the symbol. +var kindOrder = []string{"class", "function", "enum", "variable", "interface", "type", "namespace"} + +// expand adds the symbol a target is at key, and what it holds. +func (r *reader) expand(out pysurface.Surface, key string, t target, depth int, seen map[any]bool) { + if !t.ok || depth > MaxDepth { + return + } + switch { + case t.external.spec != "": + out[key] = r.head(t) + case t.module != nil: + if seen[t.module] { + return + } + seen[t.module] = true + defer delete(seen, t.module) + out[key] = r.head(t) + names, _ := r.exportedNames(t.module, 0, map[*scope]bool{}) + for _, n := range names { + r.expand(out, key+"."+n, r.lookupExport(t.module, n, 0), depth+1, seen) + } + case len(t.decls) > 0: + if seen[t.decls[0]] { + return + } + if sym := symbol(t.decls); depth > 0 && (sym.Kind == "interface" || sym.Kind == "type") { + return // a type inside a namespace: see Read + } + seen[t.decls[0]] = true + defer delete(seen, t.decls[0]) + out[key] = symbol(t.decls) + for _, d := range t.decls { + if d.kind == "class" { + byName := map[string][]*member{} + for _, m := range d.members { + byName[m.name] = append(byName[m.name], m) + } + for n, ms := range byName { + out[key+"."+n] = memberSymbol(d.file, ms) + } + } + if d.ns != nil { + names, _ := r.exportedNames(d.ns, 0, map[*scope]bool{}) + for _, n := range names { + r.expand(out, key+"."+n, r.lookupExport(d.ns, n, 0), depth+1, seen) + } + } + } + } +} + +// head is a target's own symbol, without what it holds. +func (r *reader) head(t target) pysurface.Symbol { + switch { + case t.external.spec != "": + return pysurface.Symbol{Kind: "export", File: t.from, Line: t.external.line, Signature: t.external.sig} + case t.module != nil: + return pysurface.Symbol{Kind: "namespace", File: t.module.file, Line: 1, Signature: "module " + t.module.file} + } + return symbol(t.decls) +} + +// symbol is a merged name's symbol: its first declaration of the first +// kind in kindOrder; a function declared more than once is overloaded, a +// class's parameters are its constructor's. +func symbol(ds []*decl) pysurface.Symbol { + var primary *decl + for _, k := range kindOrder { + for _, d := range ds { + if d.kind == k { + primary = d + break + } + } + if primary != nil { + break + } + } + s := pysurface.Symbol{Kind: primary.kind, File: primary.file, Line: primary.line, Signature: primary.sig} + switch primary.kind { + case "function": + n := 0 + for _, d := range ds { + if d.kind == "function" { + n++ + } + } + if n > 1 { + s.Overloaded = true + } else { + s.Params = params(primary.params) + } + case "class": + switch { + case primary.ctors > 1: + s.Overloaded = true + case primary.hasParam: + s.Params = params(primary.params) + } + } + return s +} + +func memberSymbol(file string, ms []*member) pysurface.Symbol { + m := ms[0] + s := pysurface.Symbol{Kind: m.kind, File: file, Line: m.line, Signature: m.sig} + if m.kind == "method" { + if len(ms) > 1 { + s.Overloaded = true + } else { + s.Params = params(m.params) + } + } + return s +} + +func params(ps []Param) []pysurface.Param { + out := make([]pysurface.Param, 0, len(ps)) + for _, p := range ps { + k := "positional" + if p.Rest { + k = "args" + } + out = append(out, pysurface.Param{Name: p.Name, Kind: k, HasDef: p.Optional}) + } + return out +} + +// classes are every class the package declares, by name: its base and its +// public members, for following a method that moved to a base class. +func (r *reader) classes() pysurface.Classes { + out := pysurface.Classes{} + var walk func(sc *scope) + walk = func(sc *scope) { + for _, n := range sc.order { + for _, d := range sc.decls[n] { + if d.kind == "class" { + c := out[n] + for _, b := range d.bases { + if !slices.Contains(c.Bases, b) { + c.Bases = append(c.Bases, b) + } + } + for _, m := range d.members { + if !slices.Contains(c.Members, m.name) { + c.Members = append(c.Members, m.name) + } + } + slices.Sort(c.Bases) + slices.Sort(c.Members) + out[n] = c + } + if d.ns != nil { + walk(d.ns) + } + } + } + } + for _, sc := range r.mods { + walk(sc) + } + for _, sc := range r.ambient { + walk(sc) + } + return out +} diff --git a/plugins/apisurface/npm.go b/plugins/apisurface/npm.go new file mode 100644 index 0000000..b2ff86a --- /dev/null +++ b/plugins/apisurface/npm.go @@ -0,0 +1,115 @@ +package apisurface + +import ( + "archive/tar" + "bytes" + "compress/gzip" + "context" + "encoding/json" + "fmt" + "io" + "log" + "net/url" + "path" + "slices" + "strings" + + "github.com/patch-it-dev/patch-it-plugins/core/plugin" + "github.com/patch-it-dev/patch-it-plugins/core/versions" + "github.com/patch-it-dev/patch-it-plugins/plugins/apisurface/dtsurface" +) + +// readNPM downloads an npm release's tarball (from its version document on +// the registry) and reads its public API from its declaration files. Only +// package.json and the .d.ts, .d.mts and .d.cts files are read out of the +// tarball, in memory: no JavaScript in it is run, and no install script. +func (p Plugin) readNPM(ctx context.Context, env plugin.Env, v plugin.Version) (plugin.Snapshot, error) { + pkg := p.Package + u := versions.NPM + "/" + strings.Replace(url.PathEscape(pkg.Name), "%40", "@", 1) + "/" + url.PathEscape(v.ID) + body, err := env.Get(ctx, u) + if err != nil { + return plugin.Snapshot{}, fmt.Errorf("reading %s %s on npm: %w", pkg.Name, v.ID, err) + } + var doc struct { + Dist struct { + Tarball string `json:"tarball"` + } `json:"dist"` + } + if err := json.Unmarshal(body, &doc); err != nil { + return plugin.Snapshot{}, fmt.Errorf("parsing npm's %s %s: %w", pkg.Name, v.ID, err) + } + if doc.Dist.Tarball == "" { + return plugin.Snapshot{}, fmt.Errorf("npm's %s %s has no tarball", pkg.Name, v.ID) + } + tgz, err := env.Get(ctx, doc.Dist.Tarball) + if err != nil { + return plugin.Snapshot{}, fmt.Errorf("fetching %s: %w", doc.Dist.Tarball, err) + } + files, skipped, err := npmFiles(tgz) + if err != nil { + return plugin.Snapshot{}, fmt.Errorf("%s: %w", doc.Dist.Tarball, err) + } + if !slices.ContainsFunc(files, func(f dtsurface.File) bool { return f.Path != "package.json" }) { + return plugin.Snapshot{}, fmt.Errorf("%s %s has no declaration files: %w", pkg.Name, v.ID, plugin.ErrNothingToRead) + } + for _, s := range skipped { + log.Printf("%s %s: %s skipped: over %d bytes", pkg.Name, v.ID, s, MaxFileBytes) + } + surface, classes, bindings := dtsurface.Read(pkg.Name, files) + content, err := json.Marshal(Release{Artifact: path.Base(doc.Dist.Tarball), Surface: surface, Classes: classes, Bindings: bindings, Skipped: skipped, Positional: true}) + if err != nil { + return plugin.Snapshot{}, err + } + return plugin.Snapshot{Version: v, Content: content, SourceURL: doc.Dist.Tarball}, nil +} + +// npmFiles are a tarball's package.json and declaration files, each with +// its path from the package's root (the tarball's top directory, "package/" +// by convention, left out). Links and other non-regular entries are never +// followed; a file over MaxFileBytes is skipped, and more than +// MaxSourceBytes in all is refused. +func npmFiles(tgz []byte) ([]dtsurface.File, []string, error) { + gz, err := gzip.NewReader(bytes.NewReader(tgz)) + if err != nil { + return nil, nil, err + } + tr := tar.NewReader(gz) + var files []dtsurface.File + var skipped []string + var total int64 + for { + h, err := tr.Next() + if err == io.EOF { + break + } + if err != nil { + return nil, nil, err + } + if h.Typeflag != tar.TypeReg { + continue + } + name := path.Clean(strings.TrimPrefix(h.Name, "./")) + _, rel, ok := strings.Cut(name, "/") + if !ok || strings.HasPrefix(rel, "../") || strings.Contains(rel, "/node_modules/") || strings.HasPrefix(rel, "node_modules/") { + continue + } + if rel != "package.json" && !strings.HasSuffix(rel, ".d.ts") && !strings.HasSuffix(rel, ".d.mts") && !strings.HasSuffix(rel, ".d.cts") { + continue + } + if h.Size > MaxFileBytes { + skipped = append(skipped, rel) + continue + } + total += h.Size + if total > MaxSourceBytes { + return nil, nil, fmt.Errorf("over %d bytes of declarations", MaxSourceBytes) + } + b, err := io.ReadAll(io.LimitReader(tr, MaxFileBytes+1)) + if err != nil { + return nil, nil, err + } + files = append(files, dtsurface.File{Path: rel, Text: string(b)}) + } + slices.SortFunc(files, func(a, b dtsurface.File) int { return strings.Compare(a.Path, b.Path) }) + return files, skipped, nil +} diff --git a/plugins/apisurface/npm_packages.go b/plugins/apisurface/npm_packages.go new file mode 100644 index 0000000..3235471 --- /dev/null +++ b/plugins/apisurface/npm_packages.go @@ -0,0 +1,54 @@ +package apisurface + +import ( + "strings" + + "github.com/patch-it-dev/patch-it-plugins/core/plugin" +) + +// The npm packages whose public API this kind reads from their TypeScript +// declarations, one source each, registered with their provider. An npm +// package's Module is its own name: symbols are named from the import path +// code writes ("@anthropic-ai/sdk/resources/messages.Messages.create"). +var ( + OpenAINode = npmPackage("openai/node-surface", "openai") + AnthropicTS = npmPackage("anthropic/typescript-surface", "@anthropic-ai/sdk") + StripeNode = npmPackage("stripe/node-surface", "stripe") + GoogleGenAIJS = npmPackage("google/genai-js-surface", "@google/genai") + SentryNode = npmPackage("sentry/node-surface", "@sentry/node") + MongoDBNode = npmPackage("mongodb/node-surface", "mongodb") + RedisNode = npmPackage("redis/node-redis-surface", "@redis/client") + SupabaseJS = npmPackage("supabase/js-surface", "@supabase/supabase-js") + NeonServerless = npmPackage("neon/serverless-surface", "@neondatabase/serverless") + ConvexJS = npmPackage("convex/js-surface", "convex") +) + +func npmPackage(id, name string) Package { + return Package{ID: id, Name: name, Ecosystem: "npm", Module: name} +} + +func init() { + npm := func(p plugin.Provider, pkg Package, repo string, also ...string) { + _, src, _ := strings.Cut(pkg.ID, "/") + p.Sources = []plugin.Source{{ + ID: src, Layer: plugin.LayerSDK, Page: "providers/" + p.ID + "-" + src + ".md", + Watches: "Exported classes, functions, methods, properties, types and parameters removed, or parameters no longer optional, in the public API of the " + pkg.Name + " npm package, release by release, read from each release's TypeScript declarations", + URLs: []string{"https://www.npmjs.com/package/" + pkg.Name, repo}, + Packages: append([]string{"npm:" + pkg.Name}, also...), + Plugin: Plugin{Package: pkg}, + }} + plugin.RegisterProvider(p) + } + npm(plugin.Provider{ID: "openai", Name: "OpenAI", Category: plugin.CategoryAI, Homepage: "https://openai.com"}, OpenAINode, "https://github.com/openai/openai-node") + npm(plugin.Provider{ID: "anthropic", Name: "Anthropic", Category: plugin.CategoryAI, Homepage: "https://www.anthropic.com"}, AnthropicTS, "https://github.com/anthropics/anthropic-sdk-typescript") + npm(plugin.Provider{ID: "stripe", Name: "Stripe", Category: plugin.CategoryPayments, Homepage: "https://stripe.com"}, StripeNode, "https://github.com/stripe/stripe-node") + npm(plugin.Provider{ID: "google", Name: "Google", Category: plugin.CategoryAI, Homepage: "https://cloud.google.com"}, GoogleGenAIJS, "https://github.com/googleapis/js-genai") + npm(plugin.Provider{ID: "sentry", Name: "Sentry", Category: plugin.CategoryMonitoring, Homepage: "https://sentry.io"}, SentryNode, "https://github.com/getsentry/sentry-javascript") + npm(plugin.Provider{ID: "mongodb", Name: "MongoDB", Category: plugin.CategoryDatabases, Homepage: "https://www.mongodb.com"}, MongoDBNode, "https://github.com/mongodb/node-mongodb-native") + // redis on npm re-exports @redis/client and its siblings wholesale; the + // client's declarations are where its API is. + npm(plugin.Provider{ID: "redis", Name: "Redis", Category: plugin.CategoryDatabases, Homepage: "https://redis.io"}, RedisNode, "https://github.com/redis/node-redis", "npm:redis") + npm(plugin.Provider{ID: "supabase", Name: "Supabase", Category: plugin.CategoryDatabases, Homepage: "https://supabase.com"}, SupabaseJS, "https://github.com/supabase/supabase-js") + npm(plugin.Provider{ID: "neon", Name: "Neon", Category: plugin.CategoryDatabases, Homepage: "https://neon.com"}, NeonServerless, "https://github.com/neondatabase/serverless") + npm(plugin.Provider{ID: "convex", Name: "Convex", Category: plugin.CategoryDatabases, Homepage: "https://www.convex.dev"}, ConvexJS, "https://github.com/convex/convex-js") +} diff --git a/plugins/apisurface/npm_test.go b/plugins/apisurface/npm_test.go new file mode 100644 index 0000000..b6c667d --- /dev/null +++ b/plugins/apisurface/npm_test.go @@ -0,0 +1,182 @@ +package apisurface + +import ( + "context" + "encoding/json" + "path/filepath" + "slices" + "strings" + "testing" + + "github.com/patch-it-dev/patch-it-plugins/core/event" + "github.com/patch-it-dev/patch-it-plugins/core/kit/kittest" + "github.com/patch-it-dev/patch-it-plugins/core/plugin" +) + +// npmCases are the npm sources' saved releases (testdata/npm//, +// testdata/README.md): a golden pair with the events it must store, and a +// drop pair that must store none. Both are consecutive releases on npm. +var npmCases = []pypiCase{ + // openai 7.60.0 dropped the agents' AgentSessionBudgetReachedEvent + // type (the session spending limits pulled from the API). + {OpenAINode, [2]string{"7.59.0", "7.60.0"}, []string{ + "removed_symbol openai/resources/beta.AgentSessionBudgetReachedEvent,openai/resources/beta/agents.AgentSessionBudgetReachedEvent,openai/resources/beta/agents/agents.AgentSessionBudgetReachedEvent ", + }, [2]string{"7.60.0", "7.61.0"}}, + // @anthropic-ai/sdk 1.7.0 dropped the beta billing-frozen error. + {AnthropicTS, [2]string{"1.6.0", "1.7.0"}, []string{ + "removed_symbol @anthropic-ai/sdk/resources/beta.BetaBillingFrozenErrorDetails,@anthropic-ai/sdk/resources/beta/organization.BetaBillingFrozenErrorDetails,@anthropic-ai/sdk/resources/beta/organization/organization.BetaBillingFrozenErrorDetails ", + "removed_symbol Anthropic.Beta.BetaBillingFrozenError,Anthropic.Beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/client.Anthropic.Beta.BetaBillingFrozenError,@anthropic-ai/sdk/client.Anthropic.Beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources.Beta.BetaBillingFrozenError,@anthropic-ai/sdk/resources.Beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta.Beta.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta.Beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/beta.Beta.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/beta.Beta.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/organization.Organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/organization/organization.BetaBillingFrozenError,@anthropic-ai/sdk/resources/beta/organization/organization.Organization.BetaBillingFrozenError ", + }, [2]string{"1.7.0", "1.8.0"}}, + // stripe 23.0.0 removed constructEventWithoutVerification and the + // ErrorType namespace. + {StripeNode, [2]string{"22.6.2", "23.0.0"}, []string{ + "removed_symbol Stripe.ErrorType ", + "removed_symbol Stripe.constructEventWithoutVerification ", + }, [2]string{"23.0.0", "23.0.1"}}, + // @sentry/node 10.0.0 stopped exporting systemErrorIntegration. 11.13.0 + // made the logger namespace a const object: its functions are still + // there, as members the reader doesn't follow. + {SentryNode, [2]string{"9.47.2", "10.0.0"}, []string{ + "removed_symbol systemErrorIntegration ", + }, [2]string{"11.12.0", "11.13.0"}}, + // @neondatabase/serverless 1.0.0 dropped ClientBase.neonConfig and the + // native export; Pool.connect, gone from Pool, is pg's base class's. + {NeonServerless, [2]string{"0.10.4", "1.0.0"}, []string{ + "removed_symbol native ", + }, [2]string{"1.0.0", "1.0.1"}}, + // @redis/client 5.0.0 removed commandOptions and RedisFlushModes. + {RedisNode, [2]string{"1.6.1", "5.0.0"}, []string{ + "removed_symbol RedisFlushModes ", + "removed_symbol commandOptions ", + }, [2]string{"6.3.0", "6.3.1"}}, + // @supabase/supabase-js 2.0.0 removed the v1 subscription methods. + {SupabaseJS, [2]string{"1.35.7", "2.0.0"}, []string{ + "removed_symbol SupabaseClient.getSubscriptions ", + "removed_symbol SupabaseClient.removeAllSubscriptions ", + "removed_symbol SupabaseClient.removeSubscription ", + }, [2]string{"2.118.0", "2.119.0"}}, + // @google/genai 1.0.0 removed LiveMusicSetClientContentParameters. + {GoogleGenAIJS, [2]string{"0.15.0", "1.0.0"}, []string{ + "removed_symbol @google/genai/node.LiveMusicSetClientContentParameters ", + "removed_symbol @google/genai/web.LiveMusicSetClientContentParameters ", + "removed_symbol LiveMusicSetClientContentParameters ", + }, [2]string{"1.0.0", "1.1.0"}}, + // mongodb 7.0.0 removed CancellationToken, Transaction and more. + {MongoDBNode, [2]string{"6.22.0", "7.0.0"}, []string{ + "removed_symbol AsyncDisposable ", + "removed_symbol CancellationToken ", + "removed_symbol ChangeStream.streamOptions ", + "removed_symbol ClientMetadata ", + "removed_symbol ClientMetadataOptions ", + "removed_symbol ClientSession.transaction ", + "removed_symbol CloseOptions ", + "removed_symbol CursorStreamOptions ", + "removed_symbol ReadPreference.minWireVersion ", + "removed_symbol ResumeOptions ", + "removed_symbol ServerCapabilities ", + "removed_symbol Transaction ", + }, [2]string{"7.0.0", "7.1.0"}}, + // convex 1.35.1 removed the react entry's QueryOptions and + // UseQueryResult types. + {ConvexJS, [2]string{"1.35.0", "1.35.1"}, []string{ + "removed_symbol convex/browser.QueryOptions ", + }, [2]string{"1.42.2", "1.42.3"}}, +} + +// npmDir is a package's directory under testdata/npm. +func npmDir(name string) string { + return filepath.Join("testdata", "npm", strings.ReplaceAll(strings.TrimPrefix(name, "@"), "/", "-")) +} + +// npmPages serves a case's saved files under the registry's URLs: the +// package document, each version's, and each trimmed tarball. +func npmPages(t *testing.T, name string) kittest.Pages { + t.Helper() + dir, safe := npmDir(name), strings.ReplaceAll(strings.TrimPrefix(name, "@"), "/", "-") + reg := "https://registry.npmjs.org/" + strings.ReplaceAll(name, "/", "%2F") + pages := kittest.Pages{reg: filepath.Join(dir, "npm-"+safe+"-excerpt.json")} + files, err := filepath.Glob(filepath.Join(dir, "npm-"+safe+"-*.json")) + if err != nil { + t.Fatal(err) + } + for _, f := range files { + v := strings.TrimSuffix(strings.TrimPrefix(filepath.Base(f), "npm-"+safe+"-"), ".json") + if v == "excerpt" { + continue + } + pages[reg+"/"+v] = f + var doc struct { + Dist struct { + Tarball string `json:"tarball"` + } `json:"dist"` + } + if err := json.Unmarshal(kittest.Read(t, f), &doc); err != nil { + t.Fatal(err) + } + pages[doc.Dist.Tarball] = filepath.Join(dir, strings.TrimSuffix(filepath.Base(doc.Dist.Tarball), ".tgz")+".trimmed.tgz") + } + return pages +} + +func npmPair(t *testing.T, c pypiCase, pair [2]string) []event.Event { + t.Helper() + ctx, env := context.Background(), kittest.Env(t, npmPages(t, c.pkg.Name)) + p := Plugin{Package: c.pkg} + vs, err := p.ListVersions(ctx, env) + if err != nil { + t.Fatal(err) + } + byID := map[string]plugin.Version{} + for _, v := range vs { + byID[v.ID] = v + } + from, ok1 := byID[pair[0]] + to, ok2 := byID[pair[1]] + if !ok1 || !ok2 { + t.Fatalf("%s: %v not both listed in %v", c.pkg.Name, pair, vs) + } + return kittest.Versions(t, env, p, from, to) +} + +// The golden test of every npm source. +func TestNPMGolden(t *testing.T) { + for _, c := range npmCases { + t.Run(c.pkg.ID, func(t *testing.T) { + got := npmPair(t, c, c.golden) + if len(got) == 0 { + t.Fatal("no events") + } + var lines []string + for _, e := range got { + lines = append(lines, string(e.Subject.Change)+" "+strings.Join(e.Subject.Symbols, ",")+" "+e.Subject.Parameter) + if e.Version != c.golden[1] || e.PreviousVersion != c.golden[0] || !strings.HasPrefix(e.SourceURL, "https://registry.npmjs.org/") || !strings.Contains(e.SourceExcerpt, c.pkg.Name+" "+c.golden[0]+" (") || e.Subject.Ecosystem != "npm" { + t.Errorf("%s: %s<-%s cites %s, excerpt %q", e.Subject.Symbols, e.Version, e.PreviousVersion, e.SourceURL, e.SourceExcerpt) + } + } + slices.Sort(lines) + if !slices.Equal(lines, c.want) { + t.Errorf("got\n%s\nwant\n%s", strings.Join(lines, "\n"), strings.Join(c.want, "\n")) + } + provider, source, _ := strings.Cut(c.pkg.ID, "/") + kittest.Golden(t, "testdata/golden/"+provider+"-"+source+".json", got) + }) + } +} + +// The pinned drop test of every npm source: a real release that changes +// nothing a caller relies on stores no event. +func TestNPMDrop(t *testing.T) { + for _, c := range npmCases { + t.Run(c.pkg.ID, func(t *testing.T) { + for _, e := range npmPair(t, c, c.drop) { + t.Errorf("%s %v %s", e.Subject.Change, e.Subject.Symbols, e.Subject.Parameter) + } + }) + } +} + +func TestNPMRegistersItself(t *testing.T) { + for _, c := range npmCases { + kittest.Registered(t, Plugin{Package: c.pkg}) + } +} diff --git a/plugins/apisurface/pypi_test.go b/plugins/apisurface/pypi_test.go index e1ad6f4..ec10dea 100644 --- a/plugins/apisurface/pypi_test.go +++ b/plugins/apisurface/pypi_test.go @@ -30,10 +30,8 @@ var pypiCases = []pypiCase{ // and all. 2.5.0 made DeadlineExceededError an alias of // GatewayTimeoutError: still importable, no event. {AnthropicPython, [2]string{"2.6.0", "2.7.0"}, []string{ - "removed_symbol types.beta.BetaBillingFrozenError ", - "removed_symbol types.beta.BetaBillingFrozenErrorDetails ", - "removed_symbol types.beta.beta_billing_frozen_error.BetaBillingFrozenError ", - "removed_symbol types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails ", + "removed_symbol types.beta.BetaBillingFrozenError,types.beta.beta_billing_frozen_error.BetaBillingFrozenError ", + "removed_symbol types.beta.BetaBillingFrozenErrorDetails,types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails ", }, [2]string{"2.4.0", "2.5.0"}}, // stripe 16.0.0 removed StripeObject.request. 15.5.0 only added. {StripePython, [2]string{"15.6.2", "16.0.0"}, []string{"removed_symbol StripeObject.request "}, [2]string{"15.4.0", "15.5.0"}}, @@ -50,10 +48,8 @@ var pypiCases = []pypiCase{ {PyMongo, [2]string{"4.15.5", "4.16.0"}, []string{ "removed_parameter asynchronous.command_cursor.AsyncCommandCursor explicit_session", "removed_parameter asynchronous.command_cursor.AsyncRawBatchCommandCursor explicit_session", - "removed_parameter command_cursor.CommandCursor explicit_session", - "removed_parameter command_cursor.RawBatchCommandCursor explicit_session", - "removed_parameter synchronous.command_cursor.CommandCursor explicit_session", - "removed_parameter synchronous.command_cursor.RawBatchCommandCursor explicit_session", + "removed_parameter command_cursor.CommandCursor,synchronous.command_cursor.CommandCursor explicit_session", + "removed_parameter command_cursor.RawBatchCommandCursor,synchronous.command_cursor.RawBatchCommandCursor explicit_session", }, [2]string{"4.15.4", "4.15.5"}}, // redis 8.1.0 removed OSSMaintNotificationsHandler.get_handler_for_connection. {RedisPy, [2]string{"8.0.1", "8.1.0"}, []string{"removed_symbol maint_notifications.OSSMaintNotificationsHandler.get_handler_for_connection "}, [2]string{"7.4.1", "8.0.0"}}, @@ -63,31 +59,23 @@ var pypiCases = []pypiCase{ // supabase 1.0.0's SupabaseAuthClient lost four parameters. 2.34.0 made // supabase.client a star re-export of the package: still importable. {SupabasePython, [2]string{"0.7.1", "1.0.0"}, []string{ - "removed_parameter SupabaseAuthClient api", - "removed_parameter SupabaseAuthClient cookie_options", - "removed_parameter SupabaseAuthClient local_storage", - "removed_parameter SupabaseAuthClient replace_default_headers", - "removed_parameter lib.auth_client.SupabaseAuthClient api", - "removed_parameter lib.auth_client.SupabaseAuthClient cookie_options", - "removed_parameter lib.auth_client.SupabaseAuthClient local_storage", - "removed_parameter lib.auth_client.SupabaseAuthClient replace_default_headers", + "removed_parameter SupabaseAuthClient,lib.auth_client.SupabaseAuthClient api", + "removed_parameter SupabaseAuthClient,lib.auth_client.SupabaseAuthClient cookie_options", + "removed_parameter SupabaseAuthClient,lib.auth_client.SupabaseAuthClient local_storage", + "removed_parameter SupabaseAuthClient,lib.auth_client.SupabaseAuthClient replace_default_headers", "removed_parameter lib.client_options.ClientOptions.replace local_storage", }, [2]string{"2.33.0", "2.34.0"}}, // algoliasearch 4.44.3 dropped recommend's FacetFilters (4.44.4 brought // it back: an addition, no event). {AlgoliaPython, [2]string{"4.44.1", "4.44.3"}, []string{ - "removed_symbol recommend.models.FacetFilters ", - "removed_symbol recommend.models.facet_filters.FacetFilters ", + "removed_symbol recommend.models.FacetFilters,recommend.models.facet_filters.FacetFilters ", }, [2]string{"4.44.3", "4.44.4"}}, // elasticsearch 9.1.3 made the rethrottle methods' requests_per_second // required. {ElasticPython, [2]string{"9.1.2", "9.1.3"}, []string{ - "changed_default Elasticsearch.delete_by_query_rethrottle requests_per_second", - "changed_default Elasticsearch.reindex_rethrottle requests_per_second", - "changed_default Elasticsearch.update_by_query_rethrottle requests_per_second", - "changed_default client.Elasticsearch.delete_by_query_rethrottle requests_per_second", - "changed_default client.Elasticsearch.reindex_rethrottle requests_per_second", - "changed_default client.Elasticsearch.update_by_query_rethrottle requests_per_second", + "changed_default Elasticsearch.delete_by_query_rethrottle,client.Elasticsearch.delete_by_query_rethrottle requests_per_second", + "changed_default Elasticsearch.reindex_rethrottle,client.Elasticsearch.reindex_rethrottle requests_per_second", + "changed_default Elasticsearch.update_by_query_rethrottle,client.Elasticsearch.update_by_query_rethrottle requests_per_second", }, [2]string{"9.1.1", "9.1.2"}}, // ddtrace 4.13.0 moved AI Guard to ddtrace.aiguard: the old module // forwards its names (__getattr__), so only the two integration helpers @@ -110,10 +98,8 @@ var pypiCases = []pypiCase{ // urllib3 2.6.0 removed BaseHTTPResponse.getheader and getheaders, // deprecated since 2.0. {URLLib3, [2]string{"2.5.0", "2.6.0"}, []string{ - "removed_symbol BaseHTTPResponse.getheader ", - "removed_symbol BaseHTTPResponse.getheaders ", - "removed_symbol response.BaseHTTPResponse.getheader ", - "removed_symbol response.BaseHTTPResponse.getheaders ", + "removed_symbol BaseHTTPResponse.getheader,response.BaseHTTPResponse.getheader ", + "removed_symbol BaseHTTPResponse.getheaders,response.BaseHTTPResponse.getheaders ", }, [2]string{"2.2.1", "2.2.2"}}, } diff --git a/plugins/apisurface/testdata/README.md b/plugins/apisurface/testdata/README.md index 45e3f39..ae6d3aa 100644 --- a/plugins/apisurface/testdata/README.md +++ b/plugins/apisurface/testdata/README.md @@ -1,6 +1,6 @@ # Saved releases -Each golden file, `golden/-.json`, is what the kind stores from a source's golden pair (`go test ./plugins/apisurface -update`): `openai-python-surface.json` from openai 1.1.1 → 1.1.2 (`apisurface_test.go`), the others from the pairs in `pypi_test.go`, read from `pypi//`. +Each golden file, `golden/-.json`, is what the kind stores from a source's golden pair (`go test ./plugins/apisurface -update`): `openai-python-surface.json` from openai 1.1.1 → 1.1.2 (`apisurface_test.go`), the others from the pairs in `pypi_test.go` and `npm_test.go`, read from `pypi//` and `npm//`. | File | URL | Saved | License | Quote | |---|---|---|---|---| @@ -36,3 +36,23 @@ Each golden file, `golden/-.json`, is what the kind stores fro | `pypi/textual/`: `pypi-textual-excerpt.json` and `pypi-textual-8.2.5.json`, `pypi-textual-8.2.6.json`, `pypi-textual-8.2.7.json` | https://pypi.org/pypi/textual/json, https://pypi.org/pypi/textual/<version>/json | 2026-11-21 | PyPI metadata. Trimmed: `releases` to the saved versions, each file to `filename`, `packagetype`, `upload_time_iso_8601`, `yanked`; each version's `urls` to `filename`, `packagetype`, `url`, `yanked` | | | `pypi/urllib3/`: `urllib3-2.2.1-py3-none-any.trimmed.whl`, `urllib3-2.2.2-py3-none-any.trimmed.whl`, `urllib3-2.5.0-py3-none-any.trimmed.whl`, `urllib3-2.6.0-py3-none-any.trimmed.whl` | https://files.pythonhosted.org/packages/a2/73/a68704750a7679d0b6d3ad7aa8d4da8e14e151ae82e6fee774e6e0d05ec8/urllib3-2.2.1-py3-none-any.whl; https://files.pythonhosted.org/packages/ca/1c/89ffc63a9605b583d5df2be791a27bc1a42b7c32bab68d3c8f2f73a98cd4/urllib3-2.2.2-py3-none-any.whl; https://files.pythonhosted.org/packages/a7/c2/fe1e52489ae3122415c51f387e221dd0773709bad6c6cdaa599e8a2c5185/urllib3-2.5.0-py3-none-any.whl; https://files.pythonhosted.org/packages/56/1a/9ffe814d317c5224166b23e7c47f606d6e473712a2fad0f704ea9b99f246/urllib3-2.6.0-py3-none-any.whl | 2026-11-21 | MIT (the wheel's own license files are kept in it). Trimmed: only `urllib3/__init__.py`, `urllib3/response.py` and the dist-info `METADATA`, `WHEEL` and license files, each copied byte for byte | see the source's page under `providers/` | | `pypi/urllib3/`: `pypi-urllib3-excerpt.json` and `pypi-urllib3-2.2.1.json`, `pypi-urllib3-2.2.2.json`, `pypi-urllib3-2.5.0.json`, `pypi-urllib3-2.6.0.json` | https://pypi.org/pypi/urllib3/json, https://pypi.org/pypi/urllib3/<version>/json | 2026-11-21 | PyPI metadata. Trimmed: `releases` to the saved versions, each file to `filename`, `packagetype`, `upload_time_iso_8601`, `yanked`; each version's `urls` to `filename`, `packagetype`, `url`, `yanked` | | +| `npm/anthropic-ai-sdk/`: `sdk-1.6.0.trimmed.tgz`, `sdk-1.7.0.trimmed.tgz`, `sdk-1.8.0.trimmed.tgz` | https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.6.0.tgz; https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.7.0.tgz; https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.8.0.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `client.d.mts`, `index.d.mts`, `resources/beta.d.mts`, `resources/beta/beta.d.mts`, `resources/beta/index.d.mts`, `resources/beta/organization.d.mts`, `resources/beta/organization/index.d.mts`, `resources/beta/organization/organization.d.mts`, `resources/index.d.mts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/anthropic-ai-sdk/`: `npm-anthropic-ai-sdk-excerpt.json` and `npm-anthropic-ai-sdk-1.6.0.json`, `npm-anthropic-ai-sdk-1.7.0.json`, `npm-anthropic-ai-sdk-1.8.0.json` | https://registry.npmjs.org/@anthropic-ai%2Fsdk, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/convex/`: `convex-1.35.0.trimmed.tgz`, `convex-1.35.1.trimmed.tgz`, `convex-1.42.2.trimmed.tgz`, `convex-1.42.3.trimmed.tgz` | https://registry.npmjs.org/convex/-/convex-1.35.0.tgz; https://registry.npmjs.org/convex/-/convex-1.35.1.tgz; https://registry.npmjs.org/convex/-/convex-1.42.2.tgz; https://registry.npmjs.org/convex/-/convex-1.42.3.tgz | 2026-11-21 | Apache-2.0 (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `dist/esm-types/browser/index.d.ts`, `dist/esm-types/browser/query_options.d.ts`, `dist/esm-types/react/client.d.ts`, `dist/esm-types/react/index.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/convex/`: `npm-convex-excerpt.json` and `npm-convex-1.35.0.json`, `npm-convex-1.35.1.json`, `npm-convex-1.42.2.json`, `npm-convex-1.42.3.json` | https://registry.npmjs.org/convex, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/google-genai/`: `genai-0.15.0.trimmed.tgz`, `genai-1.0.0.trimmed.tgz`, `genai-1.1.0.trimmed.tgz` | https://registry.npmjs.org/@google/genai/-/genai-0.15.0.tgz; https://registry.npmjs.org/@google/genai/-/genai-1.0.0.tgz; https://registry.npmjs.org/@google/genai/-/genai-1.1.0.tgz | 2026-11-21 | Apache-2.0 (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `dist/genai.d.ts`, `dist/node/node.d.ts`, `dist/web/web.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/google-genai/`: `npm-google-genai-excerpt.json` and `npm-google-genai-0.15.0.json`, `npm-google-genai-1.0.0.json`, `npm-google-genai-1.1.0.json` | https://registry.npmjs.org/@google%2Fgenai, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/mongodb/`: `mongodb-6.22.0.trimmed.tgz`, `mongodb-7.0.0.trimmed.tgz`, `mongodb-7.1.0.trimmed.tgz` | https://registry.npmjs.org/mongodb/-/mongodb-6.22.0.tgz; https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz; https://registry.npmjs.org/mongodb/-/mongodb-7.1.0.tgz | 2026-11-21 | Apache-2.0 (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `mongodb.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/mongodb/`: `npm-mongodb-excerpt.json` and `npm-mongodb-6.22.0.json`, `npm-mongodb-7.0.0.json`, `npm-mongodb-7.1.0.json` | https://registry.npmjs.org/mongodb, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/neondatabase-serverless/`: `serverless-0.10.4.trimmed.tgz`, `serverless-1.0.0.trimmed.tgz`, `serverless-1.0.1.trimmed.tgz` | https://registry.npmjs.org/@neondatabase/serverless/-/serverless-0.10.4.tgz; https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.0.0.tgz; https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.0.1.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `index.d.mts`, `index.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/neondatabase-serverless/`: `npm-neondatabase-serverless-excerpt.json` and `npm-neondatabase-serverless-0.10.4.json`, `npm-neondatabase-serverless-1.0.0.json`, `npm-neondatabase-serverless-1.0.1.json` | https://registry.npmjs.org/@neondatabase%2Fserverless, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/openai/`: `openai-7.59.0.trimmed.tgz`, `openai-7.60.0.trimmed.tgz`, `openai-7.61.0.trimmed.tgz` | https://registry.npmjs.org/openai/-/openai-7.59.0.tgz; https://registry.npmjs.org/openai/-/openai-7.60.0.tgz; https://registry.npmjs.org/openai/-/openai-7.61.0.tgz | 2026-11-21 | Apache-2.0 (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `resources/beta.d.mts`, `resources/beta/agents.d.mts`, `resources/beta/agents/agents.d.mts`, `resources/beta/agents/index.d.mts`, `resources/beta/index.d.mts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/openai/`: `npm-openai-excerpt.json` and `npm-openai-7.59.0.json`, `npm-openai-7.60.0.json`, `npm-openai-7.61.0.json` | https://registry.npmjs.org/openai, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/redis-client/`: `client-1.6.1.trimmed.tgz`, `client-5.0.0.trimmed.tgz`, `client-6.3.0.trimmed.tgz`, `client-6.3.1.trimmed.tgz` | https://registry.npmjs.org/@redis/client/-/client-1.6.1.tgz; https://registry.npmjs.org/@redis/client/-/client-5.0.0.tgz; https://registry.npmjs.org/@redis/client/-/client-6.3.0.tgz; https://registry.npmjs.org/@redis/client/-/client-6.3.1.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `dist/index.d.ts`, `dist/lib/client/index.d.ts`, `dist/lib/command-options.d.ts`, `dist/lib/commands/FLUSHALL.d.ts`, `dist/lib/errors.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/redis-client/`: `npm-redis-client-excerpt.json` and `npm-redis-client-1.6.1.json`, `npm-redis-client-5.0.0.json`, `npm-redis-client-6.3.0.json`, `npm-redis-client-6.3.1.json` | https://registry.npmjs.org/@redis%2Fclient, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/sentry-node/`: `node-10.0.0.trimmed.tgz`, `node-11.12.0.trimmed.tgz`, `node-11.13.0.trimmed.tgz`, `node-9.47.2.trimmed.tgz` | https://registry.npmjs.org/@sentry/node/-/node-10.0.0.tgz; https://registry.npmjs.org/@sentry/node/-/node-11.12.0.tgz; https://registry.npmjs.org/@sentry/node/-/node-11.13.0.tgz; https://registry.npmjs.org/@sentry/node/-/node-9.47.2.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `build/types/index.d.ts`, `build/types/logs/exports.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/sentry-node/`: `npm-sentry-node-excerpt.json` and `npm-sentry-node-10.0.0.json`, `npm-sentry-node-11.12.0.json`, `npm-sentry-node-11.13.0.json`, `npm-sentry-node-9.47.2.json` | https://registry.npmjs.org/@sentry%2Fnode, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/stripe/`: `stripe-22.6.2.trimmed.tgz`, `stripe-23.0.0.trimmed.tgz`, `stripe-23.0.1.trimmed.tgz` | https://registry.npmjs.org/stripe/-/stripe-22.6.2.tgz; https://registry.npmjs.org/stripe/-/stripe-23.0.0.tgz; https://registry.npmjs.org/stripe/-/stripe-23.0.1.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `esm/stripe.esm.node.d.ts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/stripe/`: `npm-stripe-excerpt.json` and `npm-stripe-22.6.2.json`, `npm-stripe-23.0.0.json`, `npm-stripe-23.0.1.json` | https://registry.npmjs.org/stripe, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | +| `npm/supabase-supabase-js/`: `supabase-js-1.35.7.trimmed.tgz`, `supabase-js-2.0.0.trimmed.tgz`, `supabase-js-2.118.0.trimmed.tgz`, `supabase-js-2.119.0.trimmed.tgz` | https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-1.35.7.tgz; https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.0.0.tgz; https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.118.0.tgz; https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.119.0.tgz | 2026-11-21 | MIT (the package's own license file is kept in each tarball). Trimmed: only `package.json`, the license and `dist/cors.d.cts`, `dist/cors.d.mts`, `dist/index.d.cts`, `dist/index.d.mts`, `dist/main/SupabaseClient.d.ts`, `dist/main/index.d.ts`, `dist/main/lib/SupabaseAuthClient.d.ts`, `dist/main/lib/SupabaseQueryBuilder.d.ts`, `dist/main/lib/SupabaseRealtimeClient.d.ts`, `dist/main/lib/constants.d.ts`, `dist/main/lib/fetch.d.ts`, `dist/main/lib/helpers.d.ts`, `dist/main/lib/types.d.ts`, `dist/main/lib/version.d.ts`, `dist/module/SupabaseClient.d.ts`, `dist/module/index.d.ts`, `dist/module/lib/SupabaseAuthClient.d.ts`, `dist/module/lib/SupabaseQueryBuilder.d.ts`, `dist/module/lib/SupabaseRealtimeClient.d.ts`, `dist/module/lib/constants.d.ts`, `dist/module/lib/fetch.d.ts`, `dist/module/lib/helpers.d.ts`, `dist/module/lib/types.d.ts`, `dist/module/lib/version.d.ts`, `dist/tracing.d.cts`, `dist/tracing.d.mts`, each copied byte for byte | see the source's page under `providers/` | +| `npm/supabase-supabase-js/`: `npm-supabase-supabase-js-excerpt.json` and `npm-supabase-supabase-js-1.35.7.json`, `npm-supabase-supabase-js-2.0.0.json`, `npm-supabase-supabase-js-2.118.0.json`, `npm-supabase-supabase-js-2.119.0.json` | https://registry.npmjs.org/@supabase%2Fsupabase-js, …/<version> | 2026-11-21 | npm registry metadata. Trimmed: `versions` to the saved versions (name and version only) and their `time`; each version's document to `name`, `version`, `dist.tarball` | | diff --git a/plugins/apisurface/testdata/golden/algolia-python-surface.json b/plugins/apisurface/testdata/golden/algolia-python-surface.json index dbc7b74..affce6d 100644 --- a/plugins/apisurface/testdata/golden/algolia-python-surface.json +++ b/plugins/apisurface/testdata/golden/algolia-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:95e246734443816f7e3e35b448487ccc151507de19571e349566567dc818f73e", + "fingerprint": "sha256:620c4cf0edd892d0b56c9191e4c12a96605d17868423c411df42a892e9361a16", "api": "algolia/python-surface", "version": "4.44.3", "previous_version": "4.44.1", @@ -13,7 +13,8 @@ "package": "algoliasearch", "change": "removed_symbol", "symbols": [ - "recommend.models.FacetFilters" + "recommend.models.FacetFilters", + "recommend.models.facet_filters.FacetFilters" ] }, "description": "The class `recommend.models.FacetFilters` was removed in algoliasearch 4.44.3: code using it fails.", @@ -22,29 +23,5 @@ "source_excerpt": "algoliasearch 4.44.1 (algoliasearch-4.44.1-py3-none-any.whl), algoliasearch/recommend/models/facet_filters.py line 21: class FacetFilters(BaseModel) / def __init__(self, *args, **kwargs) -> None\nalgoliasearch 4.44.3 (algoliasearch-4.44.3-py3-none-any.whl): not defined", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 2, - "fingerprint": "sha256:9af26e72ee45fb7595267991a7eba23f19593859865e726ebc55bddbbbba7020", - "api": "algolia/python-surface", - "version": "4.44.3", - "previous_version": "4.44.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "algoliasearch", - "change": "removed_symbol", - "symbols": [ - "recommend.models.facet_filters.FacetFilters" - ] - }, - "description": "The class `recommend.models.facet_filters.FacetFilters` was removed in algoliasearch 4.44.3: code using it fails.", - "migration_hint": "algoliasearch 4.44.3 has no `recommend.models.facet_filters.FacetFilters`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/32/05/84c46d0844055735c1192ba1a0364d871251dbf03e26a465eedf148e63f1/algoliasearch-4.44.3-py3-none-any.whl", - "source_excerpt": "algoliasearch 4.44.1 (algoliasearch-4.44.1-py3-none-any.whl), algoliasearch/recommend/models/facet_filters.py line 21: class FacetFilters(BaseModel) / def __init__(self, *args, **kwargs) -> None\nalgoliasearch 4.44.3 (algoliasearch-4.44.3-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/golden/anthropic-python-surface.json b/plugins/apisurface/testdata/golden/anthropic-python-surface.json index ca6152d..8f20685 100644 --- a/plugins/apisurface/testdata/golden/anthropic-python-surface.json +++ b/plugins/apisurface/testdata/golden/anthropic-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:fb6f37dcc459b9373442bd899b75837579512569fd20921d4159613515cbd6b8", + "fingerprint": "sha256:1f4a2ac2fdc57fd5e725b4001ac2ed0a0dbfb30e368afee10ca5972306f05078", "api": "anthropic/python-surface", "version": "2.7.0", "previous_version": "2.6.0", @@ -13,7 +13,8 @@ "package": "anthropic", "change": "removed_symbol", "symbols": [ - "types.beta.BetaBillingFrozenError" + "types.beta.BetaBillingFrozenError", + "types.beta.beta_billing_frozen_error.BetaBillingFrozenError" ] }, "description": "The class `types.beta.BetaBillingFrozenError` was removed in anthropic 2.7.0: code using it fails.", @@ -25,7 +26,7 @@ }, { "id": 2, - "fingerprint": "sha256:835fb7ffadea1e7cf89d365d3298313fbdc7aa35d5e8605322b5607f3376686b", + "fingerprint": "sha256:156879f4c4b9366cece472b438dd3c0363a2596d1b9f980ff99a215ff3efd0dd", "api": "anthropic/python-surface", "version": "2.7.0", "previous_version": "2.6.0", @@ -37,7 +38,8 @@ "package": "anthropic", "change": "removed_symbol", "symbols": [ - "types.beta.BetaBillingFrozenErrorDetails" + "types.beta.BetaBillingFrozenErrorDetails", + "types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails" ] }, "description": "The class `types.beta.BetaBillingFrozenErrorDetails` was removed in anthropic 2.7.0: code using it fails.", @@ -46,53 +48,5 @@ "source_excerpt": "anthropic 2.6.0 (anthropic-2.6.0-py3-none-any.whl), anthropic/types/beta/beta_billing_frozen_error_details.py line 8: class BetaBillingFrozenErrorDetails(BaseModel)\nanthropic 2.7.0 (anthropic-2.7.0-py3-none-any.whl): not defined", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 3, - "fingerprint": "sha256:140bdb33eb53737c218d59772615fff66f734de3a5a2349076d92833f108ef99", - "api": "anthropic/python-surface", - "version": "2.7.0", - "previous_version": "2.6.0", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "anthropic", - "change": "removed_symbol", - "symbols": [ - "types.beta.beta_billing_frozen_error.BetaBillingFrozenError" - ] - }, - "description": "The class `types.beta.beta_billing_frozen_error.BetaBillingFrozenError` was removed in anthropic 2.7.0: code using it fails.", - "migration_hint": "anthropic 2.7.0 has no `types.beta.beta_billing_frozen_error.BetaBillingFrozenError`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/8a/da/ed144ab553eb2bc7b5febbfb37858f28b33ec332c37f0fdf260012ae3fe2/anthropic-2.7.0-py3-none-any.whl", - "source_excerpt": "anthropic 2.6.0 (anthropic-2.6.0-py3-none-any.whl), anthropic/types/beta/beta_billing_frozen_error.py line 9: class BetaBillingFrozenError(PermissionDeniedError)\nanthropic 2.7.0 (anthropic-2.7.0-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 4, - "fingerprint": "sha256:2503934d584ff19695e7c0297ddb7fa42320f5bea3de19d413db5bae48857b4e", - "api": "anthropic/python-surface", - "version": "2.7.0", - "previous_version": "2.6.0", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "anthropic", - "change": "removed_symbol", - "symbols": [ - "types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails" - ] - }, - "description": "The class `types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails` was removed in anthropic 2.7.0: code using it fails.", - "migration_hint": "anthropic 2.7.0 has no `types.beta.beta_billing_frozen_error_details.BetaBillingFrozenErrorDetails`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/8a/da/ed144ab553eb2bc7b5febbfb37858f28b33ec332c37f0fdf260012ae3fe2/anthropic-2.7.0-py3-none-any.whl", - "source_excerpt": "anthropic 2.6.0 (anthropic-2.6.0-py3-none-any.whl), anthropic/types/beta/beta_billing_frozen_error_details.py line 8: class BetaBillingFrozenErrorDetails(BaseModel)\nanthropic 2.7.0 (anthropic-2.7.0-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/golden/anthropic-typescript-surface.json b/plugins/apisurface/testdata/golden/anthropic-typescript-surface.json new file mode 100644 index 0000000..5eb62bd --- /dev/null +++ b/plugins/apisurface/testdata/golden/anthropic-typescript-surface.json @@ -0,0 +1,67 @@ +[ + { + "id": 1, + "fingerprint": "sha256:b23ccee531a5e6caa0ca401aac41f43c639b72b3e78766ac86c74b30bff1976d", + "api": "anthropic/typescript-surface", + "version": "1.7.0", + "previous_version": "1.6.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@anthropic-ai/sdk", + "change": "removed_symbol", + "symbols": [ + "Anthropic.Beta.BetaBillingFrozenError", + "Anthropic.Beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/client.Anthropic.Beta.BetaBillingFrozenError", + "@anthropic-ai/sdk/client.Anthropic.Beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources.Beta.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources.Beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta.Beta.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta.Beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/beta.Beta.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/beta.Beta.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/organization.Organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/organization/organization.BetaBillingFrozenError", + "@anthropic-ai/sdk/resources/beta/organization/organization.Organization.BetaBillingFrozenError" + ] + }, + "description": "The class `Anthropic.Beta.BetaBillingFrozenError` was removed in @anthropic-ai/sdk 1.7.0: code using it fails.", + "migration_hint": "@anthropic-ai/sdk 1.7.0 has no `Anthropic.Beta.BetaBillingFrozenError`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.7.0.tgz", + "source_excerpt": "@anthropic-ai/sdk 1.6.0 (sdk-1.6.0.tgz), resources/beta/organization/organization.d.mts line 45: class BetaBillingFrozenError extends PermissionDeniedError\n@anthropic-ai/sdk 1.7.0 (sdk-1.7.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:f08ae2d3202434c0f859c333ee95f3c4c652fe79c55014713a4096d555f554bc", + "api": "anthropic/typescript-surface", + "version": "1.7.0", + "previous_version": "1.6.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@anthropic-ai/sdk", + "change": "removed_symbol", + "symbols": [ + "@anthropic-ai/sdk/resources/beta.BetaBillingFrozenErrorDetails", + "@anthropic-ai/sdk/resources/beta/organization.BetaBillingFrozenErrorDetails", + "@anthropic-ai/sdk/resources/beta/organization/organization.BetaBillingFrozenErrorDetails" + ] + }, + "description": "The interface `@anthropic-ai/sdk/resources/beta.BetaBillingFrozenErrorDetails` was removed in @anthropic-ai/sdk 1.7.0: code using it fails.", + "migration_hint": "@anthropic-ai/sdk 1.7.0 has no `@anthropic-ai/sdk/resources/beta.BetaBillingFrozenErrorDetails`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.7.0.tgz", + "source_excerpt": "@anthropic-ai/sdk 1.6.0 (sdk-1.6.0.tgz), resources/beta/organization/organization.d.mts line 84: interface BetaBillingFrozenErrorDetails\n@anthropic-ai/sdk 1.7.0 (sdk-1.7.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/convex-js-surface.json b/plugins/apisurface/testdata/golden/convex-js-surface.json new file mode 100644 index 0000000..eff1d76 --- /dev/null +++ b/plugins/apisurface/testdata/golden/convex-js-surface.json @@ -0,0 +1,26 @@ +[ + { + "id": 1, + "fingerprint": "sha256:4c56412c5a8ece213fbc09f06f566879eb2356ca7b8e0ae4dd0308394c08da81", + "api": "convex/js-surface", + "version": "1.35.1", + "previous_version": "1.35.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "convex", + "change": "removed_symbol", + "symbols": [ + "convex/browser.QueryOptions" + ] + }, + "description": "The type `convex/browser.QueryOptions` was removed in convex 1.35.1: code using it fails.", + "migration_hint": "convex 1.35.1 has no `convex/browser.QueryOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/convex/-/convex-1.35.1.tgz", + "source_excerpt": "convex 1.35.0 (convex-1.35.0.tgz), dist/esm-types/browser/query_options.d.ts line 9: type QueryOptions>\nconvex 1.35.1 (convex-1.35.1.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/elastic-python-surface.json b/plugins/apisurface/testdata/golden/elastic-python-surface.json index a0400d2..6c77f74 100644 --- a/plugins/apisurface/testdata/golden/elastic-python-surface.json +++ b/plugins/apisurface/testdata/golden/elastic-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:ca1757c66d87f7552de1440d2f46b63b76a0d5d33a34ba784470c20556cdba6c", + "fingerprint": "sha256:edf38ebeb4762f278249e91a67f9812059fdc18cb30516ce22fd8ca3ac652213", "api": "elastic/python-surface", "version": "9.1.3", "previous_version": "9.1.2", @@ -13,7 +13,8 @@ "package": "elasticsearch", "change": "changed_default", "symbols": [ - "Elasticsearch.delete_by_query_rethrottle" + "Elasticsearch.delete_by_query_rethrottle", + "client.Elasticsearch.delete_by_query_rethrottle" ], "parameter": "requests_per_second" }, @@ -26,7 +27,7 @@ }, { "id": 2, - "fingerprint": "sha256:ae3587bdab3994a42671f3dee76739fc81ab294d1cc81c7e056246ce7d78fdaf", + "fingerprint": "sha256:5a9c31721c563256b9824ee231f73e2e1c78e2dc2c100b2a19a98542efea7e50", "api": "elastic/python-surface", "version": "9.1.3", "previous_version": "9.1.2", @@ -38,7 +39,8 @@ "package": "elasticsearch", "change": "changed_default", "symbols": [ - "Elasticsearch.reindex_rethrottle" + "Elasticsearch.reindex_rethrottle", + "client.Elasticsearch.reindex_rethrottle" ], "parameter": "requests_per_second" }, @@ -51,7 +53,7 @@ }, { "id": 3, - "fingerprint": "sha256:833ae708d266b594f0dbb2e1bca62f6bb21ba55979e5a969f129925666e782da", + "fingerprint": "sha256:6618d1ebaf11b7b3c7a419c65810b42af1a75459ac927ad1138c3257a3307bad", "api": "elastic/python-surface", "version": "9.1.3", "previous_version": "9.1.2", @@ -63,7 +65,8 @@ "package": "elasticsearch", "change": "changed_default", "symbols": [ - "Elasticsearch.update_by_query_rethrottle" + "Elasticsearch.update_by_query_rethrottle", + "client.Elasticsearch.update_by_query_rethrottle" ], "parameter": "requests_per_second" }, @@ -73,80 +76,5 @@ "source_excerpt": "elasticsearch 9.1.2 (elasticsearch-9.1.2-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 6341: def update_by_query_rethrottle( self, *, task_id: str, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]\nelasticsearch 9.1.3 (elasticsearch-9.1.3-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 6343: def update_by_query_rethrottle( self, *, task_id: str, requests_per_second: float, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 4, - "fingerprint": "sha256:cc66060c7499630e058854a71280736e8e6dd6b26f7d06bb11ec1e44a6529455", - "api": "elastic/python-surface", - "version": "9.1.3", - "previous_version": "9.1.2", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "elasticsearch", - "change": "changed_default", - "symbols": [ - "client.Elasticsearch.delete_by_query_rethrottle" - ], - "parameter": "requests_per_second" - }, - "description": "`client.Elasticsearch.delete_by_query_rethrottle`'s parameter `requests_per_second` has no default in elasticsearch 9.1.3 (it was `None`): a call that leaves it out raises a TypeError.", - "migration_hint": "Pass `requests_per_second=None` to `client.Elasticsearch.delete_by_query_rethrottle` to keep the old behavior.", - "source_url": "https://files.pythonhosted.org/packages/bf/10/cab92a57625aeb2d787e3f5e3a698948bc5b34c151422afacff1f0f1c691/elasticsearch-9.1.3-py3-none-any.whl", - "source_excerpt": "elasticsearch 9.1.2 (elasticsearch-9.1.2-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 1634: def delete_by_query_rethrottle( self, *, task_id: str, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]\nelasticsearch 9.1.3 (elasticsearch-9.1.3-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 1638: def delete_by_query_rethrottle( self, *, task_id: str, requests_per_second: float, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 5, - "fingerprint": "sha256:73d9db814840017f6d510f0c1abf1e3c8dde23216545d1e650b1234cdca568c7", - "api": "elastic/python-surface", - "version": "9.1.3", - "previous_version": "9.1.2", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "elasticsearch", - "change": "changed_default", - "symbols": [ - "client.Elasticsearch.reindex_rethrottle" - ], - "parameter": "requests_per_second" - }, - "description": "`client.Elasticsearch.reindex_rethrottle`'s parameter `requests_per_second` has no default in elasticsearch 9.1.3 (it was `None`): a call that leaves it out raises a TypeError.", - "migration_hint": "Pass `requests_per_second=None` to `client.Elasticsearch.reindex_rethrottle` to keep the old behavior.", - "source_url": "https://files.pythonhosted.org/packages/bf/10/cab92a57625aeb2d787e3f5e3a698948bc5b34c151422afacff1f0f1c691/elasticsearch-9.1.3-py3-none-any.whl", - "source_excerpt": "elasticsearch 9.1.2 (elasticsearch-9.1.2-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 3990: def reindex_rethrottle( self, *, task_id: str, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]\nelasticsearch 9.1.3 (elasticsearch-9.1.3-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 3994: def reindex_rethrottle( self, *, task_id: str, requests_per_second: float, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 6, - "fingerprint": "sha256:cc46f125ec396799a75e4980c286ff1203a49d1e54bae53905f435a7ea31d7ca", - "api": "elastic/python-surface", - "version": "9.1.3", - "previous_version": "9.1.2", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "elasticsearch", - "change": "changed_default", - "symbols": [ - "client.Elasticsearch.update_by_query_rethrottle" - ], - "parameter": "requests_per_second" - }, - "description": "`client.Elasticsearch.update_by_query_rethrottle`'s parameter `requests_per_second` has no default in elasticsearch 9.1.3 (it was `None`): a call that leaves it out raises a TypeError.", - "migration_hint": "Pass `requests_per_second=None` to `client.Elasticsearch.update_by_query_rethrottle` to keep the old behavior.", - "source_url": "https://files.pythonhosted.org/packages/bf/10/cab92a57625aeb2d787e3f5e3a698948bc5b34c151422afacff1f0f1c691/elasticsearch-9.1.3-py3-none-any.whl", - "source_excerpt": "elasticsearch 9.1.2 (elasticsearch-9.1.2-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 6341: def update_by_query_rethrottle( self, *, task_id: str, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, requests_per_second: t.Optional[float] = None, ) -> ObjectApiResponse[t.Any]\nelasticsearch 9.1.3 (elasticsearch-9.1.3-py3-none-any.whl), elasticsearch/_sync/client/__init__.py line 6343: def update_by_query_rethrottle( self, *, task_id: str, requests_per_second: float, error_trace: t.Optional[bool] = None, filter_path: t.Optional[t.Union[str, t.Sequence[str]]] = None, human: t.Optional[bool] = None, pretty: t.Optional[bool] = None, ) -> ObjectApiResponse[t.Any]", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/golden/google-genai-js-surface.json b/plugins/apisurface/testdata/golden/google-genai-js-surface.json new file mode 100644 index 0000000..329d698 --- /dev/null +++ b/plugins/apisurface/testdata/golden/google-genai-js-surface.json @@ -0,0 +1,74 @@ +[ + { + "id": 1, + "fingerprint": "sha256:3c4bc51d5938fb29c383e15feec7d6b4e5aff01b9f17058a466d89fd6a2a3cac", + "api": "google/genai-js-surface", + "version": "1.0.0", + "previous_version": "0.15.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@google/genai", + "change": "removed_symbol", + "symbols": [ + "LiveMusicSetClientContentParameters" + ] + }, + "description": "The interface `LiveMusicSetClientContentParameters` was removed in @google/genai 1.0.0: code using it fails.", + "migration_hint": "@google/genai 1.0.0 has no `LiveMusicSetClientContentParameters`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@google/genai/-/genai-1.0.0.tgz", + "source_excerpt": "@google/genai 0.15.0 (genai-0.15.0.tgz), dist/genai.d.ts line 3757: interface LiveMusicSetClientContentParameters\n@google/genai 1.0.0 (genai-1.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:ec64180f7fd0eddfd7bd972c4862b42da57bb3b8b5fb16a761f927d675f5b6d6", + "api": "google/genai-js-surface", + "version": "1.0.0", + "previous_version": "0.15.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@google/genai", + "change": "removed_symbol", + "symbols": [ + "@google/genai/node.LiveMusicSetClientContentParameters" + ] + }, + "description": "The interface `@google/genai/node.LiveMusicSetClientContentParameters` was removed in @google/genai 1.0.0: code using it fails.", + "migration_hint": "@google/genai 1.0.0 has no `@google/genai/node.LiveMusicSetClientContentParameters`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@google/genai/-/genai-1.0.0.tgz", + "source_excerpt": "@google/genai 0.15.0 (genai-0.15.0.tgz), dist/node/node.d.ts line 3769: interface LiveMusicSetClientContentParameters\n@google/genai 1.0.0 (genai-1.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:dc3d0647e0d3b5bac9c81cf053789a818a5a6dcaf99d7bceb0433eb072962574", + "api": "google/genai-js-surface", + "version": "1.0.0", + "previous_version": "0.15.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@google/genai", + "change": "removed_symbol", + "symbols": [ + "@google/genai/web.LiveMusicSetClientContentParameters" + ] + }, + "description": "The interface `@google/genai/web.LiveMusicSetClientContentParameters` was removed in @google/genai 1.0.0: code using it fails.", + "migration_hint": "@google/genai 1.0.0 has no `@google/genai/web.LiveMusicSetClientContentParameters`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@google/genai/-/genai-1.0.0.tgz", + "source_excerpt": "@google/genai 0.15.0 (genai-0.15.0.tgz), dist/web/web.d.ts line 3762: interface LiveMusicSetClientContentParameters\n@google/genai 1.0.0 (genai-1.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/mongodb-node-surface.json b/plugins/apisurface/testdata/golden/mongodb-node-surface.json new file mode 100644 index 0000000..28f6e0e --- /dev/null +++ b/plugins/apisurface/testdata/golden/mongodb-node-surface.json @@ -0,0 +1,290 @@ +[ + { + "id": 1, + "fingerprint": "sha256:b61444f06bb5f6953cf166251931927a629b6f456f7fb595355b79ff97251137", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "AsyncDisposable" + ] + }, + "description": "The interface `AsyncDisposable` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `AsyncDisposable`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 613: interface AsyncDisposable_2\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:c929142262becd8c87f9713e4c7dbb3bcc752519988bb62b0391ebe3e20c4b1e", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "CancellationToken" + ] + }, + "description": "The class `CancellationToken` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `CancellationToken`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 1151: class CancellationToken extends TypedEventEmitter<{ cancel(): void; }> / constructor(...args: any[])\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:6d16386d8205c2a4ea10506bcb16c504b681d695c8abfa7ba1fb5c387c8dcfa8", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ChangeStream.streamOptions" + ] + }, + "description": "The property `ChangeStream.streamOptions` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ChangeStream.streamOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 1179: streamOptions?: CursorStreamOptions\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 4, + "fingerprint": "sha256:07c32100fd99cae3e6cb10b5f91d57ab1f69943b680562c6d960d9f5fc1444df", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ClientMetadata" + ] + }, + "description": "The interface `ClientMetadata` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ClientMetadata`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 2239: interface ClientMetadata\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 5, + "fingerprint": "sha256:1872a54a678b3a712578b064d0206c38a67288cea71a2c89eca166d7505e8b07", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ClientMetadataOptions" + ] + }, + "description": "The interface `ClientMetadataOptions` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ClientMetadataOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 2268: interface ClientMetadataOptions\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 6, + "fingerprint": "sha256:742daf6681c54619d23e3134617444b2abf4f8fc2821da6fd93e288147981ef6", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ClientSession.transaction" + ] + }, + "description": "The property `ClientSession.transaction` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ClientSession.transaction`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 2317: transaction: Transaction\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 7, + "fingerprint": "sha256:1e7a8a626163b2844747f61cf2c9ad140f2b34c65095e8e81d29725cce4db6df", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "CloseOptions" + ] + }, + "description": "The interface `CloseOptions` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `CloseOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 2569: interface CloseOptions\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 8, + "fingerprint": "sha256:8a72f17b9ce89c546d8f2f3e005da2069151f31fd8e8185047e4a44546c00cc6", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "CursorStreamOptions" + ] + }, + "description": "The interface `CursorStreamOptions` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `CursorStreamOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 3746: interface CursorStreamOptions\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 9, + "fingerprint": "sha256:1ee48776c8846070e182d0b1cb37a7b4600d98388978a08bfb974c6f9ad702ee", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ReadPreference.minWireVersion" + ] + }, + "description": "The property `ReadPreference.minWireVersion` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ReadPreference.minWireVersion`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 7490: minWireVersion?: number\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 10, + "fingerprint": "sha256:fbb143a9999b0a23716504d99431fd742efa743670e405a198273463672e98ec", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ResumeOptions" + ] + }, + "description": "The interface `ResumeOptions` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ResumeOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 7636: interface ResumeOptions\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 11, + "fingerprint": "sha256:a331df084d2de7e766ee42127c85bc89956e253e74c0dc13237fb5dc6c15b9d7", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "ServerCapabilities" + ] + }, + "description": "The class `ServerCapabilities` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `ServerCapabilities`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 7826: class ServerCapabilities / constructor(hello: Document)\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 12, + "fingerprint": "sha256:8dd4c1d237aaada9349934a1f7dcc019852702a1c86e2e93382e4fa92feb2937", + "api": "mongodb/node-surface", + "version": "7.0.0", + "previous_version": "6.22.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "mongodb", + "change": "removed_symbol", + "symbols": [ + "Transaction" + ] + }, + "description": "The class `Transaction` was removed in mongodb 7.0.0: code using it fails.", + "migration_hint": "mongodb 7.0.0 has no `Transaction`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz", + "source_excerpt": "mongodb 6.22.0 (mongodb-6.22.0.tgz), mongodb.d.ts line 8448: class Transaction\nmongodb 7.0.0 (mongodb-7.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/mongodb-pymongo-surface.json b/plugins/apisurface/testdata/golden/mongodb-pymongo-surface.json index 0da235f..f478afd 100644 --- a/plugins/apisurface/testdata/golden/mongodb-pymongo-surface.json +++ b/plugins/apisurface/testdata/golden/mongodb-pymongo-surface.json @@ -51,7 +51,7 @@ }, { "id": 3, - "fingerprint": "sha256:2aa202533ee1eadd2d5520a4bdac4feb358488eb097f42de3ed92c03a368b79f", + "fingerprint": "sha256:7ff5d2a79bf8059a04881cec2d0ab3dec0a41ce6d1aa3e4973b45283f916533e", "api": "mongodb/pymongo-surface", "version": "4.16.0", "previous_version": "4.15.5", @@ -63,7 +63,8 @@ "package": "pymongo", "change": "removed_parameter", "symbols": [ - "command_cursor.CommandCursor" + "command_cursor.CommandCursor", + "synchronous.command_cursor.CommandCursor" ], "parameter": "explicit_session" }, @@ -76,7 +77,7 @@ }, { "id": 4, - "fingerprint": "sha256:776c26a7c3102de14dbf1780065e5e13f1457caf39ba7764dfa1a94f6ebd92a9", + "fingerprint": "sha256:5283de0adaf0d978f56f2609d2ddf85bbacba200bb0b02c3cf2d0ea8be96071e", "api": "mongodb/pymongo-surface", "version": "4.16.0", "previous_version": "4.15.5", @@ -88,7 +89,8 @@ "package": "pymongo", "change": "removed_parameter", "symbols": [ - "command_cursor.RawBatchCommandCursor" + "command_cursor.RawBatchCommandCursor", + "synchronous.command_cursor.RawBatchCommandCursor" ], "parameter": "explicit_session" }, @@ -98,55 +100,5 @@ "source_excerpt": "pymongo 4.15.5 (pymongo-4.15.5-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 422: class RawBatchCommandCursor(CommandCursor[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, explicit_session: bool = False, comment: Any = None, ) -> None\npymongo 4.16.0 (pymongo-4.16.0-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 424: class RawBatchCommandCursor(CommandCursor[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, comment: Any = None, ) -> None", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 5, - "fingerprint": "sha256:92385a2407cd6ed110661d5d5185cbced9cd5ce3ea22cf5363138adb28daa180", - "api": "mongodb/pymongo-surface", - "version": "4.16.0", - "previous_version": "4.15.5", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "pymongo", - "change": "removed_parameter", - "symbols": [ - "synchronous.command_cursor.CommandCursor" - ], - "parameter": "explicit_session" - }, - "description": "`synchronous.command_cursor.CommandCursor` no longer takes the parameter `explicit_session` in pymongo 4.16.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `explicit_session` to `synchronous.command_cursor.CommandCursor`; its signature in 4.16.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/4d/93/c36c0998dd91ad8b5031d2e77a903d5cd705b5ba05ca92bcc8731a2c3a8d/pymongo-4.16.0-cp310-cp310-macosx_10_9_x86_64.whl", - "source_excerpt": "pymongo 4.15.5 (pymongo-4.15.5-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 54: class CommandCursor(Generic[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, explicit_session: bool = False, comment: Any = None, ) -> None\npymongo 4.16.0 (pymongo-4.16.0-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 54: class CommandCursor(Generic[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, comment: Any = None, ) -> None", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 6, - "fingerprint": "sha256:5c5b44bd9ce8967fc28b81a14e4ebbcaab56bb876959aa3189272db0c72aed0e", - "api": "mongodb/pymongo-surface", - "version": "4.16.0", - "previous_version": "4.15.5", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "pymongo", - "change": "removed_parameter", - "symbols": [ - "synchronous.command_cursor.RawBatchCommandCursor" - ], - "parameter": "explicit_session" - }, - "description": "`synchronous.command_cursor.RawBatchCommandCursor` no longer takes the parameter `explicit_session` in pymongo 4.16.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `explicit_session` to `synchronous.command_cursor.RawBatchCommandCursor`; its signature in 4.16.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/4d/93/c36c0998dd91ad8b5031d2e77a903d5cd705b5ba05ca92bcc8731a2c3a8d/pymongo-4.16.0-cp310-cp310-macosx_10_9_x86_64.whl", - "source_excerpt": "pymongo 4.15.5 (pymongo-4.15.5-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 422: class RawBatchCommandCursor(CommandCursor[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, explicit_session: bool = False, comment: Any = None, ) -> None\npymongo 4.16.0 (pymongo-4.16.0-cp310-cp310-macosx_10_9_x86_64.whl), pymongo/synchronous/command_cursor.py line 424: class RawBatchCommandCursor(CommandCursor[_DocumentType]) / def __init__( self, collection: Collection[_DocumentType], cursor_info: Mapping[str, Any], address: Optional[_Address], batch_size: int = 0, max_await_time_ms: Optional[int] = None, session: Optional[ClientSession] = None, comment: Any = None, ) -> None", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/golden/neon-serverless-surface.json b/plugins/apisurface/testdata/golden/neon-serverless-surface.json new file mode 100644 index 0000000..7561971 --- /dev/null +++ b/plugins/apisurface/testdata/golden/neon-serverless-surface.json @@ -0,0 +1,26 @@ +[ + { + "id": 1, + "fingerprint": "sha256:8ad70579778a2e9058ff551ad659ce8f7168e3457255b4f48d3bfa1e0309ecdd", + "api": "neon/serverless-surface", + "version": "1.0.0", + "previous_version": "0.10.4", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@neondatabase/serverless", + "change": "removed_symbol", + "symbols": [ + "native" + ] + }, + "description": "The export `native` was removed in @neondatabase/serverless 1.0.0: code using it fails.", + "migration_hint": "@neondatabase/serverless 1.0.0 has no `native`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.0.0.tgz", + "source_excerpt": "@neondatabase/serverless 0.10.4 (serverless-0.10.4.tgz), index.d.mts line 8: export { native } from \"pg\"\n@neondatabase/serverless 1.0.0 (serverless-1.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/openai-node-surface.json b/plugins/apisurface/testdata/golden/openai-node-surface.json new file mode 100644 index 0000000..d5e5d00 --- /dev/null +++ b/plugins/apisurface/testdata/golden/openai-node-surface.json @@ -0,0 +1,28 @@ +[ + { + "id": 1, + "fingerprint": "sha256:f8e5184f69dd30d9ba8a4114bad2a46b3f15d2bf599f036edd875dfd577179ba", + "api": "openai/node-surface", + "version": "7.60.0", + "previous_version": "7.59.0", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "openai", + "change": "removed_symbol", + "symbols": [ + "openai/resources/beta.AgentSessionBudgetReachedEvent", + "openai/resources/beta/agents.AgentSessionBudgetReachedEvent", + "openai/resources/beta/agents/agents.AgentSessionBudgetReachedEvent" + ] + }, + "description": "The interface `openai/resources/beta.AgentSessionBudgetReachedEvent` was removed in openai 7.60.0: code using it fails.", + "migration_hint": "openai 7.60.0 has no `openai/resources/beta.AgentSessionBudgetReachedEvent`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/openai/-/openai-7.60.0.tgz", + "source_excerpt": "openai 7.59.0 (openai-7.59.0.tgz), resources/beta/agents/agents.d.mts line 1188: interface AgentSessionBudgetReachedEvent\nopenai 7.60.0 (openai-7.60.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/openai-python-surface.json b/plugins/apisurface/testdata/golden/openai-python-surface.json index 27c05ce..84b0c41 100644 --- a/plugins/apisurface/testdata/golden/openai-python-surface.json +++ b/plugins/apisurface/testdata/golden/openai-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:8e136bc6c99457904b7001c21e8783822fc3821daf882c6db30d86ef3af75f08", + "fingerprint": "sha256:33ec654be5153a8dffb6be8b4d82cf635aa1a7e01e70e5f212df9938ff3c2213", "api": "openai/python-surface", "version": "1.1.2", "previous_version": "1.1.1", @@ -13,7 +13,8 @@ "package": "openai", "change": "removed_symbol", "symbols": [ - "types.beta.AsssitantDeleted" + "types.beta.AsssitantDeleted", + "types.beta.asssitant_deleted.AsssitantDeleted" ] }, "description": "The class `types.beta.AsssitantDeleted` was removed in openai 1.1.2: code using it fails.", @@ -22,29 +23,5 @@ "source_excerpt": "openai 1.1.1 (openai-1.1.1-py3-none-any.whl), openai/types/beta/asssitant_deleted.py line 10: class AsssitantDeleted(BaseModel)\nopenai 1.1.2 (openai-1.1.2-py3-none-any.whl): not defined", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 2, - "fingerprint": "sha256:d4c8db1c17ff6739ceb947019823ef8de79d77fd0da8be47e9701aa43fa28a8a", - "api": "openai/python-surface", - "version": "1.1.2", - "previous_version": "1.1.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "openai", - "change": "removed_symbol", - "symbols": [ - "types.beta.asssitant_deleted.AsssitantDeleted" - ] - }, - "description": "The class `types.beta.asssitant_deleted.AsssitantDeleted` was removed in openai 1.1.2: code using it fails.", - "migration_hint": "openai 1.1.2 has no `types.beta.asssitant_deleted.AsssitantDeleted`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/dd/82/b92f73453ea318c0d46f31aeb56e9d94a42606c010fb72a513f4a3cd4bac/openai-1.1.2-py3-none-any.whl", - "source_excerpt": "openai 1.1.1 (openai-1.1.1-py3-none-any.whl), openai/types/beta/asssitant_deleted.py line 10: class AsssitantDeleted(BaseModel)\nopenai 1.1.2 (openai-1.1.2-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/golden/redis-node-redis-surface.json b/plugins/apisurface/testdata/golden/redis-node-redis-surface.json new file mode 100644 index 0000000..0016db2 --- /dev/null +++ b/plugins/apisurface/testdata/golden/redis-node-redis-surface.json @@ -0,0 +1,50 @@ +[ + { + "id": 1, + "fingerprint": "sha256:d970a908bf0b4a315ebe3b2e58ea35fa200f14be60a1766ebb3d00b7bdd43c75", + "api": "redis/node-redis-surface", + "version": "5.0.0", + "previous_version": "1.6.1", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@redis/client", + "change": "removed_symbol", + "symbols": [ + "RedisFlushModes" + ] + }, + "description": "The enum `RedisFlushModes` was removed in @redis/client 5.0.0: code using it fails.", + "migration_hint": "@redis/client 5.0.0 has no `RedisFlushModes`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@redis/client/-/client-5.0.0.tgz", + "source_excerpt": "@redis/client 1.6.1 (client-1.6.1.tgz), dist/lib/commands/FLUSHALL.d.ts line 1: enum RedisFlushModes\n@redis/client 5.0.0 (client-5.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:d45c7699a9c5708e947fddde2a03a1556f1a02b3fc5268d6b759c43576f75204", + "api": "redis/node-redis-surface", + "version": "5.0.0", + "previous_version": "1.6.1", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@redis/client", + "change": "removed_symbol", + "symbols": [ + "commandOptions" + ] + }, + "description": "The variable `commandOptions` was removed in @redis/client 5.0.0: code using it fails.", + "migration_hint": "@redis/client 5.0.0 has no `commandOptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@redis/client/-/client-5.0.0.tgz", + "source_excerpt": "@redis/client 1.6.1 (client-1.6.1.tgz), dist/index.d.ts line 6: const commandOptions: typeof RedisClient.commandOptions\n@redis/client 5.0.0 (client-5.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/sentry-node-surface.json b/plugins/apisurface/testdata/golden/sentry-node-surface.json new file mode 100644 index 0000000..9fe10af --- /dev/null +++ b/plugins/apisurface/testdata/golden/sentry-node-surface.json @@ -0,0 +1,26 @@ +[ + { + "id": 1, + "fingerprint": "sha256:90cf03be39ede17ce97c960570711221ff22297deb0125a2ac0f2c002ec9ba1e", + "api": "sentry/node-surface", + "version": "10.0.0", + "previous_version": "9.47.2", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@sentry/node", + "change": "removed_symbol", + "symbols": [ + "systemErrorIntegration" + ] + }, + "description": "The export `systemErrorIntegration` was removed in @sentry/node 10.0.0: code using it fails.", + "migration_hint": "@sentry/node 10.0.0 has no `systemErrorIntegration`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@sentry/node/-/node-10.0.0.tgz", + "source_excerpt": "@sentry/node 9.47.2 (node-9.47.2.tgz), build/types/index.d.ts line 35: export { systemErrorIntegration } from \"@sentry/node-core\"\n@sentry/node 10.0.0 (node-10.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/stripe-node-surface.json b/plugins/apisurface/testdata/golden/stripe-node-surface.json new file mode 100644 index 0000000..0f3a3b4 --- /dev/null +++ b/plugins/apisurface/testdata/golden/stripe-node-surface.json @@ -0,0 +1,50 @@ +[ + { + "id": 1, + "fingerprint": "sha256:76de4b15e9c0f3a02f420e1848e6e2ce518f2575fdd92eda8027b31ce884e2de", + "api": "stripe/node-surface", + "version": "23.0.0", + "previous_version": "22.6.2", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "stripe", + "change": "removed_symbol", + "symbols": [ + "Stripe.ErrorType" + ] + }, + "description": "The namespace `Stripe.ErrorType` was removed in stripe 23.0.0: code using it fails.", + "migration_hint": "stripe 23.0.0 has no `Stripe.ErrorType`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/stripe/-/stripe-23.0.0.tgz", + "source_excerpt": "stripe 22.6.2 (stripe-22.6.2.tgz), esm/stripe.esm.node.d.ts line 482: namespace ErrorType\nstripe 23.0.0 (stripe-23.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:b3ac4dd442c1fa7f0a8fd743cf940c0dd57d440a50924a91d6a9fc6ce6ed6cfe", + "api": "stripe/node-surface", + "version": "23.0.0", + "previous_version": "22.6.2", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "stripe", + "change": "removed_symbol", + "symbols": [ + "Stripe.constructEventWithoutVerification" + ] + }, + "description": "The method `Stripe.constructEventWithoutVerification` was removed in stripe 23.0.0: code using it fails.", + "migration_hint": "stripe 23.0.0 has no `Stripe.constructEventWithoutVerification`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/stripe/-/stripe-23.0.0.tgz", + "source_excerpt": "stripe 22.6.2 (stripe-22.6.2.tgz), esm/stripe.esm.node.d.ts line 347: constructEventWithoutVerification(payload: string): Event\nstripe 23.0.0 (stripe-23.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/supabase-js-surface.json b/plugins/apisurface/testdata/golden/supabase-js-surface.json new file mode 100644 index 0000000..99c1faf --- /dev/null +++ b/plugins/apisurface/testdata/golden/supabase-js-surface.json @@ -0,0 +1,74 @@ +[ + { + "id": 1, + "fingerprint": "sha256:87c811b15734f3d780657fa1ca375a4a7f586daa1d6290e3aa985eec0b28df46", + "api": "supabase/js-surface", + "version": "2.0.0", + "previous_version": "1.35.7", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@supabase/supabase-js", + "change": "removed_symbol", + "symbols": [ + "SupabaseClient.getSubscriptions" + ] + }, + "description": "The method `SupabaseClient.getSubscriptions` was removed in @supabase/supabase-js 2.0.0: code using it fails.", + "migration_hint": "@supabase/supabase-js 2.0.0 has no `SupabaseClient.getSubscriptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.0.0.tgz", + "source_excerpt": "@supabase/supabase-js 1.35.7 (supabase-js-1.35.7.tgz), dist/module/SupabaseClient.d.ts line 100: getSubscriptions(): RealtimeSubscription[]\n@supabase/supabase-js 2.0.0 (supabase-js-2.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 2, + "fingerprint": "sha256:9e744cb3c8fd5836ac1a51a6d9993cc748ca2784f6a95283c1f75fcfe4e23f5d", + "api": "supabase/js-surface", + "version": "2.0.0", + "previous_version": "1.35.7", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@supabase/supabase-js", + "change": "removed_symbol", + "symbols": [ + "SupabaseClient.removeAllSubscriptions" + ] + }, + "description": "The method `SupabaseClient.removeAllSubscriptions` was removed in @supabase/supabase-js 2.0.0: code using it fails.", + "migration_hint": "@supabase/supabase-js 2.0.0 has no `SupabaseClient.removeAllSubscriptions`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.0.0.tgz", + "source_excerpt": "@supabase/supabase-js 1.35.7 (supabase-js-1.35.7.tgz), dist/module/SupabaseClient.d.ts line 78: removeAllSubscriptions(): Promise<{ data: { subscription: RealtimeSubscription; }; error: Error | null; }[]>\n@supabase/supabase-js 2.0.0 (supabase-js-2.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + }, + { + "id": 3, + "fingerprint": "sha256:2f76e317aca4dd879a2a042a376c329d31432c0f59a74996661f61acaaa724ab", + "api": "supabase/js-surface", + "version": "2.0.0", + "previous_version": "1.35.7", + "change_type": "breaking", + "breaking": true, + "subject": { + "type": "package_release", + "ecosystem": "npm", + "package": "@supabase/supabase-js", + "change": "removed_symbol", + "symbols": [ + "SupabaseClient.removeSubscription" + ] + }, + "description": "The method `SupabaseClient.removeSubscription` was removed in @supabase/supabase-js 2.0.0: code using it fails.", + "migration_hint": "@supabase/supabase-js 2.0.0 has no `SupabaseClient.removeSubscription`: see the package's release notes for what replaces it.", + "source_url": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.0.0.tgz", + "source_excerpt": "@supabase/supabase-js 1.35.7 (supabase-js-1.35.7.tgz), dist/module/SupabaseClient.d.ts line 89: removeSubscription(subscription: RealtimeSubscription): Promise<{ data: { openSubscriptions: number; }; error: Error | null; }>\n@supabase/supabase-js 2.0.0 (supabase-js-2.0.0.tgz): not defined", + "confidence": 1, + "detected_at": "2026-11-14T12:00:00Z" + } +] diff --git a/plugins/apisurface/testdata/golden/supabase-python-surface.json b/plugins/apisurface/testdata/golden/supabase-python-surface.json index fdd1fd7..5e06887 100644 --- a/plugins/apisurface/testdata/golden/supabase-python-surface.json +++ b/plugins/apisurface/testdata/golden/supabase-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:f4ee227111982d6630ae7be6d6c74f35b5c83dbf1049afa4d0e3b1ca82455c1d", + "fingerprint": "sha256:06e68d8c2f3c2d9b76115188b561ca1c1be4956f52cfc05c95c571226caa7373", "api": "supabase/python-surface", "version": "1.0.0", "previous_version": "0.7.1", @@ -13,7 +13,8 @@ "package": "supabase", "change": "removed_parameter", "symbols": [ - "SupabaseAuthClient" + "SupabaseAuthClient", + "lib.auth_client.SupabaseAuthClient" ], "parameter": "api" }, @@ -26,7 +27,7 @@ }, { "id": 2, - "fingerprint": "sha256:a826333169c3f39e9ce9e2d7388357bfc54293f736cc37f26f5fcfc995e3417f", + "fingerprint": "sha256:b5db5258c88b4532f67454ffc2966598ec1c6afbf738782c6472f4e22d804b83", "api": "supabase/python-surface", "version": "1.0.0", "previous_version": "0.7.1", @@ -38,7 +39,8 @@ "package": "supabase", "change": "removed_parameter", "symbols": [ - "SupabaseAuthClient" + "SupabaseAuthClient", + "lib.auth_client.SupabaseAuthClient" ], "parameter": "cookie_options" }, @@ -51,7 +53,7 @@ }, { "id": 3, - "fingerprint": "sha256:9559404087e8d8ff2604e6b04659304e4983fbc3e276156ef528e77770bdb155", + "fingerprint": "sha256:90fdf200c73977ab7800fca5b0854ff86f1f49c62e61f814b7609423f5b05459", "api": "supabase/python-surface", "version": "1.0.0", "previous_version": "0.7.1", @@ -63,7 +65,8 @@ "package": "supabase", "change": "removed_parameter", "symbols": [ - "SupabaseAuthClient" + "SupabaseAuthClient", + "lib.auth_client.SupabaseAuthClient" ], "parameter": "local_storage" }, @@ -76,7 +79,7 @@ }, { "id": 4, - "fingerprint": "sha256:c212e0f8db0d3848f22ed825157f27c184b6d92fa718fa8012ebbd540c177a87", + "fingerprint": "sha256:b4bb8ebb041ac0485fd8e1732fc5ad14ae4fddec09ce71a32fd587b3d2754e7a", "api": "supabase/python-surface", "version": "1.0.0", "previous_version": "0.7.1", @@ -88,7 +91,8 @@ "package": "supabase", "change": "removed_parameter", "symbols": [ - "SupabaseAuthClient" + "SupabaseAuthClient", + "lib.auth_client.SupabaseAuthClient" ], "parameter": "replace_default_headers" }, @@ -101,106 +105,6 @@ }, { "id": 5, - "fingerprint": "sha256:f3bea2369c2edfa6e84f0ca919bf2859c0bf4b824cd0cdaacd14b26be16d0970", - "api": "supabase/python-surface", - "version": "1.0.0", - "previous_version": "0.7.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "supabase", - "change": "removed_parameter", - "symbols": [ - "lib.auth_client.SupabaseAuthClient" - ], - "parameter": "api" - }, - "description": "`lib.auth_client.SupabaseAuthClient` no longer takes the parameter `api` in supabase 1.0.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `api` to `lib.auth_client.SupabaseAuthClient`; its signature in 1.0.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/8d/7b/42e5e27e4c9f4f5e24c0d3294b7448948b97963c69d634c664b7beaaae4b/supabase-1.0.0-py3-none-any.whl", - "source_excerpt": "supabase 0.7.1 (supabase-0.7.1-py3-none-any.whl), supabase/lib/auth_client.py line 13: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, auto_refresh_token: bool = True, persist_session: bool = True, local_storage: SyncSupportedStorage = SyncMemoryStorage(), cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS), api: Optional[SyncGoTrueAPI] = None, replace_default_headers: bool = False, )\nsupabase 1.0.0 (supabase-1.0.0-py3-none-any.whl), supabase/lib/auth_client.py line 14: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, storage_key: Union[str, None] = None, auto_refresh_token: bool = True, persist_session: bool = True, storage: SyncSupportedStorage = SyncMemoryStorage(), http_client: Union[SyncClient, None] = None, )", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 6, - "fingerprint": "sha256:228187f1bbb220b2b72a35958163b0686fe1f4901de40f09a3ce691c50b07c4e", - "api": "supabase/python-surface", - "version": "1.0.0", - "previous_version": "0.7.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "supabase", - "change": "removed_parameter", - "symbols": [ - "lib.auth_client.SupabaseAuthClient" - ], - "parameter": "cookie_options" - }, - "description": "`lib.auth_client.SupabaseAuthClient` no longer takes the parameter `cookie_options` in supabase 1.0.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `cookie_options` to `lib.auth_client.SupabaseAuthClient`; its signature in 1.0.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/8d/7b/42e5e27e4c9f4f5e24c0d3294b7448948b97963c69d634c664b7beaaae4b/supabase-1.0.0-py3-none-any.whl", - "source_excerpt": "supabase 0.7.1 (supabase-0.7.1-py3-none-any.whl), supabase/lib/auth_client.py line 13: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, auto_refresh_token: bool = True, persist_session: bool = True, local_storage: SyncSupportedStorage = SyncMemoryStorage(), cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS), api: Optional[SyncGoTrueAPI] = None, replace_default_headers: bool = False, )\nsupabase 1.0.0 (supabase-1.0.0-py3-none-any.whl), supabase/lib/auth_client.py line 14: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, storage_key: Union[str, None] = None, auto_refresh_token: bool = True, persist_session: bool = True, storage: SyncSupportedStorage = SyncMemoryStorage(), http_client: Union[SyncClient, None] = None, )", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 7, - "fingerprint": "sha256:10c88daa7e038d173e0df007fdc97a5e34dced7a99533b8f17c0bc59ecd58cb5", - "api": "supabase/python-surface", - "version": "1.0.0", - "previous_version": "0.7.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "supabase", - "change": "removed_parameter", - "symbols": [ - "lib.auth_client.SupabaseAuthClient" - ], - "parameter": "local_storage" - }, - "description": "`lib.auth_client.SupabaseAuthClient` no longer takes the parameter `local_storage` in supabase 1.0.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `local_storage` to `lib.auth_client.SupabaseAuthClient`; its signature in 1.0.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/8d/7b/42e5e27e4c9f4f5e24c0d3294b7448948b97963c69d634c664b7beaaae4b/supabase-1.0.0-py3-none-any.whl", - "source_excerpt": "supabase 0.7.1 (supabase-0.7.1-py3-none-any.whl), supabase/lib/auth_client.py line 13: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, auto_refresh_token: bool = True, persist_session: bool = True, local_storage: SyncSupportedStorage = SyncMemoryStorage(), cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS), api: Optional[SyncGoTrueAPI] = None, replace_default_headers: bool = False, )\nsupabase 1.0.0 (supabase-1.0.0-py3-none-any.whl), supabase/lib/auth_client.py line 14: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, storage_key: Union[str, None] = None, auto_refresh_token: bool = True, persist_session: bool = True, storage: SyncSupportedStorage = SyncMemoryStorage(), http_client: Union[SyncClient, None] = None, )", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 8, - "fingerprint": "sha256:7a319d5b5a54e628e9bf65802abf4a94e3d1efbd093ba78cd6295b409c84f2e8", - "api": "supabase/python-surface", - "version": "1.0.0", - "previous_version": "0.7.1", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "supabase", - "change": "removed_parameter", - "symbols": [ - "lib.auth_client.SupabaseAuthClient" - ], - "parameter": "replace_default_headers" - }, - "description": "`lib.auth_client.SupabaseAuthClient` no longer takes the parameter `replace_default_headers` in supabase 1.0.0: passing it raises a TypeError.", - "migration_hint": "Stop passing `replace_default_headers` to `lib.auth_client.SupabaseAuthClient`; its signature in 1.0.0 is quoted in the source excerpt.", - "source_url": "https://files.pythonhosted.org/packages/8d/7b/42e5e27e4c9f4f5e24c0d3294b7448948b97963c69d634c664b7beaaae4b/supabase-1.0.0-py3-none-any.whl", - "source_excerpt": "supabase 0.7.1 (supabase-0.7.1-py3-none-any.whl), supabase/lib/auth_client.py line 13: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, auto_refresh_token: bool = True, persist_session: bool = True, local_storage: SyncSupportedStorage = SyncMemoryStorage(), cookie_options: CookieOptions = CookieOptions.parse_obj(COOKIE_OPTIONS), api: Optional[SyncGoTrueAPI] = None, replace_default_headers: bool = False, )\nsupabase 1.0.0 (supabase-1.0.0-py3-none-any.whl), supabase/lib/auth_client.py line 14: class SupabaseAuthClient(SyncGoTrueClient) / def __init__( self, *, url: str, headers: Dict[str, str] = {}, storage_key: Union[str, None] = None, auto_refresh_token: bool = True, persist_session: bool = True, storage: SyncSupportedStorage = SyncMemoryStorage(), http_client: Union[SyncClient, None] = None, )", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 9, "fingerprint": "sha256:2e8f57d805d1e6759157434c063fb8254be8f38523cc17e908d2089e4558c165", "api": "supabase/python-surface", "version": "1.0.0", diff --git a/plugins/apisurface/testdata/golden/urllib3-python-surface.json b/plugins/apisurface/testdata/golden/urllib3-python-surface.json index 4c76901..8c740c1 100644 --- a/plugins/apisurface/testdata/golden/urllib3-python-surface.json +++ b/plugins/apisurface/testdata/golden/urllib3-python-surface.json @@ -1,7 +1,7 @@ [ { "id": 1, - "fingerprint": "sha256:cc42ae4902d0f79373a7474b8b5abcc56314e6c90fcaccd37c7965e5335f572d", + "fingerprint": "sha256:ea8eb6ac566d9a46a8d1aa80c02f818c997ee000bbde7acdc08d8ad214d50197", "api": "urllib3/python-surface", "version": "2.6.0", "previous_version": "2.5.0", @@ -13,7 +13,8 @@ "package": "urllib3", "change": "removed_symbol", "symbols": [ - "BaseHTTPResponse.getheader" + "BaseHTTPResponse.getheader", + "response.BaseHTTPResponse.getheader" ] }, "description": "The method `BaseHTTPResponse.getheader` was removed in urllib3 2.6.0: code using it fails.", @@ -25,7 +26,7 @@ }, { "id": 2, - "fingerprint": "sha256:3375c27db02709e580eba5c9b01b737c31d3c84e130093fca1213a8e967c85ea", + "fingerprint": "sha256:fd6ae1aab499021131a0d09490c503f4b464e2913646bba28f78a1fef8073dc4", "api": "urllib3/python-surface", "version": "2.6.0", "previous_version": "2.5.0", @@ -37,7 +38,8 @@ "package": "urllib3", "change": "removed_symbol", "symbols": [ - "BaseHTTPResponse.getheaders" + "BaseHTTPResponse.getheaders", + "response.BaseHTTPResponse.getheaders" ] }, "description": "The method `BaseHTTPResponse.getheaders` was removed in urllib3 2.6.0: code using it fails.", @@ -46,53 +48,5 @@ "source_excerpt": "urllib3 2.5.0 (urllib3-2.5.0-py3-none-any.whl), urllib3/response.py line 543: def getheaders(self) -> HTTPHeaderDict\nurllib3 2.6.0 (urllib3-2.6.0-py3-none-any.whl): not defined", "confidence": 1, "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 3, - "fingerprint": "sha256:07a511cc9d663a29116e2b7954a24893790ae274398a78caae714e01fe12e7e9", - "api": "urllib3/python-surface", - "version": "2.6.0", - "previous_version": "2.5.0", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "urllib3", - "change": "removed_symbol", - "symbols": [ - "response.BaseHTTPResponse.getheader" - ] - }, - "description": "The method `response.BaseHTTPResponse.getheader` was removed in urllib3 2.6.0: code using it fails.", - "migration_hint": "urllib3 2.6.0 has no `response.BaseHTTPResponse.getheader`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/56/1a/9ffe814d317c5224166b23e7c47f606d6e473712a2fad0f704ea9b99f246/urllib3-2.6.0-py3-none-any.whl", - "source_excerpt": "urllib3 2.5.0 (urllib3-2.5.0-py3-none-any.whl), urllib3/response.py line 552: def getheader(self, name: str, default: str | None = None) -> str | None\nurllib3 2.6.0 (urllib3-2.6.0-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" - }, - { - "id": 4, - "fingerprint": "sha256:9a5a800867633a61c978cc30e6702c35ad978c197161eecb29d8735fd67b74d4", - "api": "urllib3/python-surface", - "version": "2.6.0", - "previous_version": "2.5.0", - "change_type": "breaking", - "breaking": true, - "subject": { - "type": "package_release", - "ecosystem": "pypi", - "package": "urllib3", - "change": "removed_symbol", - "symbols": [ - "response.BaseHTTPResponse.getheaders" - ] - }, - "description": "The method `response.BaseHTTPResponse.getheaders` was removed in urllib3 2.6.0: code using it fails.", - "migration_hint": "urllib3 2.6.0 has no `response.BaseHTTPResponse.getheaders`: see the package's release notes for what replaces it.", - "source_url": "https://files.pythonhosted.org/packages/56/1a/9ffe814d317c5224166b23e7c47f606d6e473712a2fad0f704ea9b99f246/urllib3-2.6.0-py3-none-any.whl", - "source_excerpt": "urllib3 2.5.0 (urllib3-2.5.0-py3-none-any.whl), urllib3/response.py line 543: def getheaders(self) -> HTTPHeaderDict\nurllib3 2.6.0 (urllib3-2.6.0-py3-none-any.whl): not defined", - "confidence": 1, - "detected_at": "2026-11-14T12:00:00Z" } ] diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.6.0.json b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.6.0.json new file mode 100644 index 0000000..6415996 --- /dev/null +++ b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.6.0.json @@ -0,0 +1,7 @@ +{ + "name": "@anthropic-ai/sdk", + "version": "1.6.0", + "dist": { + "tarball": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.6.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.7.0.json b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.7.0.json new file mode 100644 index 0000000..bf4da0e --- /dev/null +++ b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.7.0.json @@ -0,0 +1,7 @@ +{ + "name": "@anthropic-ai/sdk", + "version": "1.7.0", + "dist": { + "tarball": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.7.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.8.0.json b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.8.0.json new file mode 100644 index 0000000..290841d --- /dev/null +++ b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-1.8.0.json @@ -0,0 +1,7 @@ +{ + "name": "@anthropic-ai/sdk", + "version": "1.8.0", + "dist": { + "tarball": "https://registry.npmjs.org/@anthropic-ai/sdk/-/sdk-1.8.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-excerpt.json b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-excerpt.json new file mode 100644 index 0000000..900916d --- /dev/null +++ b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/npm-anthropic-ai-sdk-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "@anthropic-ai/sdk", + "versions": { + "1.6.0": { + "name": "@anthropic-ai/sdk", + "version": "1.6.0" + }, + "1.7.0": { + "name": "@anthropic-ai/sdk", + "version": "1.7.0" + }, + "1.8.0": { + "name": "@anthropic-ai/sdk", + "version": "1.8.0" + } + }, + "time": { + "1.6.0": "2026-11-05T19:05:25.552Z", + "1.7.0": "2026-11-09T18:56:57.201Z", + "1.8.0": "2026-11-10T16:38:44.845Z" + } +} diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.6.0.trimmed.tgz b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.6.0.trimmed.tgz new file mode 100644 index 0000000..73460be Binary files /dev/null and b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.6.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.7.0.trimmed.tgz b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.7.0.trimmed.tgz new file mode 100644 index 0000000..86d28fe Binary files /dev/null and b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.7.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.8.0.trimmed.tgz b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.8.0.trimmed.tgz new file mode 100644 index 0000000..34051be Binary files /dev/null and b/plugins/apisurface/testdata/npm/anthropic-ai-sdk/sdk-1.8.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/convex/convex-1.35.0.trimmed.tgz b/plugins/apisurface/testdata/npm/convex/convex-1.35.0.trimmed.tgz new file mode 100644 index 0000000..beaeb48 Binary files /dev/null and b/plugins/apisurface/testdata/npm/convex/convex-1.35.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/convex/convex-1.35.1.trimmed.tgz b/plugins/apisurface/testdata/npm/convex/convex-1.35.1.trimmed.tgz new file mode 100644 index 0000000..4ee782f Binary files /dev/null and b/plugins/apisurface/testdata/npm/convex/convex-1.35.1.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/convex/convex-1.42.2.trimmed.tgz b/plugins/apisurface/testdata/npm/convex/convex-1.42.2.trimmed.tgz new file mode 100644 index 0000000..64d10a4 Binary files /dev/null and b/plugins/apisurface/testdata/npm/convex/convex-1.42.2.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/convex/convex-1.42.3.trimmed.tgz b/plugins/apisurface/testdata/npm/convex/convex-1.42.3.trimmed.tgz new file mode 100644 index 0000000..d633321 Binary files /dev/null and b/plugins/apisurface/testdata/npm/convex/convex-1.42.3.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.0.json b/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.0.json new file mode 100644 index 0000000..8431c06 --- /dev/null +++ b/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.0.json @@ -0,0 +1,7 @@ +{ + "name": "convex", + "version": "1.35.0", + "dist": { + "tarball": "https://registry.npmjs.org/convex/-/convex-1.35.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.1.json b/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.1.json new file mode 100644 index 0000000..7cc40e8 --- /dev/null +++ b/plugins/apisurface/testdata/npm/convex/npm-convex-1.35.1.json @@ -0,0 +1,7 @@ +{ + "name": "convex", + "version": "1.35.1", + "dist": { + "tarball": "https://registry.npmjs.org/convex/-/convex-1.35.1.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.2.json b/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.2.json new file mode 100644 index 0000000..9242bf3 --- /dev/null +++ b/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.2.json @@ -0,0 +1,7 @@ +{ + "name": "convex", + "version": "1.42.2", + "dist": { + "tarball": "https://registry.npmjs.org/convex/-/convex-1.42.2.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.3.json b/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.3.json new file mode 100644 index 0000000..f3882f0 --- /dev/null +++ b/plugins/apisurface/testdata/npm/convex/npm-convex-1.42.3.json @@ -0,0 +1,7 @@ +{ + "name": "convex", + "version": "1.42.3", + "dist": { + "tarball": "https://registry.npmjs.org/convex/-/convex-1.42.3.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/convex/npm-convex-excerpt.json b/plugins/apisurface/testdata/npm/convex/npm-convex-excerpt.json new file mode 100644 index 0000000..c7d6c64 --- /dev/null +++ b/plugins/apisurface/testdata/npm/convex/npm-convex-excerpt.json @@ -0,0 +1,27 @@ +{ + "name": "convex", + "versions": { + "1.35.0": { + "name": "convex", + "version": "1.35.0" + }, + "1.35.1": { + "name": "convex", + "version": "1.35.1" + }, + "1.42.2": { + "name": "convex", + "version": "1.42.2" + }, + "1.42.3": { + "name": "convex", + "version": "1.42.3" + } + }, + "time": { + "1.35.0": "2026-04-10T01:57:42.163Z", + "1.35.1": "2026-04-10T02:32:03.998Z", + "1.42.2": "2026-07-14T21:00:33.146Z", + "1.42.3": "2026-07-16T22:27:31.972Z" + } +} diff --git a/plugins/apisurface/testdata/npm/google-genai/genai-0.15.0.trimmed.tgz b/plugins/apisurface/testdata/npm/google-genai/genai-0.15.0.trimmed.tgz new file mode 100644 index 0000000..6c0271a Binary files /dev/null and b/plugins/apisurface/testdata/npm/google-genai/genai-0.15.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/google-genai/genai-1.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/google-genai/genai-1.0.0.trimmed.tgz new file mode 100644 index 0000000..9dfde6f Binary files /dev/null and b/plugins/apisurface/testdata/npm/google-genai/genai-1.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/google-genai/genai-1.1.0.trimmed.tgz b/plugins/apisurface/testdata/npm/google-genai/genai-1.1.0.trimmed.tgz new file mode 100644 index 0000000..263e71f Binary files /dev/null and b/plugins/apisurface/testdata/npm/google-genai/genai-1.1.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-0.15.0.json b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-0.15.0.json new file mode 100644 index 0000000..82b6cc3 --- /dev/null +++ b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-0.15.0.json @@ -0,0 +1,7 @@ +{ + "name": "@google/genai", + "version": "0.15.0", + "dist": { + "tarball": "https://registry.npmjs.org/@google/genai/-/genai-0.15.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.0.0.json b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.0.0.json new file mode 100644 index 0000000..b0dc773 --- /dev/null +++ b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "@google/genai", + "version": "1.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/@google/genai/-/genai-1.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.1.0.json b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.1.0.json new file mode 100644 index 0000000..f9e2ce7 --- /dev/null +++ b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-1.1.0.json @@ -0,0 +1,7 @@ +{ + "name": "@google/genai", + "version": "1.1.0", + "dist": { + "tarball": "https://registry.npmjs.org/@google/genai/-/genai-1.1.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-excerpt.json b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-excerpt.json new file mode 100644 index 0000000..95a767e --- /dev/null +++ b/plugins/apisurface/testdata/npm/google-genai/npm-google-genai-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "@google/genai", + "versions": { + "0.15.0": { + "name": "@google/genai", + "version": "0.15.0" + }, + "1.0.0": { + "name": "@google/genai", + "version": "1.0.0" + }, + "1.1.0": { + "name": "@google/genai", + "version": "1.1.0" + } + }, + "time": { + "0.15.0": "2025-05-19T05:27:40.241Z", + "1.0.0": "2025-05-19T22:26:30.471Z", + "1.1.0": "2025-05-26T21:36:07.350Z" + } +} diff --git a/plugins/apisurface/testdata/npm/mongodb/mongodb-6.22.0.trimmed.tgz b/plugins/apisurface/testdata/npm/mongodb/mongodb-6.22.0.trimmed.tgz new file mode 100644 index 0000000..83ead80 Binary files /dev/null and b/plugins/apisurface/testdata/npm/mongodb/mongodb-6.22.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/mongodb/mongodb-7.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/mongodb/mongodb-7.0.0.trimmed.tgz new file mode 100644 index 0000000..4d6c691 Binary files /dev/null and b/plugins/apisurface/testdata/npm/mongodb/mongodb-7.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/mongodb/mongodb-7.1.0.trimmed.tgz b/plugins/apisurface/testdata/npm/mongodb/mongodb-7.1.0.trimmed.tgz new file mode 100644 index 0000000..c200732 Binary files /dev/null and b/plugins/apisurface/testdata/npm/mongodb/mongodb-7.1.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-6.22.0.json b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-6.22.0.json new file mode 100644 index 0000000..1f2e901 --- /dev/null +++ b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-6.22.0.json @@ -0,0 +1,7 @@ +{ + "name": "mongodb", + "version": "6.22.0", + "dist": { + "tarball": "https://registry.npmjs.org/mongodb/-/mongodb-6.22.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.0.0.json b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.0.0.json new file mode 100644 index 0000000..8a20ebe --- /dev/null +++ b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "mongodb", + "version": "7.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/mongodb/-/mongodb-7.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.1.0.json b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.1.0.json new file mode 100644 index 0000000..1c361da --- /dev/null +++ b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-7.1.0.json @@ -0,0 +1,7 @@ +{ + "name": "mongodb", + "version": "7.1.0", + "dist": { + "tarball": "https://registry.npmjs.org/mongodb/-/mongodb-7.1.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-excerpt.json b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-excerpt.json new file mode 100644 index 0000000..9181fcb --- /dev/null +++ b/plugins/apisurface/testdata/npm/mongodb/npm-mongodb-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "mongodb", + "versions": { + "6.22.0": { + "name": "mongodb", + "version": "6.22.0" + }, + "7.0.0": { + "name": "mongodb", + "version": "7.0.0" + }, + "7.1.0": { + "name": "mongodb", + "version": "7.1.0" + } + }, + "time": { + "6.22.0": "2026-11-03T00:13:02.364Z", + "7.0.0": "2025-11-06T13:49:59.961Z", + "7.1.0": "2026-02-04T01:35:24.464Z" + } +} diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-0.10.4.json b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-0.10.4.json new file mode 100644 index 0000000..7fb2f06 --- /dev/null +++ b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-0.10.4.json @@ -0,0 +1,7 @@ +{ + "name": "@neondatabase/serverless", + "version": "0.10.4", + "dist": { + "tarball": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-0.10.4.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.0.json b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.0.json new file mode 100644 index 0000000..96faf24 --- /dev/null +++ b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "@neondatabase/serverless", + "version": "1.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.1.json b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.1.json new file mode 100644 index 0000000..a6831e9 --- /dev/null +++ b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-1.0.1.json @@ -0,0 +1,7 @@ +{ + "name": "@neondatabase/serverless", + "version": "1.0.1", + "dist": { + "tarball": "https://registry.npmjs.org/@neondatabase/serverless/-/serverless-1.0.1.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-excerpt.json b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-excerpt.json new file mode 100644 index 0000000..4e635a6 --- /dev/null +++ b/plugins/apisurface/testdata/npm/neondatabase-serverless/npm-neondatabase-serverless-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "@neondatabase/serverless", + "versions": { + "0.10.4": { + "name": "@neondatabase/serverless", + "version": "0.10.4" + }, + "1.0.0": { + "name": "@neondatabase/serverless", + "version": "1.0.0" + }, + "1.0.1": { + "name": "@neondatabase/serverless", + "version": "1.0.1" + } + }, + "time": { + "0.10.4": "2024-11-25T12:56:54.358Z", + "1.0.0": "2025-03-25T10:06:46.324Z", + "1.0.1": "2025-06-06T13:09:20.406Z" + } +} diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-0.10.4.trimmed.tgz b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-0.10.4.trimmed.tgz new file mode 100644 index 0000000..6aa1d7f Binary files /dev/null and b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-0.10.4.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.0.trimmed.tgz new file mode 100644 index 0000000..93d3392 Binary files /dev/null and b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.1.trimmed.tgz b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.1.trimmed.tgz new file mode 100644 index 0000000..d341d7e Binary files /dev/null and b/plugins/apisurface/testdata/npm/neondatabase-serverless/serverless-1.0.1.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/openai/npm-openai-7.59.0.json b/plugins/apisurface/testdata/npm/openai/npm-openai-7.59.0.json new file mode 100644 index 0000000..4debbb4 --- /dev/null +++ b/plugins/apisurface/testdata/npm/openai/npm-openai-7.59.0.json @@ -0,0 +1,7 @@ +{ + "name": "openai", + "version": "7.59.0", + "dist": { + "tarball": "https://registry.npmjs.org/openai/-/openai-7.59.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/openai/npm-openai-7.60.0.json b/plugins/apisurface/testdata/npm/openai/npm-openai-7.60.0.json new file mode 100644 index 0000000..d66a4f8 --- /dev/null +++ b/plugins/apisurface/testdata/npm/openai/npm-openai-7.60.0.json @@ -0,0 +1,7 @@ +{ + "name": "openai", + "version": "7.60.0", + "dist": { + "tarball": "https://registry.npmjs.org/openai/-/openai-7.60.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/openai/npm-openai-7.61.0.json b/plugins/apisurface/testdata/npm/openai/npm-openai-7.61.0.json new file mode 100644 index 0000000..aabd9ba --- /dev/null +++ b/plugins/apisurface/testdata/npm/openai/npm-openai-7.61.0.json @@ -0,0 +1,7 @@ +{ + "name": "openai", + "version": "7.61.0", + "dist": { + "tarball": "https://registry.npmjs.org/openai/-/openai-7.61.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/openai/npm-openai-excerpt.json b/plugins/apisurface/testdata/npm/openai/npm-openai-excerpt.json new file mode 100644 index 0000000..22552ec --- /dev/null +++ b/plugins/apisurface/testdata/npm/openai/npm-openai-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "openai", + "versions": { + "7.59.0": { + "name": "openai", + "version": "7.59.0" + }, + "7.60.0": { + "name": "openai", + "version": "7.60.0" + }, + "7.61.0": { + "name": "openai", + "version": "7.61.0" + } + }, + "time": { + "7.59.0": "2026-11-17T22:54:03.929Z", + "7.60.0": "2026-11-18T16:16:53.912Z", + "7.61.0": "2026-11-19T21:07:25.454Z" + } +} diff --git a/plugins/apisurface/testdata/npm/openai/openai-7.59.0.trimmed.tgz b/plugins/apisurface/testdata/npm/openai/openai-7.59.0.trimmed.tgz new file mode 100644 index 0000000..1e51204 Binary files /dev/null and b/plugins/apisurface/testdata/npm/openai/openai-7.59.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/openai/openai-7.60.0.trimmed.tgz b/plugins/apisurface/testdata/npm/openai/openai-7.60.0.trimmed.tgz new file mode 100644 index 0000000..179a2cb Binary files /dev/null and b/plugins/apisurface/testdata/npm/openai/openai-7.60.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/openai/openai-7.61.0.trimmed.tgz b/plugins/apisurface/testdata/npm/openai/openai-7.61.0.trimmed.tgz new file mode 100644 index 0000000..6a9c86e Binary files /dev/null and b/plugins/apisurface/testdata/npm/openai/openai-7.61.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/redis-client/client-1.6.1.trimmed.tgz b/plugins/apisurface/testdata/npm/redis-client/client-1.6.1.trimmed.tgz new file mode 100644 index 0000000..737dcae Binary files /dev/null and b/plugins/apisurface/testdata/npm/redis-client/client-1.6.1.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/redis-client/client-5.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/redis-client/client-5.0.0.trimmed.tgz new file mode 100644 index 0000000..7da4c00 Binary files /dev/null and b/plugins/apisurface/testdata/npm/redis-client/client-5.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/redis-client/client-6.3.0.trimmed.tgz b/plugins/apisurface/testdata/npm/redis-client/client-6.3.0.trimmed.tgz new file mode 100644 index 0000000..1ba08b1 Binary files /dev/null and b/plugins/apisurface/testdata/npm/redis-client/client-6.3.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/redis-client/client-6.3.1.trimmed.tgz b/plugins/apisurface/testdata/npm/redis-client/client-6.3.1.trimmed.tgz new file mode 100644 index 0000000..a385038 Binary files /dev/null and b/plugins/apisurface/testdata/npm/redis-client/client-6.3.1.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-1.6.1.json b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-1.6.1.json new file mode 100644 index 0000000..f26b666 --- /dev/null +++ b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-1.6.1.json @@ -0,0 +1,7 @@ +{ + "name": "@redis/client", + "version": "1.6.1", + "dist": { + "tarball": "https://registry.npmjs.org/@redis/client/-/client-1.6.1.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-5.0.0.json b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-5.0.0.json new file mode 100644 index 0000000..7f9a8bd --- /dev/null +++ b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-5.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "@redis/client", + "version": "5.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/@redis/client/-/client-5.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.0.json b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.0.json new file mode 100644 index 0000000..42637a2 --- /dev/null +++ b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.0.json @@ -0,0 +1,7 @@ +{ + "name": "@redis/client", + "version": "6.3.0", + "dist": { + "tarball": "https://registry.npmjs.org/@redis/client/-/client-6.3.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.1.json b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.1.json new file mode 100644 index 0000000..b389ffa --- /dev/null +++ b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-6.3.1.json @@ -0,0 +1,7 @@ +{ + "name": "@redis/client", + "version": "6.3.1", + "dist": { + "tarball": "https://registry.npmjs.org/@redis/client/-/client-6.3.1.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-excerpt.json b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-excerpt.json new file mode 100644 index 0000000..9e30a46 --- /dev/null +++ b/plugins/apisurface/testdata/npm/redis-client/npm-redis-client-excerpt.json @@ -0,0 +1,27 @@ +{ + "name": "@redis/client", + "versions": { + "1.6.1": { + "name": "@redis/client", + "version": "1.6.1" + }, + "5.0.0": { + "name": "@redis/client", + "version": "5.0.0" + }, + "6.3.0": { + "name": "@redis/client", + "version": "6.3.0" + }, + "6.3.1": { + "name": "@redis/client", + "version": "6.3.1" + } + }, + "time": { + "1.6.1": "2025-05-08T08:09:55.915Z", + "5.0.0": "2025-04-30T13:56:44.813Z", + "6.3.0": "2026-09-30T11:01:08.526Z", + "6.3.1": "2026-10-29T09:19:20.158Z" + } +} diff --git a/plugins/apisurface/testdata/npm/sentry-node/node-10.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/sentry-node/node-10.0.0.trimmed.tgz new file mode 100644 index 0000000..ac8f55e Binary files /dev/null and b/plugins/apisurface/testdata/npm/sentry-node/node-10.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/sentry-node/node-11.12.0.trimmed.tgz b/plugins/apisurface/testdata/npm/sentry-node/node-11.12.0.trimmed.tgz new file mode 100644 index 0000000..d6db16a Binary files /dev/null and b/plugins/apisurface/testdata/npm/sentry-node/node-11.12.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/sentry-node/node-11.13.0.trimmed.tgz b/plugins/apisurface/testdata/npm/sentry-node/node-11.13.0.trimmed.tgz new file mode 100644 index 0000000..a54f12a Binary files /dev/null and b/plugins/apisurface/testdata/npm/sentry-node/node-11.13.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/sentry-node/node-9.47.2.trimmed.tgz b/plugins/apisurface/testdata/npm/sentry-node/node-9.47.2.trimmed.tgz new file mode 100644 index 0000000..4920e10 Binary files /dev/null and b/plugins/apisurface/testdata/npm/sentry-node/node-9.47.2.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-10.0.0.json b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-10.0.0.json new file mode 100644 index 0000000..96145ec --- /dev/null +++ b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-10.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "@sentry/node", + "version": "10.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/@sentry/node/-/node-10.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.12.0.json b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.12.0.json new file mode 100644 index 0000000..75fa03e --- /dev/null +++ b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.12.0.json @@ -0,0 +1,7 @@ +{ + "name": "@sentry/node", + "version": "11.12.0", + "dist": { + "tarball": "https://registry.npmjs.org/@sentry/node/-/node-11.12.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.13.0.json b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.13.0.json new file mode 100644 index 0000000..941d8a6 --- /dev/null +++ b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-11.13.0.json @@ -0,0 +1,7 @@ +{ + "name": "@sentry/node", + "version": "11.13.0", + "dist": { + "tarball": "https://registry.npmjs.org/@sentry/node/-/node-11.13.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-9.47.2.json b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-9.47.2.json new file mode 100644 index 0000000..4ec285b --- /dev/null +++ b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-9.47.2.json @@ -0,0 +1,7 @@ +{ + "name": "@sentry/node", + "version": "9.47.2", + "dist": { + "tarball": "https://registry.npmjs.org/@sentry/node/-/node-9.47.2.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-excerpt.json b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-excerpt.json new file mode 100644 index 0000000..8c6e547 --- /dev/null +++ b/plugins/apisurface/testdata/npm/sentry-node/npm-sentry-node-excerpt.json @@ -0,0 +1,27 @@ +{ + "name": "@sentry/node", + "versions": { + "9.47.2": { + "name": "@sentry/node", + "version": "9.47.2" + }, + "10.0.0": { + "name": "@sentry/node", + "version": "10.0.0" + }, + "11.12.0": { + "name": "@sentry/node", + "version": "11.12.0" + }, + "11.13.0": { + "name": "@sentry/node", + "version": "11.13.0" + } + }, + "time": { + "9.47.2": "2026-09-29T08:52:58.567Z", + "10.0.0": "2025-07-31T15:31:10.258Z", + "11.12.0": "2026-11-10T16:02:02.625Z", + "11.13.0": "2026-11-16T16:28:35.102Z" + } +} diff --git a/plugins/apisurface/testdata/npm/stripe/npm-stripe-22.6.2.json b/plugins/apisurface/testdata/npm/stripe/npm-stripe-22.6.2.json new file mode 100644 index 0000000..7215175 --- /dev/null +++ b/plugins/apisurface/testdata/npm/stripe/npm-stripe-22.6.2.json @@ -0,0 +1,7 @@ +{ + "name": "stripe", + "version": "22.6.2", + "dist": { + "tarball": "https://registry.npmjs.org/stripe/-/stripe-22.6.2.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.0.json b/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.0.json new file mode 100644 index 0000000..8783ce2 --- /dev/null +++ b/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "stripe", + "version": "23.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/stripe/-/stripe-23.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.1.json b/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.1.json new file mode 100644 index 0000000..3e6b96d --- /dev/null +++ b/plugins/apisurface/testdata/npm/stripe/npm-stripe-23.0.1.json @@ -0,0 +1,7 @@ +{ + "name": "stripe", + "version": "23.0.1", + "dist": { + "tarball": "https://registry.npmjs.org/stripe/-/stripe-23.0.1.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/stripe/npm-stripe-excerpt.json b/plugins/apisurface/testdata/npm/stripe/npm-stripe-excerpt.json new file mode 100644 index 0000000..4599d63 --- /dev/null +++ b/plugins/apisurface/testdata/npm/stripe/npm-stripe-excerpt.json @@ -0,0 +1,22 @@ +{ + "name": "stripe", + "versions": { + "22.6.2": { + "name": "stripe", + "version": "22.6.2" + }, + "23.0.0": { + "name": "stripe", + "version": "23.0.0" + }, + "23.0.1": { + "name": "stripe", + "version": "23.0.1" + } + }, + "time": { + "22.6.2": "2026-09-09T21:17:22.085Z", + "23.0.0": "2026-10-01T00:52:07.438Z", + "23.0.1": "2026-10-22T17:47:58.267Z" + } +} diff --git a/plugins/apisurface/testdata/npm/stripe/stripe-22.6.2.trimmed.tgz b/plugins/apisurface/testdata/npm/stripe/stripe-22.6.2.trimmed.tgz new file mode 100644 index 0000000..4b94c29 Binary files /dev/null and b/plugins/apisurface/testdata/npm/stripe/stripe-22.6.2.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/stripe/stripe-23.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/stripe/stripe-23.0.0.trimmed.tgz new file mode 100644 index 0000000..6e765b7 Binary files /dev/null and b/plugins/apisurface/testdata/npm/stripe/stripe-23.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/stripe/stripe-23.0.1.trimmed.tgz b/plugins/apisurface/testdata/npm/stripe/stripe-23.0.1.trimmed.tgz new file mode 100644 index 0000000..42f987a Binary files /dev/null and b/plugins/apisurface/testdata/npm/stripe/stripe-23.0.1.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-1.35.7.json b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-1.35.7.json new file mode 100644 index 0000000..a99f300 --- /dev/null +++ b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-1.35.7.json @@ -0,0 +1,7 @@ +{ + "name": "@supabase/supabase-js", + "version": "1.35.7", + "dist": { + "tarball": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-1.35.7.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.0.0.json b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.0.0.json new file mode 100644 index 0000000..293c0e3 --- /dev/null +++ b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.0.0.json @@ -0,0 +1,7 @@ +{ + "name": "@supabase/supabase-js", + "version": "2.0.0", + "dist": { + "tarball": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.0.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.118.0.json b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.118.0.json new file mode 100644 index 0000000..7fd965a --- /dev/null +++ b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.118.0.json @@ -0,0 +1,7 @@ +{ + "name": "@supabase/supabase-js", + "version": "2.118.0", + "dist": { + "tarball": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.118.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.119.0.json b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.119.0.json new file mode 100644 index 0000000..cf4333d --- /dev/null +++ b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-2.119.0.json @@ -0,0 +1,7 @@ +{ + "name": "@supabase/supabase-js", + "version": "2.119.0", + "dist": { + "tarball": "https://registry.npmjs.org/@supabase/supabase-js/-/supabase-js-2.119.0.tgz" + } +} diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-excerpt.json b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-excerpt.json new file mode 100644 index 0000000..80951cf --- /dev/null +++ b/plugins/apisurface/testdata/npm/supabase-supabase-js/npm-supabase-supabase-js-excerpt.json @@ -0,0 +1,27 @@ +{ + "name": "@supabase/supabase-js", + "versions": { + "1.35.7": { + "name": "@supabase/supabase-js", + "version": "1.35.7" + }, + "2.0.0": { + "name": "@supabase/supabase-js", + "version": "2.0.0" + }, + "2.118.0": { + "name": "@supabase/supabase-js", + "version": "2.118.0" + }, + "2.119.0": { + "name": "@supabase/supabase-js", + "version": "2.119.0" + } + }, + "time": { + "1.35.7": "2022-09-21T21:20:23.331Z", + "2.0.0": "2022-10-11T11:43:47.776Z", + "2.118.0": "2026-10-15T12:57:17.683Z", + "2.119.0": "2026-11-04T13:11:11.636Z" + } +} diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-1.35.7.trimmed.tgz b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-1.35.7.trimmed.tgz new file mode 100644 index 0000000..1ffa87d Binary files /dev/null and b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-1.35.7.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.0.0.trimmed.tgz b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.0.0.trimmed.tgz new file mode 100644 index 0000000..dd22aac Binary files /dev/null and b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.0.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.118.0.trimmed.tgz b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.118.0.trimmed.tgz new file mode 100644 index 0000000..94a9db4 Binary files /dev/null and b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.118.0.trimmed.tgz differ diff --git a/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.119.0.trimmed.tgz b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.119.0.trimmed.tgz new file mode 100644 index 0000000..854821a Binary files /dev/null and b/plugins/apisurface/testdata/npm/supabase-supabase-js/supabase-js-2.119.0.trimmed.tgz differ diff --git a/plugins/openapi/adapter/openai.go b/plugins/openapi/adapter/openai.go index 0c42511..05e14c5 100644 --- a/plugins/openapi/adapter/openai.go +++ b/plugins/openapi/adapter/openai.go @@ -88,7 +88,10 @@ func (OpenAI) Fetch(ctx context.Context, sha string) (Spec, error) { // SourcePointer: see BasePathPointer. func (OpenAI) SourcePointer(content []byte) func(string) string { return BasePathPointer(content) } -var _ Reshaper = OpenAI{} +var ( + _ Reshaper = OpenAI{} + _ Lister = OpenAI{} +) // YAMLToJSON converts a YAML spec to JSON: diff.Parse reads JSON only, and // normalize quotes the node it cites re-serialized, never the original bytes, diff --git a/plugins/openapi/adapter/versions.go b/plugins/openapi/adapter/versions.go index 35d6c18..a85fa41 100644 --- a/plugins/openapi/adapter/versions.go +++ b/plugins/openapi/adapter/versions.go @@ -290,5 +290,3 @@ func Daily(vs []plugin.Version) []plugin.Version { } return out } - -var _ Lister = OpenAI{} diff --git a/providers/anthropic-typescript-surface.md b/providers/anthropic-typescript-surface.md new file mode 100644 index 0000000..a4272c7 --- /dev/null +++ b/providers/anthropic-typescript-surface.md @@ -0,0 +1,37 @@ +# Anthropic TypeScript SDK (`anthropic/typescript-surface`) + +## What it watches + +The public API of the `@anthropic-ai/sdk` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @anthropic-ai/sdk@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md (commit titles); the migration guide (majors only). +- **Quote:** `class BetaBillingFrozenError extends PermissionDeniedError` (`resources/beta/organization/organization.d.mts` line 45) at 1.6.0, gone at 1.7.0. + +## How the provider announces changes + +- Generated from Anthropic's API definition and released every week or two; beta types come and go with the betas. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@anthropic-ai/sdk/resources/messages.Messages.create`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- The client re-exports every resource through its namespaces, so one removed class has many paths (16 for `BetaBillingFrozenError`), all in one event. diff --git a/providers/convex-js-surface.md b/providers/convex-js-surface.md new file mode 100644 index 0000000..bc3d93b --- /dev/null +++ b/providers/convex-js-surface.md @@ -0,0 +1,36 @@ +# Convex JavaScript client (`convex/js-surface`) + +## What it watches + +The public API of the `convex` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install convex@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md. +- **Quote:** `type QueryOptions>` (`dist/esm-types/browser/query_options.d.ts` line 9) at 1.35.0, gone at 1.35.1. + +## How the provider announces changes + +- Has many entry points (`convex/browser`, `convex/react`, `convex/server`, …), released every week or two. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `convex/react.useQuery`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). diff --git a/providers/google-genai-js-surface.md b/providers/google-genai-js-surface.md new file mode 100644 index 0000000..93d06e0 --- /dev/null +++ b/providers/google-genai-js-surface.md @@ -0,0 +1,37 @@ +# Google Gen AI JavaScript SDK (`google/genai-js-surface`) + +## What it watches + +The public API of the `@google/genai` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @google/genai@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md (release-please, "⚠ BREAKING CHANGES"). +- **Quote:** `interface LiveMusicSetClientContentParameters` (`dist/genai.d.ts` line 3757) at 0.15.0, gone at 1.0.0. + +## How the provider announces changes + +- Ships every week or two as one bundled declaration file per platform (`dist/genai.d.ts`, `dist/node/node.d.ts`, `dist/web/web.d.ts`). +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@google/genai.GoogleGenAI`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- The node and web entry points are separate bundles: a removal there is one event per bundle. diff --git a/providers/mongodb-node-surface.md b/providers/mongodb-node-surface.md new file mode 100644 index 0000000..c44b234 --- /dev/null +++ b/providers/mongodb-node-surface.md @@ -0,0 +1,36 @@ +# MongoDB Node.js driver (`mongodb/node-surface`) + +## What it watches + +The public API of the `mongodb` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install mongodb@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** HISTORY.md; the upgrade guides (majors only). +- **Quote:** `interface AsyncDisposable_2` (exported as `AsyncDisposable`, `mongodb.d.ts` line 613) at 6.22.0, gone at 7.0.0. + +## How the provider announces changes + +- The driver ships one declaration file (`mongodb.d.ts`, an API Extractor rollup); majors remove what the previous one deprecated. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `mongodb.MongoClient.connect`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). diff --git a/providers/neon-serverless-surface.md b/providers/neon-serverless-surface.md new file mode 100644 index 0000000..acccd1c --- /dev/null +++ b/providers/neon-serverless-surface.md @@ -0,0 +1,37 @@ +# Neon serverless driver (`neon/serverless-surface`) + +## What it watches + +The public API of the `@neondatabase/serverless` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @neondatabase/serverless@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md. +- **Quote:** `export { native } from "pg"` (`index.d.mts` line 8) at 0.10.4, gone at 1.0.0. + +## How the provider announces changes + +- The driver is one declaration file per module format; its `Pool` and `Client` extend `pg`'s, whose members aren't read. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@neondatabase/serverless.neon`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- Members inherited from `pg` aren't read: a method gone from `Pool` is a note (pg may define it). diff --git a/providers/openai-node-surface.md b/providers/openai-node-surface.md new file mode 100644 index 0000000..67e5aa1 --- /dev/null +++ b/providers/openai-node-surface.md @@ -0,0 +1,36 @@ +# OpenAI Node.js SDK (`openai/node-surface`) + +## What it watches + +The public API of the `openai` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install openai@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** the repo's CHANGELOG.md (commit titles); the API spec (`openai/api`: the HTTP API). +- **Quote:** `interface AgentSessionBudgetReachedEvent` (`resources/beta/agents/agents.d.mts` line 1188) at 7.59.0, gone at 7.60.0. + +## How the provider announces changes + +- Generated from the same spec as the Python SDK and released several times a week; types follow the API, so a pulled preview feature removes its types in a minor. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `openai/resources/chat/completions.Completions.create`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). diff --git a/providers/redis-node-redis-surface.md b/providers/redis-node-redis-surface.md new file mode 100644 index 0000000..ce57289 --- /dev/null +++ b/providers/redis-node-redis-surface.md @@ -0,0 +1,37 @@ +# node-redis client (`redis/node-redis-surface`) + +## What it watches + +The public API of the `@redis/client` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @redis/client@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** GitHub release notes; `docs/v4-to-v5.md` (majors only). +- **Quote:** `enum RedisFlushModes` (`dist/lib/commands/FLUSHALL.d.ts` line 1) at 1.6.1, gone at 5.0.0 (the client went from 1.x to 5.0.0 with redis 5). + +## How the provider announces changes + +- `redis` on npm re-exports `@redis/client` (and the module packages) wholesale; the client's declarations are where its API is, so this source reads `@redis/client` and covers `npm:redis` too. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@redis/client.createClient`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- `@redis/client`'s versions follow its own numbering; a lockfile's `redis` version maps to the client version it depends on. diff --git a/providers/sentry-node-surface.md b/providers/sentry-node-surface.md new file mode 100644 index 0000000..b9e6e8b --- /dev/null +++ b/providers/sentry-node-surface.md @@ -0,0 +1,37 @@ +# Sentry Node.js SDK (`sentry/node-surface`) + +## What it watches + +The public API of the `@sentry/node` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @sentry/node@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md; MIGRATION.md (majors only). +- **Quote:** `export { systemErrorIntegration } from "@sentry/node-core"` (`build/types/index.d.ts` line 35) at 9.47.2, gone at 10.0.0. + +## How the provider announces changes + +- Releases every week or two; most of what it exports is re-exported from `@sentry/core` and `@sentry/node-core`, read here by name. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@sentry/node.init`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- Names re-exported from `@sentry/core` are read by name: their signatures are that package's. diff --git a/providers/stripe-node-surface.md b/providers/stripe-node-surface.md new file mode 100644 index 0000000..e231f2d --- /dev/null +++ b/providers/stripe-node-surface.md @@ -0,0 +1,37 @@ +# Stripe Node.js SDK (`stripe/node-surface`) + +## What it watches + +The public API of the `stripe` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install stripe@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md ("⚠️" on breaking bullets); the API spec (`stripe/api`). +- **Quote:** `namespace ErrorType` (`esm/stripe.esm.node.d.ts` line 482) at 22.6.2, gone at 23.0.0. + +## How the provider announces changes + +- Each major pins a new Stripe API version and removes what that version removed. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `stripe.Stripe.constructEventWithoutVerification`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- The `Stripe` namespace's thousands of resource types are types inside a namespace: not read (the API spec covers the fields). diff --git a/providers/supabase-js-surface.md b/providers/supabase-js-surface.md new file mode 100644 index 0000000..7cbc99a --- /dev/null +++ b/providers/supabase-js-surface.md @@ -0,0 +1,37 @@ +# Supabase JavaScript client (`supabase/js-surface`) + +## What it watches + +The public API of the `@supabase/supabase-js` package on npm, release by release, read from its TypeScript declarations: exported names removed, class members removed, parameters removed, and parameters that are no longer optional. One `package_release` event per change. Every final release is listed from the npm registry (pre-releases and deprecated versions left out), and each consecutive pair is compared. + +Kind: `apisurface` (`plugins/apisurface`), with the TypeScript declaration reader (`plugins/apisurface/dtsurface`). + +## Why this source + +- **Source:** the release tarballs on the npm registry (), each version's `dist.tarball`, read as published; the code is at . Checked on 2026-11-21. +- **Why this one:** the declarations in the tarball are exactly what TypeScript checks a customer's code against after `npm install @supabase/supabase-js@`, and what editors show JavaScript users. A published tarball never changes, so its URL is its own citation, and the line quoted is in it. +- **Alternatives considered:** CHANGELOG.md; the v2 migration guide. +- **Quote:** `getSubscriptions(): RealtimeSubscription[]` (`SupabaseClient`, `dist/module/SupabaseClient.d.ts` line 100) at 1.35.7, gone at 2.0.0. + +## How the provider announces changes + +- The client is small and wraps separate packages (`@supabase/auth-js`, `@supabase/postgrest-js`, …) whose APIs it re-exports wholesale. +- **Forced on upgrade**, for a repo whose lockfile reaches the release. + +## What the plugin reads and ignores + +- Reads `package.json` and the `.d.ts`, `.d.mts` and `.d.cts` files of each release's tarball from the npm registry, in memory, as text (`plugins/apisurface/dtsurface`): nothing in the package is run, no install script, no TypeScript compiler. The entry points are `package.json`'s `exports` (each subpath, wildcards matched against the files; for each, its `types` condition, else the `import` one), or its `types`/`typings`. +- For each entry point: every exported name (classes, functions, enums, variables, interfaces, type aliases, namespaces, and names re-exported from another package, by name only), and below a class or namespace what it holds: a class's public methods and properties, and its constructor's parameters; a namespace's classes, functions and namespaces. Symbols are named by the import path code writes: `@supabase/supabase-js.SupabaseClient.from`. +- Parameters compare by position, as TypeScript passes them: a parameter gone off the end (with no rest parameter now) is removed; one optional before and required now is a `changed_default`. A renamed parameter is no change. +- Ignores names marked `@internal`, `private` and `protected` members, `#private` fields, setters, index signatures, interface and object-type members, interfaces and type aliases inside a namespace (an entry point's own are read), entry points under a private path (`_shims`, `internal`, `src`), the `./index` duplicate of the root, and what the default export holds (it's the same declaration as a named one). +- One declaration reachable at several import paths is one event, every path in its `symbols`. +- Drops (and logs) a removal that may not be one: a member of a name now re-exported from another package, now a value, an interface or a type (whose members aren't read); a method gone from a class that extends a class of another package (it may define it); a name an entry point may still get from a package it re-exports wholesale (`export * from "other"`). + +## Known gaps + +- What a property's type holds isn't followed: `client.chat.completions.create` is read as the `Completions` class's `create`, reached through namespaces and entry points, not through the `chat` property's type. +- Type changes (a parameter's type narrowed, a return type changed, an interface's fields) aren't events. +- A package that re-exports another wholesale (`export * from "@scope/core"`) hides that package's API: it's a source of its own, or not read. +- Classes are indexed by name across files to follow a method to its base class: two classes of the same name (in two namespaces) are read as one, which can only turn a removal into a note, never add one. +- A parameter added without being optional is a note (the change-event contract has no subject for it yet). +- The packages it wraps are separate packages, not read by this source.